SmartFusion2 CLI working with polled UART, about to convert to interrupt driven UART.

pull/4/head
Richard Barry
parent 8732e8efc5
commit 5ff880fee8

@ -98,8 +98,12 @@
#include <stdint.h>
extern uint32_t SystemCoreClock;
/* Driver includes required for UART IO. */
#include "drivers/mss_uart/mss_uart.h"
extern const mss_uart_instance_t * const pxUART;
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
@ -150,7 +154,7 @@ are multiple command interpreters running at once (for example, one on a UART
and one on TCP/IP). This is done to prevent an output buffer being defined by
each implementation - which would waste RAM. In this case, there is only one
command interpreter running. */
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 128
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS

@ -80,6 +80,7 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* FreeRTOS+CLI includes. */
#include "FreeRTOS_CLI.h"
@ -570,5 +571,5 @@ const char * pcAttrib;
/* Create a string that includes the file name, the file size and the
attributes string. */
sprintf( ( char * ) pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, pxFindStruct->filesize );
sprintf( ( char * ) pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, ( int ) pxFindStruct->filesize );
}

@ -79,6 +79,7 @@
/* Standard includes. */
#include <stdio.h>
#include <string.h>
/* FreeRTOS includes. */
#include "FreeRTOS.h"
@ -187,7 +188,7 @@ F_FILE *pxFile;
for( xFileNumber = 1; xFileNumber <= fsROOT_FILES; xFileNumber++ )
{
/* Generate a file name. */
sprintf( cFileName, "root%03d.txt", xFileNumber );
sprintf( cFileName, "root%03d.txt", ( int ) xFileNumber );
/* Obtain the current working directory and print out the file name and
the directory into which the file is being written. */
@ -229,7 +230,7 @@ F_FILE *pxFile;
for( xFileNumber = 1; xFileNumber <= fsROOT_FILES; xFileNumber++ )
{
/* Generate the file name. */
sprintf( cFileName, "root%03d.txt", xFileNumber );
sprintf( cFileName, "root%03d.txt", ( int ) xFileNumber );
/* Obtain the current working directory and print out the file name and
the directory from which the file is being read. */

@ -83,7 +83,7 @@ static void prvUARTCommandConsoleTask( void *pvParameters );
/*-----------------------------------------------------------*/
/* Const messages output by the command console. */
static const uint8_t * const pcWelcomeMessage = ( uint8_t * ) "FreeRTOS command server.\r\nType Help to view a list of registered commands.\r\n\r\n>";
static const uint8_t * const pcWelcomeMessage = ( uint8_t * ) "\r\n\r\nFreeRTOS command server.\r\nType Help to view a list of registered commands.\r\n\r\n>";
static const uint8_t * const pcEndOfOutputMessage = ( uint8_t * ) "\r\n[Press ENTER to execute the previous command again]\r\n>";
static const uint8_t * const pcNewLine = ( uint8_t * ) "\r\n";
@ -115,9 +115,6 @@ mss_uart_instance_t * const pxUART = &g_mss_uart0;
interface will be used at any one time. */
pcOutputString = FreeRTOS_CLIGetOutputBuffer();
/* Initialise the UART. */
MSS_UART_init( pxUART, MSS_UART_115200_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT );
/* Send the welcome message. */
MSS_UART_polled_tx_string( pxUART, ( uint8_t * ) pcWelcomeMessage );
@ -127,10 +124,10 @@ mss_uart_instance_t * const pxUART = &g_mss_uart0;
cRxedChar = 0;
/* Only interested in reading one character at a time. */
MSS_UART_get_rx( pxUART, &cRxedChar, sizeof( cRxedChar ) );
if( MSS_UART_get_rx( pxUART, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) ) > 0 )
{
/* Echo the character back. */
MSS_UART_polled_tx( pxUART, &cRxedChar, sizeof( cRxedChar ) );
MSS_UART_polled_tx( pxUART, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) );
/* Was it the end of the line? */
if( cRxedChar == '\n' || cRxedChar == '\r' )
@ -203,6 +200,7 @@ mss_uart_instance_t * const pxUART = &g_mss_uart0;
}
}
}
}
}
/*-----------------------------------------------------------*/

@ -161,7 +161,7 @@ check timer, only two are used by the flash timers. */
standard demo flash timers. */
#define mainCHECK_LED ( 1 )
/* The size of the stack and the priority used by the UART CDC command console
/* The size of the stack and the priority used by the UART command console
task. */
#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3 )
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( tskIDLE_PRIORITY )
@ -178,7 +178,7 @@ static void prvCheckTimerCallback( xTimerHandle xTimer );
* defined in CLI-Commands.c and File-Related-CLI-Command.c respectively.
*/
extern void vRegisterSampleCLICommands( void );
extern vRegisterFileSystemCLICommands( void );
extern void vRegisterFileSystemCLICommands( void );
/*-----------------------------------------------------------*/

@ -119,6 +119,8 @@ void vApplicationIdleHook( void );
void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName );
void vApplicationTickHook( void );
/* The UART used for printf() and CLI IO. */
const mss_uart_instance_t * const pxUART = &g_mss_uart0;
/*-----------------------------------------------------------*/
/* See the documentation page for this demo on the FreeRTOS.org web site for
full information - including hardware setup requirements. */
@ -150,6 +152,9 @@ static void prvSetupHardware( void )
functions. The name ParTest is now somewhat obsolete - originally it
stood for PARallel port Test. */
vParTestInitialise();
/* Initialise the UART which is used for printf() and CLI IO. */
MSS_UART_init( pxUART, MSS_UART_115200_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT );
}
/*-----------------------------------------------------------*/

@ -24,22 +24,19 @@
replace outbyte(c) by your own function call.
*/
#define putchar(c) c
#include "FreeRTOS.h"
#include <stdarg.h>
#include <stdint.h>
static void printchar(char **str, int c)
{
//extern int putchar(int c);
if (str) {
**str = (char)c;
++(*str);
}
else
{
(void)putchar(c);
MSS_UART_polled_tx( pxUART, ( uint8_t * ) &c, sizeof( uint8_t ) );
}
}

Loading…
Cancel
Save