mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-22 14:31:59 -04:00
Minor formatting changes to the GCC PSoC demo.
This commit is contained in:
parent
17e1e7dfd3
commit
ad3207a226
|
@ -67,6 +67,7 @@ static volatile char cLedOutput[ partstMAX_LED ];
|
||||||
void vParTestInitialise( void )
|
void vParTestInitialise( void )
|
||||||
{
|
{
|
||||||
long lIndex;
|
long lIndex;
|
||||||
|
|
||||||
for( lIndex = 0; lIndex < partstMAX_LED; lIndex++ )
|
for( lIndex = 0; lIndex < partstMAX_LED; lIndex++ )
|
||||||
{
|
{
|
||||||
cLedOutput[ lIndex ] = 0;
|
cLedOutput[ lIndex ] = 0;
|
||||||
|
|
|
@ -92,6 +92,7 @@ xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned port
|
||||||
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
|
||||||
{
|
{
|
||||||
unsigned short usIndex = 0;
|
unsigned short usIndex = 0;
|
||||||
|
|
||||||
for( usIndex = 0; usIndex < usStringLength; usIndex++ )
|
for( usIndex = 0; usIndex < usStringLength; usIndex++ )
|
||||||
{
|
{
|
||||||
/* Check for pre-mature end of line. */
|
/* Check for pre-mature end of line. */
|
||||||
|
@ -112,6 +113,7 @@ unsigned short usIndex = 0;
|
||||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xReturn = pdFALSE;
|
portBASE_TYPE xReturn = pdFALSE;
|
||||||
|
|
||||||
if( pdTRUE == xQueueReceive( xSerialRxQueue, pcRxedChar, xBlockTime ) )
|
if( pdTRUE == xQueueReceive( xSerialRxQueue, pcRxedChar, xBlockTime ) )
|
||||||
{
|
{
|
||||||
/* Picked up a character. */
|
/* Picked up a character. */
|
||||||
|
@ -137,9 +139,8 @@ portBASE_TYPE xReturn = pdFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that the interrupt will fire in the case where:
|
/* Make sure that the interrupt will fire in the case where:
|
||||||
* Currently sending so the Tx Complete will fire.
|
Currently sending so the Tx Complete will fire.
|
||||||
* Not sending so the Empty will fire.
|
Not sending so the Empty will fire. */
|
||||||
*/
|
|
||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
UART_1_SetTxInterruptMode( UART_1_TX_STS_COMPLETE | UART_1_TX_STS_FIFO_EMPTY );
|
UART_1_SetTxInterruptMode( UART_1_TX_STS_COMPLETE | UART_1_TX_STS_FIFO_EMPTY );
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
@ -150,7 +151,7 @@ portBASE_TYPE xReturn = pdFALSE;
|
||||||
|
|
||||||
CY_ISR(vUartRxISR)
|
CY_ISR(vUartRxISR)
|
||||||
{
|
{
|
||||||
portBASE_TYPE xTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
volatile unsigned char ucStatus = 0;
|
volatile unsigned char ucStatus = 0;
|
||||||
signed char cInChar = 0;
|
signed char cInChar = 0;
|
||||||
unsigned long ulMask = 0;
|
unsigned long ulMask = 0;
|
||||||
|
@ -168,7 +169,7 @@ unsigned long ulMask = 0;
|
||||||
ulMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
ulMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
{
|
{
|
||||||
/* Try to deliver the character. */
|
/* Try to deliver the character. */
|
||||||
if ( pdTRUE != xQueueSendFromISR( xSerialRxQueue, &cInChar, &xTaskWoken ) )
|
if( pdTRUE != xQueueSendFromISR( xSerialRxQueue, &cInChar, &xHigherPriorityTaskWoken ) )
|
||||||
{
|
{
|
||||||
/* Run out of space. */
|
/* Run out of space. */
|
||||||
}
|
}
|
||||||
|
@ -176,14 +177,20 @@ unsigned long ulMask = 0;
|
||||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulMask );
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulMask );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we delivered the character then a context switch might be required. */
|
/* If we delivered the character then a context switch might be required.
|
||||||
portEND_SWITCHING_ISR( xTaskWoken );
|
xHigherPriorityTaskWoken was set to pdFALSE on interrupt entry. If calling
|
||||||
|
xQueueSendFromISR() caused a task to unblock, and the unblocked task has
|
||||||
|
a priority equal to or higher than the currently running task (the task this
|
||||||
|
ISR interrupted), then xHigherPriorityTaskWoken will have been set to pdTRUE and
|
||||||
|
portEND_SWITCHING_ISR() will request a context switch to the newly unblocked
|
||||||
|
task. */
|
||||||
|
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
CY_ISR(vUartTxISR)
|
CY_ISR(vUartTxISR)
|
||||||
{
|
{
|
||||||
portBASE_TYPE xTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
volatile unsigned char ucStatus = 0;
|
volatile unsigned char ucStatus = 0;
|
||||||
signed char cOutChar = 0;
|
signed char cOutChar = 0;
|
||||||
unsigned long ulMask = 0;
|
unsigned long ulMask = 0;
|
||||||
|
@ -192,35 +199,38 @@ unsigned long ulMask = 0;
|
||||||
ucStatus = UART_1_ReadTxStatus();
|
ucStatus = UART_1_ReadTxStatus();
|
||||||
|
|
||||||
/* Check to see whether this is a genuine interrupt. */
|
/* Check to see whether this is a genuine interrupt. */
|
||||||
if ( ( 0 != ( ucStatus & UART_1_TX_STS_COMPLETE ) )
|
if( ( 0 != ( ucStatus & UART_1_TX_STS_COMPLETE ) ) || ( 0 != ( ucStatus & UART_1_TX_STS_FIFO_EMPTY ) ) )
|
||||||
|| ( 0 != ( ucStatus & UART_1_TX_STS_FIFO_EMPTY ) ) )
|
|
||||||
{
|
{
|
||||||
/* Mask off the other RTOS interrupts to interact with the queue. */
|
/* Mask off the other RTOS interrupts to interact with the queue. */
|
||||||
ulMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
ulMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
{
|
{
|
||||||
if ( pdTRUE == xQueueReceiveFromISR( xSerialTxQueue, &cOutChar, &xTaskWoken ) )
|
if( pdTRUE == xQueueReceiveFromISR( xSerialTxQueue, &cOutChar, &xHigherPriorityTaskWoken ) )
|
||||||
{
|
{
|
||||||
/* Send the next character. */
|
/* Send the next character. */
|
||||||
UART_1_PutChar( cOutChar );
|
UART_1_PutChar( cOutChar );
|
||||||
|
|
||||||
/* If we are firing, then the only interrupt we are interested in
|
/* If we are firing, then the only interrupt we are interested in
|
||||||
* is the Complete. The application code will add the Empty interrupt
|
is the Complete. The application code will add the Empty interrupt
|
||||||
* when there is something else to be done.
|
when there is something else to be done. */
|
||||||
*/
|
|
||||||
UART_1_SetTxInterruptMode( UART_1_TX_STS_COMPLETE );
|
UART_1_SetTxInterruptMode( UART_1_TX_STS_COMPLETE );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* There is no work left so disable the interrupt
|
/* There is no work left so disable the interrupt until the application
|
||||||
* until the application puts more into the queue.
|
puts more into the queue. */
|
||||||
*/
|
|
||||||
UART_1_SetTxInterruptMode( 0 );
|
UART_1_SetTxInterruptMode( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulMask );
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulMask );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we delivered the character then a context switch might be required. */
|
/* If we delivered the character then a context switch might be required.
|
||||||
portEND_SWITCHING_ISR( xTaskWoken );
|
xHigherPriorityTaskWoken was set to pdFALSE on interrupt entry. If calling
|
||||||
|
xQueueSendFromISR() caused a task to unblock, and the unblocked task has
|
||||||
|
a priority equal to or higher than the currently running task (the task this
|
||||||
|
ISR interrupted), then xHigherPriorityTaskWoken will have been set to pdTRUE and
|
||||||
|
portEND_SWITCHING_ISR() will request a context switch to the newly unblocked
|
||||||
|
task. */
|
||||||
|
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -107,7 +107,7 @@ tick hook. */
|
||||||
extern void vSetupTimerTest( void );
|
extern void vSetupTimerTest( void );
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The Check task periodical interrogates each of the running tests to
|
* The Check task periodical interrogates each of the running tests to
|
||||||
* ensure that they are still executing correctly.
|
* ensure that they are still executing correctly.
|
||||||
* If all the tests pass, then the LCD is updated with Pass, the number of
|
* If all the tests pass, then the LCD is updated with Pass, the number of
|
||||||
|
@ -117,7 +117,7 @@ extern void vSetupTimerTest( void );
|
||||||
*/
|
*/
|
||||||
void vCheckTask( void *pvParameters );
|
void vCheckTask( void *pvParameters );
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Installs the RTOS interrupt handlers and starts the peripherals.
|
* Installs the RTOS interrupt handlers and starts the peripherals.
|
||||||
*/
|
*/
|
||||||
static void prvHardwareSetup( void );
|
static void prvHardwareSetup( void );
|
||||||
|
@ -131,25 +131,6 @@ unsigned long ulIteration = 0;
|
||||||
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
|
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
|
||||||
prvHardwareSetup();
|
prvHardwareSetup();
|
||||||
|
|
||||||
/* Poll the switch connected to P1[7]
|
|
||||||
* to prevent the Soak test from (re)starting.
|
|
||||||
*/
|
|
||||||
while ( 0 != Startup_Release_Switch_Read() )
|
|
||||||
{
|
|
||||||
if ( 100000 <= ulIteration++ )
|
|
||||||
{
|
|
||||||
vParTestToggleLED( ulLed++ );
|
|
||||||
ulLed = ulLed % 4;
|
|
||||||
ulIteration = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset the LEDS. */
|
|
||||||
for ( ulLed = 0; ulLed < 4; ulLed++ )
|
|
||||||
{
|
|
||||||
vParTestSetLED( ulLed, pdFALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start the standard demo tasks. These are just here to exercise the
|
/* Start the standard demo tasks. These are just here to exercise the
|
||||||
kernel port and provide examples of how the FreeRTOS API can be used. */
|
kernel port and provide examples of how the FreeRTOS API can be used. */
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
|
@ -181,7 +162,10 @@ unsigned long ulIteration = 0;
|
||||||
task. The idle task is created within vTaskStartScheduler(). */
|
task. The idle task is created within vTaskStartScheduler(). */
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
/* Should never reach here. */
|
/* Should never reach here as the kernel will now be running. If
|
||||||
|
vTaskStartScheduler() does return then it is very likely that there was
|
||||||
|
insufficient (FreeRTOS) heap space available to create all the tasks,
|
||||||
|
including the idle task that is created within vTaskStartScheduler() itself. */
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -335,6 +319,7 @@ extern unsigned portSHORT usMaxJitter;
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||||
{
|
{
|
||||||
/* The stack space has been execeeded for a task, considering allocating more. */
|
/* The stack space has been execeeded for a task, considering allocating more. */
|
||||||
|
taskDISABLE_INTERRUPTS();
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -342,6 +327,7 @@ void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName
|
||||||
void vApplicationMallocFailedHook( void )
|
void vApplicationMallocFailedHook( void )
|
||||||
{
|
{
|
||||||
/* The heap space has been execeeded. */
|
/* The heap space has been execeeded. */
|
||||||
|
taskDISABLE_INTERRUPTS();
|
||||||
for( ;; );
|
for( ;; );
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue