Ensure the SmartFusion2 interrupt driven UART drivers are not passed a zero length buffer.

This commit is contained in:
Richard Barry 2013-05-14 13:22:37 +00:00
parent 94f178c8d1
commit 9b153b3e06
2 changed files with 14 additions and 11 deletions

View File

@ -50,7 +50,7 @@
</option>
<option id="gnu.c.compiler.option.misc.verbose.1351799799" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.optimization.flags.435998408" name="Other optimization flags" superClass="gnu.c.compiler.option.optimization.flags" value="-ffunction-sections -fdata-sections" valueType="string"/>
<option id="gnu.c.compiler.option.misc.other.1001754914" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -Wextra" valueType="string"/>
<option id="gnu.c.compiler.option.misc.other.1001754914" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -Wextra" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2036217646" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cross.cortexm3.exe.debug.612642130" name="GNU C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cross.cortexm3.exe.debug">

View File

@ -240,17 +240,20 @@ static void prvSendBuffer( const uint8_t * pcBuffer, size_t xBufferLength )
{
const portTickType xVeryShortDelay = 2UL;
MSS_UART_irq_tx( ( mss_uart_instance_t * ) pxUART, pcBuffer, xBufferLength );
/* Ensure any previous transmissions have completed. The default UART
interrupt does not provide an event based method of signally the end of a Tx
- this is therefore a crude poll of the Tx end status. Replacing the
default UART handler with one that 'gives' a semaphore when the Tx is
complete would allow this poll loop to be replaced by a simple semaphore
block. */
while( MSS_UART_tx_complete( ( mss_uart_instance_t * ) pxUART ) == pdFALSE )
if( xBufferLength > 0 )
{
vTaskDelay( xVeryShortDelay );
MSS_UART_irq_tx( ( mss_uart_instance_t * ) pxUART, pcBuffer, xBufferLength );
/* Ensure any previous transmissions have completed. The default UART
interrupt does not provide an event based method of signally the end of a Tx
- this is therefore a crude poll of the Tx end status. Replacing the
default UART handler with one that 'gives' a semaphore when the Tx is
complete would allow this poll loop to be replaced by a simple semaphore
block. */
while( MSS_UART_tx_complete( ( mss_uart_instance_t * ) pxUART ) == pdFALSE )
{
vTaskDelay( xVeryShortDelay );
}
}
}
/*-----------------------------------------------------------*/