/* FreeRTOS includes. */\r
#include "FreeRTOS.h"\r
#include "task.h"\r
-#include "semphr.h"\r
+#include "queue.h"\r
\r
/* Driver includes. */\r
#include "drivers/mss_uart/mss_uart.h"\r
/* The maximum time in ticks to wait for the UART access mutex. */\r
#define cmdMAX_MUTEX_WAIT ( 200 / portTICK_RATE_MS )\r
\r
+/* Characters are only ever received slowly on the CLI so it is ok to pass\r
+received characters from the UART interrupt to the task on a queue. This sets\r
+the length of the queue used for that purpose. */\r
+#define cmdRXED_CHARS_QUEUE_LENGTH ( 10 )\r
+\r
/*-----------------------------------------------------------*/\r
\r
/*\r
*/\r
static void prvUARTCommandConsoleTask( void *pvParameters );\r
\r
+/*\r
+ * Ensure a previous interrupt driven Tx has completed before sending the next\r
+ * data block to the UART.
+ */\r
+static void prvSendBuffer( const uint8_t * pcBuffer, size_t xBufferLength );\r
+\r
+/*\r
+ * A UART is used for printf() output and CLI input and output. Configure the\r
+ * UART and register prvUARTRxNotificationHandler() to handle UART Rx events.\r
+ */\r
+static void prvConfigureUART( void );\r
+static void prvUARTRxNotificationHandler( mss_uart_instance_t * this_uart );\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* Const messages output by the command console. */\r
static const uint8_t * const pcEndOfOutputMessage = ( uint8_t * ) "\r\n[Press ENTER to execute the previous command again]\r\n>";\r
static const uint8_t * const pcNewLine = ( uint8_t * ) "\r\n";\r
\r
+/* The UART used by the CLI. */\r
+static const mss_uart_instance_t * const pxUART = &g_mss_uart0;\r
+static const IRQn_Type xUART_IRQ = UART0_IRQn;\r
+\r
+/* Because characters are received slowly (at the speed somebody can type) then\r
+it is ok to pass received characters from the Rx interrupt to the task on a\r
+queue. This is the queue used for that purpose. */\r
+static xQueueHandle xRxedChars = NULL;\r
+\r
/*-----------------------------------------------------------*/\r
\r
void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPriority )\r
{\r
+ /* A UART is used for printf() output and CLI input and output. Note there\r
+ is no mutual exclusion on the UART, but the demo as it stands does not\r
+ require mutual exclusion. */\r
+ prvConfigureUART();\r
+\r
/* Create that task that handles the console itself. */\r
xTaskCreate( prvUARTCommandConsoleTask, /* The task that implements the command console. */\r
( const int8_t * const ) "CLI", /* Text name assigned to the task. This is just to assist debugging. The kernel does not use this name itself. */\r
int8_t cRxedChar, cInputIndex = 0, *pcOutputString;\r
static int8_t cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ];\r
portBASE_TYPE xReturned;\r
-mss_uart_instance_t * const pxUART = &g_mss_uart0;\r
\r
( void ) pvParameters;\r
\r
pcOutputString = FreeRTOS_CLIGetOutputBuffer();\r
\r
/* Send the welcome message. */\r
- MSS_UART_polled_tx_string( pxUART, ( uint8_t * ) pcWelcomeMessage );\r
+ prvSendBuffer( pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) );\r
\r
for( ;; )\r
{\r
- /* No characters received yet for the current input string. */\r
- cRxedChar = 0;\r
-\r
- /* Only interested in reading one character at a time. */\r
- if( MSS_UART_get_rx( pxUART, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) ) > 0 )\r
+ /* Wait for the next character to arrive. */\r
+ if( xQueueReceive( xRxedChars, &cRxedChar, portMAX_DELAY ) == pdPASS )\r
{\r
/* Echo the character back. */\r
- MSS_UART_polled_tx( pxUART, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) );\r
+ prvSendBuffer( ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) );\r
\r
/* Was it the end of the line? */\r
if( cRxedChar == '\n' || cRxedChar == '\r' )\r
{\r
/* Just to space the output from the input. */\r
- MSS_UART_polled_tx_string( pxUART, ( uint8_t * ) pcNewLine );\r
+ prvSendBuffer( ( uint8_t * ) pcNewLine, strlen( ( char * ) pcNewLine ) );\r
\r
/* See if the command is empty, indicating that the last command is\r
to be executed again. */\r
xReturned = FreeRTOS_CLIProcessCommand( cInputString, pcOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE );\r
\r
/* Write the generated string to the UART. */\r
- MSS_UART_polled_tx_string( pxUART, ( uint8_t * ) pcOutputString );\r
- vTaskDelay( 1 );\r
+ prvSendBuffer( ( uint8_t * ) pcOutputString, strlen( ( char * ) pcOutputString ) );\r
\r
} while( xReturned != pdFALSE );\r
\r
cInputIndex = 0;\r
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );\r
\r
- MSS_UART_polled_tx_string( pxUART, ( uint8_t * ) pcEndOfOutputMessage );\r
+ prvSendBuffer( ( uint8_t * ) pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) );\r
}\r
else\r
{\r
}\r
/*-----------------------------------------------------------*/\r
\r
+static void prvSendBuffer( const uint8_t * pcBuffer, size_t xBufferLength )\r
+{\r
+const portTickType xVeryShortDelay = 2UL;\r
+\r
+ MSS_UART_irq_tx( ( mss_uart_instance_t * ) pxUART, pcBuffer, xBufferLength );\r
+\r
+ /* Ensure any previous transmissions have completed. The default UART\r
+ interrupt does not provide an event based method of signally the end of a Tx\r
+ - this is therefore a crude poll of the Tx end status. Replacing the\r
+ default UART handler with one that 'gives' a semaphore when the Tx is\r
+ complete would allow this poll loop to be replaced by a simple semaphore\r
+ block. */\r
+ while( MSS_UART_tx_complete( ( mss_uart_instance_t * ) pxUART ) == pdFALSE )\r
+ {\r
+ vTaskDelay( xVeryShortDelay );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvConfigureUART( void )\r
+{\r
+ /* Initialise the UART which is used for printf() and CLI IO. */\r
+ MSS_UART_init( ( mss_uart_instance_t * ) pxUART, MSS_UART_115200_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT );\r
+\r
+ /* Characters are only ever received slowly on the CLI so it is ok to pass\r
+ received characters from the UART interrupt to the task on a queue. Create\r
+ the queue used for that purpose. */\r
+ xRxedChars = xQueueCreate( cmdRXED_CHARS_QUEUE_LENGTH, sizeof( char ) );\r
+\r
+ /* The interrupt handler makes use of FreeRTOS API functions, so its\r
+ priority must be at or below the configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY\r
+ setting (the higher the numeric priority, the lower the logical priority). */\r
+ NVIC_SetPriority( xUART_IRQ, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );\r
+\r
+ /* Set the UART Rx notification function. */\r
+ MSS_UART_set_rx_handler( ( mss_uart_instance_t * ) pxUART, prvUARTRxNotificationHandler, MSS_UART_FIFO_SINGLE_BYTE );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvUARTRxNotificationHandler( mss_uart_instance_t * pxUART )\r
+{\r
+uint8_t cRxed;\r
+portBASE_TYPE xHigherPriorityTaskWoken;\r
+\r
+ /* The command console receives data very slowly (at the speed of somebody\r
+ typing), therefore it is ok to just handle one character at a time and use\r
+ a queue to send the characters to the task. */\r
+ if( MSS_UART_get_rx( pxUART, &cRxed, sizeof( cRxed ) ) == sizeof( cRxed ) )\r
+ {\r
+ xHigherPriorityTaskWoken = pdFALSE;\r
+ xQueueSendFromISR( xRxedChars, &cRxed, &xHigherPriorityTaskWoken );\r
+\r
+ /* portEND_SWITCHING_ISR() or portYIELD_FROM_ISR() can be used here. */\r
+ portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+ }\r
+}\r
+\r
* been discovered. If the green LED toggles every 200ms, then an issue has\r
* been discovered with at least one task.\r
*\r
+ * FreeRTOS+CLI command console. The command console is access through UART0\r
+ * using 115200 baud and the Microsemi MSS UART drivers. Type "help" to see a\r
+ * list of registered commands, which include some basic file system commands\r
+ * (see FreeRTOS+FAT SL comments below). The FreeRTOS+CLI license is different\r
+ * to the FreeRTOS license, see http://www.FreeRTOS.org/cli for license and\r
+ * usage details.\r
+ *\r
+ * FreeRTOS+FAT SL. FreeRTOS+FAT SL is demonstrated using a RAM disk. [At the\r
+ * time of writing] The functionality of the file system demo is identical to\r
+ * the functionality of the FreeRTOS Win32 simulator file system demo with the\r
+ * command console being accessed via the UART (as described above) instead of\r
+ * a network terminal. The FreeRTOS+FAT SL license is different to the FreeRTOS\r
+ * license, see http://www.FreeRTOS.org/fat_sl for license and usage details,\r
+ * and a description of the file system demo functionality.\r
+ *\r
* See the documentation page for this demo on the FreeRTOS.org web site for\r
* full information, including hardware setup requirements.\r
*/\r
#include "FreeRTOS.h"\r
#include "task.h"\r
#include "timers.h"\r
-#include "semphr.h"\r
+#include "queue.h"\r
\r
/* Standard demo application includes. */\r
#include "integer.h"\r
\r
/* The size of the stack and the priority used by the UART command console\r
task. */\r
-#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3 )\r
+#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 )\r
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
\r
/*-----------------------------------------------------------*/\r
extern void vRegisterSampleCLICommands( void );\r
extern void vRegisterFileSystemCLICommands( void );\r
\r
+/* Prepare to run the full demo: Configure the IO, register the CLI\r
+ * commands, and depending on configuration, generate a set of sample files on\r
+ * a RAM disk.\r
+ */\r
+static void prvPrepareForFullDemo( void );\r
+\r
+/*\r
+ * Creates and verifies different files on the volume, demonstrating the use of\r
+ * various different API functions.\r
+ */\r
+extern void vCreateAndVerifySampleFiles( void );\r
+\r
/*-----------------------------------------------------------*/\r
\r
void main_full( void )\r
{\r
xTimerHandle xCheckTimer = NULL;\r
\r
- /* If the file system is only going to be accessed from one task then\r
- F_FS_THREAD_AWARE can be set to 0 and the set of example files are created\r
- before the RTOS scheduler is started. If the file system is going to be\r
- access from more than one task then F_FS_THREAD_AWARE must be set to 1 and\r
- the set of sample files are created from the idle task hook function\r
- vApplicationIdleHook() - which is defined in this file. */\r
- #if F_FS_THREAD_AWARE == 0\r
- {\r
- /* Initialise the drive and file system, then create a few example\r
- files. The output from this function just goes to the stdout window,\r
- allowing the output to be viewed when the UDP command console is not\r
- connected. */\r
- vCreateAndVerifySampleFiles();\r
- }\r
- #endif\r
-\r
- /* Register both the standard and file system related CLI commands. */\r
- vRegisterSampleCLICommands();\r
- vRegisterFileSystemCLICommands();\r
+ /* Prepare to run the full demo: Configure the IO, register the CLI\r
+ commands, and depending on configuration, generate a set of sample files on\r
+ a RAM disk. */\r
+ prvPrepareForFullDemo();\r
\r
/* Start all the other standard demo/test tasks. The have not particular\r
functionality, but do demonstrate how to use the FreeRTOS API and test the\r
}\r
/*-----------------------------------------------------------*/\r
\r
+static void prvPrepareForFullDemo( void )\r
+{\r
+ /* If the file system is only going to be accessed from one task then\r
+ F_FS_THREAD_AWARE can be set to 0 and the set of example files are created\r
+ before the RTOS scheduler is started. If the file system is going to be\r
+ access from more than one task then F_FS_THREAD_AWARE must be set to 1 and\r
+ the set of sample files are created from the idle task hook function\r
+ vApplicationIdleHook() - which is defined in this file. */\r
+ #if F_FS_THREAD_AWARE == 0\r
+ {\r
+ /* Initialise the drive and file system, then create a few example\r
+ files. The output from this function just goes to the stdout window,\r
+ allowing the output to be viewed when the UDP command console is not\r
+ connected. */\r
+ vCreateAndVerifySampleFiles();\r
+ }\r
+ #endif\r
+\r
+ /* Register both the standard and file system related CLI commands. */\r
+ vRegisterSampleCLICommands();\r
+ vRegisterFileSystemCLICommands();\r
+}\r
\r
#ifdef __cplusplus\r
extern "C" {\r
-#endif \r
+#endif\r
\r
/*******************************************************************************\r
* Defines\r
/*******************************************************************************\r
* Local functions.\r
*/\r
-static void global_init(mss_uart_instance_t * this_uart, uint32_t baud_rate, \r
+static void global_init(mss_uart_instance_t * this_uart, uint32_t baud_rate,\r
uint8_t line_config);\r
static void MSS_UART_isr(mss_uart_instance_t * this_uart);\r
static void default_tx_handler(mss_uart_instance_t * this_uart);\r
static void config_baud_divisors\r
(\r
mss_uart_instance_t * this_uart,\r
- uint32_t baudrate \r
+ uint32_t baudrate\r
);\r
\r
/*******************************************************************************\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_init\r
(\r
- mss_uart_instance_t* this_uart, \r
+ mss_uart_instance_t* this_uart,\r
uint32_t baud_rate,\r
uint8_t line_config\r
)\r
*/\r
void MSS_UART_lin_init\r
(\r
- mss_uart_instance_t* this_uart, \r
+ mss_uart_instance_t* this_uart,\r
uint32_t baud_rate,\r
uint8_t line_config\r
)\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_irda_init\r
(\r
- mss_uart_instance_t* this_uart, \r
+ mss_uart_instance_t* this_uart,\r
uint32_t baud_rate,\r
uint8_t line_config,\r
mss_uart_rzi_polarity_t rxpol,\r
\r
/* Disable IrDA mode */\r
set_bit_reg8(&this_uart->hw_reg->MM1, EIRD);\r
- ((rxpol == MSS_UART_ACTIVE_LOW) ? clear_bit_reg8(&this_uart->hw_reg->MM1,EIRX) : \r
+ ((rxpol == MSS_UART_ACTIVE_LOW) ? clear_bit_reg8(&this_uart->hw_reg->MM1,EIRX) :\r
set_bit_reg8(&this_uart->hw_reg->MM1,EIRX));\r
- \r
- ((txpol == MSS_UART_ACTIVE_LOW) ? clear_bit_reg8(&this_uart->hw_reg->MM1,EITX) : \r
+\r
+ ((txpol == MSS_UART_ACTIVE_LOW) ? clear_bit_reg8(&this_uart->hw_reg->MM1,EITX) :\r
set_bit_reg8(&this_uart->hw_reg->MM1,EITX));\r
- \r
- ((pw == MSS_UART_3_BY_16) ? clear_bit_reg8(&this_uart->hw_reg->MM1,EITP) : \r
+\r
+ ((pw == MSS_UART_3_BY_16) ? clear_bit_reg8(&this_uart->hw_reg->MM1,EITP) :\r
set_bit_reg8(&this_uart->hw_reg->MM1,EITP));\r
/* Disable SmartCard Mode */\r
clear_bit_reg8(&this_uart->hw_reg->MM2, EERR);\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_smartcard_init\r
(\r
- mss_uart_instance_t* this_uart, \r
+ mss_uart_instance_t* this_uart,\r
uint32_t baud_rate,\r
uint8_t line_config\r
)\r
\r
/* Perform generic initialization */\r
global_init(this_uart, baud_rate, line_config);\r
- \r
+\r
/* Disable LIN mode */\r
clear_bit_reg8(&this_uart->hw_reg->MM0, ELIN);\r
\r
clear_bit_reg8(&this_uart->hw_reg->MM1, EIRD);\r
\r
/* Enable SmartCard Mode : Only when data is 8-bit and 2 stop bits*/\r
- if( ( MSS_UART_DATA_8_BITS | MSS_UART_TWO_STOP_BITS) == \r
+ if( ( MSS_UART_DATA_8_BITS | MSS_UART_TWO_STOP_BITS) ==\r
(line_config & (MSS_UART_DATA_8_BITS | MSS_UART_TWO_STOP_BITS)))\r
{\r
- set_bit_reg8(&this_uart->hw_reg->MM2, EERR); \r
+ set_bit_reg8(&this_uart->hw_reg->MM2, EERR);\r
/* Enable single wire half-duplex mode */\r
set_bit_reg8(&this_uart->hw_reg->MM2,ESWM);\r
}\r
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));\r
ASSERT(MSS_UART_INVALID_IRQ > irq_mask);\r
\r
- if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && \r
+ if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) &&\r
(MSS_UART_INVALID_IRQ > irq_mask))\r
{\r
/* Clear any previously pended interrupts */\r
*/\r
this_uart->hw_reg->IER |= (uint8_t)irq_mask & IIRF_MASK;\r
\r
- /* \r
+ /*\r
* bit 4 - Receiver time-out interrupt\r
* bit 5 - NACK / ERR signal interrupt\r
- * bit 6 - PID parity error interrupt \r
+ * bit 6 - PID parity error interrupt\r
* bit 7 - LIN break detection interrupt\r
* bit 8 - LIN Sync detection interrupt\r
*/\r
*/\r
this_uart->hw_reg->IER &= ((uint8_t)(~((uint32_t)irq_mask & (uint32_t)IIRF_MASK)));\r
\r
- /* \r
+ /*\r
* bit 4 - Receiver time-out interrupt\r
* bit 5 - NACK / ERR signal interrupt\r
- * bit 6 - PID parity error interrupt \r
+ * bit 6 - PID parity error interrupt\r
* bit 7 - LIN break detection interrupt\r
* bit 8 - LIN Sync detection interrupt\r
*/\r
/* Disable local loopback */\r
clear_bit_reg8(&this_uart->hw_reg->MCR,LOOP);\r
break;\r
- \r
+\r
case MSS_UART_LOCAL_LOOPBACK_ON:\r
/* Enable local loopback */\r
set_bit_reg8(&this_uart->hw_reg->MCR,LOOP);\r
break;\r
- \r
+\r
case MSS_UART_REMOTE_LOOPBACK_OFF:\r
case MSS_UART_AUTO_ECHO_OFF:\r
/* Disable remote loopback & automatic echo*/\r
this_uart->hw_reg->MCR &= ~RLOOP_MASK;\r
break;\r
- \r
+\r
case MSS_UART_REMOTE_LOOPBACK_ON:\r
/* Enable remote loopback */\r
this_uart->hw_reg->MCR |= (1u << RLOOP);\r
break;\r
- \r
+\r
case MSS_UART_AUTO_ECHO_ON:\r
/* Enable automatic echo */\r
this_uart->hw_reg->MCR |= (1u << ECHO);\r
break;\r
- \r
+\r
case MSS_UART_INVALID_LOOPBACK:\r
/* Fall through to default. */\r
default:\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_enable_half_duplex\r
(\r
mss_uart_instance_t * this_uart\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_disable_half_duplex\r
(\r
mss_uart_instance_t * this_uart\r
MSS_UART_set_rx_endian\r
(\r
mss_uart_instance_t * this_uart,\r
- mss_uart_endian_t endian \r
+ mss_uart_endian_t endian\r
)\r
{\r
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));\r
ASSERT(MSS_UART_INVALID_ENDIAN > endian);\r
\r
- if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && \r
+ if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) &&\r
(MSS_UART_INVALID_ENDIAN > endian))\r
{\r
/* Configure MSB first / LSB first for receiver */\r
MSS_UART_set_tx_endian\r
(\r
mss_uart_instance_t * this_uart,\r
- mss_uart_endian_t endian \r
+ mss_uart_endian_t endian\r
)\r
{\r
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));\r
ASSERT(MSS_UART_INVALID_ENDIAN > endian);\r
\r
- if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && \r
+ if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) &&\r
(MSS_UART_INVALID_ENDIAN > endian))\r
{\r
/* Configure MSB first / LSB first for transmitter */\r
{\r
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));\r
ASSERT(MSS_UART_INVALID_FILTER_LENGTH > length);\r
- \r
- if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && \r
+\r
+ if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) &&\r
(MSS_UART_INVALID_FILTER_LENGTH > length))\r
{\r
/* Configure glitch filter length */\r
if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1))\r
{\r
/* Enable address flag clearing */\r
- /* Disable RX FIFO till another address flag with \r
+ /* Disable RX FIFO till another address flag with\r
correct address is received */\r
set_bit_reg8(&this_uart->hw_reg->MM2,EAFC);\r
}\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_enable_rx_timeout\r
(\r
mss_uart_instance_t * this_uart,\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_disable_rx_timeout\r
(\r
mss_uart_instance_t * this_uart\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_enable_tx_time_guard\r
(\r
mss_uart_instance_t * this_uart,\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_disable_tx_time_guard\r
(\r
mss_uart_instance_t * this_uart\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_set_ready_mode\r
(\r
mss_uart_instance_t * this_uart,\r
- mss_uart_ready_mode_t mode \r
+ mss_uart_ready_mode_t mode\r
)\r
{\r
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));\r
{\r
/* Configure mode 0 or mode 1 for TXRDY and RXRDY */\r
((MSS_UART_READY_MODE0 == mode) ? clear_bit_reg8(&this_uart->hw_reg->FCR,RDYMODE) :\r
- set_bit_reg8(&this_uart->hw_reg->FCR,RDYMODE) ); \r
+ set_bit_reg8(&this_uart->hw_reg->FCR,RDYMODE) );\r
}\r
}\r
\r
config_baud_divisors\r
(\r
mss_uart_instance_t * this_uart,\r
- uint32_t baudrate \r
+ uint32_t baudrate\r
)\r
{\r
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));\r
- \r
+\r
if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1))\r
{\r
uint32_t baud_value;\r
baud_value = baud_value_by_64 / 64u;\r
fractional_baud_value = baud_value_by_64 - (baud_value * 64u);\r
fractional_baud_value += (baud_value_by_128 - (baud_value * 128u)) - (fractional_baud_value * 2u);\r
- \r
+\r
/* Assert if integer baud value fits in 16-bit. */\r
ASSERT(baud_value <= UINT16_MAX);\r
- \r
+\r
if(baud_value <= (uint32_t)UINT16_MAX)\r
{\r
if(baud_value > 1u)\r
{\r
- /* \r
+ /*\r
* Use Frational baud rate divisors\r
*/\r
/* set divisor latch */\r
set_bit_reg8(&this_uart->hw_reg->LCR,DLAB);\r
- \r
+\r
/* msb of baud value */\r
this_uart->hw_reg->DMR = (uint8_t)(baud_value >> 8);\r
/* lsb of baud value */\r
this_uart->hw_reg->DLR = (uint8_t)baud_value;\r
- \r
+\r
/* reset divisor latch */\r
clear_bit_reg8(&this_uart->hw_reg->LCR,DLAB);\r
- \r
+\r
/* Enable Fractional baud rate */\r
set_bit_reg8(&this_uart->hw_reg->MM0,EFBR);\r
- \r
+\r
/* Load the fractional baud rate register */\r
ASSERT(fractional_baud_value <= (uint32_t)UINT8_MAX);\r
this_uart->hw_reg->DFR = (uint8_t)fractional_baud_value;\r
*/\r
/* set divisor latch */\r
set_bit_reg8(&this_uart->hw_reg->LCR,DLAB);\r
- \r
+\r
/* msb of baud value */\r
this_uart->hw_reg->DMR = (uint8_t)(baud_value >> 8u);\r
/* lsb of baud value */\r
this_uart->hw_reg->DLR = (uint8_t)baud_value;\r
- \r
+\r
/* reset divisor latch */\r
clear_bit_reg8(&this_uart->hw_reg->LCR,DLAB);\r
- \r
+\r
/* Disable Fractional baud rate */\r
clear_bit_reg8(&this_uart->hw_reg->MM0,EFBR);\r
}\r
/***************************************************************************//**\r
* See mss_uart.h for details of how to use this function.\r
*/\r
-void \r
+void\r
MSS_UART_set_usart_mode\r
(\r
mss_uart_instance_t * this_uart,\r
clear_bit_reg8(&this_uart->hw_reg->MM2,EAFM);\r
\r
/* disable TX time gaurd */\r
- clear_bit_reg8(&this_uart->hw_reg->MM0,ETTG); \r
+ clear_bit_reg8(&this_uart->hw_reg->MM0,ETTG);\r
\r
/* set default RX timeout */\r
- clear_bit_reg8(&this_uart->hw_reg->MM0,ERTO); \r
+ clear_bit_reg8(&this_uart->hw_reg->MM0,ERTO);\r
\r
/* disable fractional baud-rate */\r
- clear_bit_reg8(&this_uart->hw_reg->MM0,EFBR); \r
+ clear_bit_reg8(&this_uart->hw_reg->MM0,EFBR);\r
\r
/* disable single wire mode */\r
clear_bit_reg8(&this_uart->hw_reg->MM2,ESWM);\r
this_uart->hw_reg->TTG = 0u;\r
/* set default RX timeout */\r
this_uart->hw_reg->RTO = 0u;\r
- \r
- /* \r
+\r
+ /*\r
* Configure baud rate divisors. This uses the frational baud rate divisor\r
* where possible to provide the most accurate baud rat possible.\r
*/\r
this_uart->tx_handler = NULL_HANDLER;\r
this_uart->linests_handler = NULL_HANDLER;\r
this_uart->modemsts_handler = NULL_HANDLER;\r
- this_uart->rto_handler = NULL_HANDLER; \r
- this_uart->nack_handler = NULL_HANDLER; \r
+ this_uart->rto_handler = NULL_HANDLER;\r
+ this_uart->nack_handler = NULL_HANDLER;\r
this_uart->pid_pei_handler = NULL_HANDLER;\r
- this_uart->break_handler = NULL_HANDLER; \r
- this_uart->sync_handler = NULL_HANDLER; \r
+ this_uart->break_handler = NULL_HANDLER;\r
+ this_uart->sync_handler = NULL_HANDLER;\r
\r
/* Initialize the sticky status */\r
this_uart->status = 0u;\r