* DISCLAIMER\r
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.\r
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all\r
-* applicable laws, including copyright laws. \r
+* applicable laws, including copyright laws.\r
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED\r
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY\r
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,\r
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR\r
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
-* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability \r
-* of this software. By using this software, you agree to the additional terms and conditions found by accessing the \r
+* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability\r
+* of this software. By using this software, you agree to the additional terms and conditions found by accessing the\r
* following link:\r
* http://www.renesas.com/disclaimer\r
*\r
* UARTCommandConsole.c have been added.\r
*\r
* ***NOTE***: Transmitting generates an interrupt for each character, which\r
- * consumes CPU time, and can cause standard demo RTOS tasks that monitor their\r
+ * consumes CPU time, and can cause standard demo RTOS tasks that monitor their\r
* own performance to fail asserts - therefore when using GCC it is best to\r
* compile this file with maximum speed optimisation.\r
*/\r
gp_sci1_tx_address++;\r
g_sci1_tx_count--;\r
}\r
- else \r
+ else\r
{\r
SCI1.SCR.BIT.TIE = 0U;\r
SCI1.SCR.BIT.TEIE = 1U;\r
void r_sci1_callback_transmitend(void)\r
{\r
/* Start user code. Do not edit comment generated here */\r
- BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
+ BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
\r
- /* The sci1_txdone flag is used by the auto generated API only. */\r
- sci1_txdone = TRUE;\r
+ /* The sci1_txdone flag is used by the auto generated API only. */\r
+ sci1_txdone = TRUE;\r
\r
- if( xSendingTask != NULL )\r
- {\r
- /* A task is waiting for the end of the Tx, unblock it now.\r
- http://www.freertos.org/vTaskNotifyGiveFromISR.html */\r
- vTaskNotifyGiveFromISR( xSendingTask, &xHigherPriorityTaskWoken );\r
- xSendingTask = NULL;\r
+ if( xSendingTask != NULL )\r
+ {\r
+ /* A task is waiting for the end of the Tx, unblock it now.\r
+ http://www.freertos.org/vTaskNotifyGiveFromISR.html */\r
+ vTaskNotifyGiveFromISR( xSendingTask, &xHigherPriorityTaskWoken );\r
+ xSendingTask = NULL;\r
\r
- portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
- }\r
+ portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+ }\r
/* End user code. Do not edit comment generated here */\r
}\r
/***********************************************************************************************************************\r
void r_sci1_callback_receiveend(void)\r
{\r
/* Start user code. Do not edit comment generated here */\r
- BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
+ BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
\r
configASSERT( xRxQueue );\r
\r
- /* Transmitting generates an interrupt for each character, which consumes\r
- CPU time, and can cause standard demo RTOS tasks that monitor their own\r
- performance to fail asserts - so don't receive new CLI commands if a\r
- transmit is not already in progress. */\r
- if( sci1_txdone == TRUE )\r
- {\r
- /* Characters received from the UART are stored in this queue, ready to be\r
- received by the application. ***NOTE*** Using a queue in this way is very\r
- convenient, but also very inefficient. It can be used here because\r
- characters will only arrive slowly. In a higher bandwidth system a circular\r
- RAM buffer or DMA should be used in place of this queue. */\r
- xQueueSendFromISR( xRxQueue, &g_rx_char, &xHigherPriorityTaskWoken );\r
- }\r
+ /* Transmitting generates an interrupt for each character, which consumes\r
+ CPU time, and can cause standard demo RTOS tasks that monitor their own\r
+ performance to fail asserts - so don't receive new CLI commands if a\r
+ transmit is not already in progress. */\r
+ if( sci1_txdone == TRUE )\r
+ {\r
+ /* Characters received from the UART are stored in this queue, ready to be\r
+ received by the application. ***NOTE*** Using a queue in this way is very\r
+ convenient, but also very inefficient. It can be used here because\r
+ characters will only arrive slowly. In a higher bandwidth system a circular\r
+ RAM buffer or DMA should be used in place of this queue. */\r
+ xQueueSendFromISR( xRxQueue, &g_rx_char, &xHigherPriorityTaskWoken );\r
+ }\r
\r
/* Set up SCI1 receive buffer again */\r
R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);\r
multiple different demo application. */\r
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )\r
{\r
- ( void ) ulWantedBaud;\r
- ( void ) uxQueueLength;\r
-\r
- /* Characters received from the UART are stored in this queue, ready to be\r
- received by the application. ***NOTE*** Using a queue in this way is very\r
- convenient, but also very inefficient. It can be used here because\r
- characters will only arrive slowly. In a higher bandwidth system a circular\r
- RAM buffer or DMA should be used in place of this queue. */\r
- xRxQueue = xQueueCreate( uxQueueLength, sizeof( char ) );\r
- configASSERT( xRxQueue );\r
-\r
- /* Set up SCI1 receive buffer */\r
- R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);\r
-\r
- /* Ensure the interrupt priority is at or below\r
- configMAX_SYSCALL_INTERRUPT_PRIORITY. */\r
+ ( void ) ulWantedBaud;\r
+ ( void ) uxQueueLength;\r
+\r
+ /* Characters received from the UART are stored in this queue, ready to be\r
+ received by the application. ***NOTE*** Using a queue in this way is very\r
+ convenient, but also very inefficient. It can be used here because\r
+ characters will only arrive slowly. In a higher bandwidth system a circular\r
+ RAM buffer or DMA should be used in place of this queue. */\r
+ xRxQueue = xQueueCreate( uxQueueLength, sizeof( char ) );\r
+ configASSERT( xRxQueue );\r
+\r
+ /* Set up SCI1 receive buffer */\r
+ R_SCI1_Serial_Receive((uint8_t *) &g_rx_char, 1);\r
+\r
+ /* Ensure the interrupt priority is at or below\r
+ configMAX_SYSCALL_INTERRUPT_PRIORITY. */\r
IPR( SCI1, ERI1 ) = configKERNEL_INTERRUPT_PRIORITY + 1;\r
\r
- /* Enable SCI1 operations */\r
- R_SCI1_Start();\r
+ /* Enable SCI1 operations */\r
+ R_SCI1_Start();\r
\r
- /* Only one UART is supported, so it doesn't matter what is returned\r
- here. */\r
- return 0;\r
+ /* Only one UART is supported, so it doesn't matter what is returned\r
+ here. */\r
+ return 0;\r
}\r
\r
/* Function required in order to link UARTCommandConsole.c - which is used by\r
{\r
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 5000 );\r
\r
- /* Only one port is supported. */\r
- ( void ) pxPort;\r
+ /* Only one port is supported. */\r
+ ( void ) pxPort;\r
\r
- /* Clear the flag before initiating a new transmission */\r
- sci1_txdone = FALSE;\r
+ /* Clear the flag before initiating a new transmission */\r
+ sci1_txdone = FALSE;\r
\r
- /* Don't send the string unless the previous string has been sent. */\r
- if( xSendingTask == NULL )\r
- {\r
- /* Ensure the calling task's notification state is not already\r
- pending. */\r
- vTaskNotifyClear( NULL );\r
+ /* Don't send the string unless the previous string has been sent. */\r
+ if( ( xSendingTask == NULL ) && ( usStringLength > 0 ) )\r
+ {\r
+ /* Ensure the calling task's notification state is not already\r
+ pending. */\r
+ vTaskNotifyClear( NULL );\r
\r
- /* Store the handle of the transmitting task. This is used to unblock\r
- the task when the transmission has completed. */\r
- xSendingTask = xTaskGetCurrentTaskHandle();\r
+ /* Store the handle of the transmitting task. This is used to unblock\r
+ the task when the transmission has completed. */\r
+ xSendingTask = xTaskGetCurrentTaskHandle();\r
\r
- /* Send the string using the auto-generated API. */\r
- R_SCI1_Serial_Send( ( uint8_t * ) pcString, usStringLength );\r
+ /* Send the string using the auto-generated API. */\r
+ R_SCI1_Serial_Send( ( uint8_t * ) pcString, usStringLength );\r
\r
- /* Wait in the Blocked state (so not using any CPU time) until the\r
- transmission has completed. */\r
- ulTaskNotifyTake( pdTRUE, xMaxBlockTime );\r
- }\r
+ /* Wait in the Blocked state (so not using any CPU time) until the\r
+ transmission has completed. */\r
+ ulTaskNotifyTake( pdTRUE, xMaxBlockTime );\r
+ }\r
}\r
\r
/* Function required in order to link UARTCommandConsole.c - which is used by\r
multiple different demo application. */\r
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime )\r
{\r
- /* Only one UART is supported. */\r
- ( void ) pxPort;\r
+ /* Only one UART is supported. */\r
+ ( void ) pxPort;\r
\r
- /* Return a received character, if any are available. Otherwise block to\r
- wait for a character. */\r
- return xQueueReceive( xRxQueue, pcRxedChar, xBlockTime );\r
+ /* Return a received character, if any are available. Otherwise block to\r
+ wait for a character. */\r
+ return xQueueReceive( xRxQueue, pcRxedChar, xBlockTime );\r
}\r
\r
/* Function required in order to link UARTCommandConsole.c - which is used by\r
multiple different demo application. */\r
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime )\r
{\r
- /* Just mapped to vSerialPutString() so the block time is not used. */\r
- ( void ) xBlockTime;\r
+ /* Just mapped to vSerialPutString() so the block time is not used. */\r
+ ( void ) xBlockTime;\r
\r
- vSerialPutString( pxPort, &cOutChar, sizeof( cOutChar ) );\r
- return pdPASS;\r
+ vSerialPutString( pxPort, &cOutChar, sizeof( cOutChar ) );\r
+ return pdPASS;\r
}\r
\r
/* End user code. Do not edit comment generated here */\r