Revert "Remove coroutines (#874)" (#1019)

* Revert "Remove coroutines (#874)"

This reverts commit 569c78fd8c.

* Update freertos Kernel submodule to latest head

* Remove temporary files

* Fix MingW demos and spell check

* Fix manifest version; fix headers

* Add ignore files and paths to core-checker.py

* Fix copyright in remaining files

* Fix PR check build failure

1. Remove defining `inline` in Makefile. This was causing build
   warnings.
2. Ensure that the linker removed unused functions from various
   compilation units.
3. Update the linker script so that all the functions are correctly
   placed in FLASH section.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
Aniruddha Kanhere
2023-06-09 15:25:48 -07:00
committed by GitHub
co-authored by Gaurav Aggarwal
parent 9ccae851e7
commit 1277ba1661
605 changed files with 11240 additions and 3628 deletions
-2
View File
@@ -306,7 +306,6 @@ FREERTOS_IGNORED_FILES = [
'interrupt_vector.s',
'reg_test.S',
'gdbinit',
]
FREERTOS_HEADER = [
@@ -358,4 +357,3 @@ def main():
if __name__ == '__main__':
exit(main())
@@ -38,7 +38,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*/
@@ -59,6 +59,9 @@
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -64,7 +64,7 @@ void vParTestInitialise( void )
{
/* This is performed from main() as the io bits are shared with other setup
functions. Ensure the outputs are off to start. */
ulLEDReg = partstALL_OUTPUTS_OFF;
ulLEDReg = partstALL_OUTPUTS_OFF;
/* Enable clock to PIO... */
AT91C_BASE_PS->PS_PCER = AT91C_PS_PIO;
@@ -24,8 +24,8 @@
*
*/
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR USART0.
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR USART0.
This file contains all the serial port components that can be compiled to
either ARM or THUMB mode. Components that must be compiled to ARM mode are
@@ -60,14 +60,14 @@
/* Queues used to hold received characters, and characters waiting to be
transmitted. */
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
/*-----------------------------------------------------------*/
/*
/*
* The queues are created in serialISR.c as they are used from the ISR.
* Obtain references to the queues and THRE Empty flag.
* Obtain references to the queues and THRE Empty flag.
*/
extern void vSerialISRCreateQueues( unsigned portBASE_TYPE uxQueueLength, QueueHandle_t *pxRxedChars, QueueHandle_t *pxCharsForTx );
@@ -84,10 +84,10 @@ extern void ( vUART_ISR_Wrapper )( void );
serialISR.c (which is always compiled to ARM mode. */
vSerialISRCreateQueues( uxQueueLength, &xRxedChars, &xCharsForTx );
if(
( xRxedChars != serINVALID_QUEUE ) &&
( xCharsForTx != serINVALID_QUEUE ) &&
( ulWantedBaud != ( unsigned long ) 0 )
if(
( xRxedChars != serINVALID_QUEUE ) &&
( xCharsForTx != serINVALID_QUEUE ) &&
( ulWantedBaud != ( unsigned long ) 0 )
)
{
portENTER_CRITICAL();
@@ -109,10 +109,10 @@ extern void ( vUART_ISR_Wrapper )( void );
AT91C_BASE_US0->US_TCR = 0;
/* Input clock to baud rate generator is MCK */
ulSpeed = configCPU_CLOCK_HZ * 10;
ulSpeed = configCPU_CLOCK_HZ * 10;
ulSpeed = ulSpeed / 16;
ulSpeed = ulSpeed / ulWantedBaud;
/* compute the error */
ulCD = ulSpeed / 10;
if ((ulSpeed - (ulCD * 10)) >= 5)
@@ -131,10 +131,10 @@ extern void ( vUART_ISR_Wrapper )( void );
Store interrupt handler function address in USART0 vector register... */
AT91C_BASE_AIC->AIC_SVR[ portUSART0_AIC_CHANNEL ] = (unsigned long)vUART_ISR_Wrapper;
/* USART0 interrupt level-sensitive, priority 1... */
AT91C_BASE_AIC->AIC_SMR[ portUSART0_AIC_CHANNEL ] = AIC_SRCTYPE_INT_LEVEL_SENSITIVE | 1;
/* Clear some pending USART0 interrupts (just in case)... */
AT91C_BASE_US0->US_CR = US_RSTSTA;
@@ -25,8 +25,8 @@
*/
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR USART0.
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR USART0.
This file contains all the serial port components that must be compiled
to ARM mode. The components that can be compiled to either ARM or THUMB
@@ -61,8 +61,8 @@
/* Queues used to hold received characters, and characters waiting to be
transmitted. */
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
/*-----------------------------------------------------------*/
@@ -70,7 +70,7 @@ static QueueHandle_t xCharsForTx;
be declared "naked". */
void vUART_ISR_Wrapper( void ) __attribute__ ((naked));
/* The ISR function that actually performs the work. This must be separate
/* The ISR function that actually performs the work. This must be separate
from the wrapper to ensure the correct stack frame is set up. */
void vUART_ISR_Handler( void ) __attribute__ ((noinline));
@@ -81,7 +81,7 @@ void vSerialISRCreateQueues( unsigned portBASE_TYPE uxQueueLength, QueueHandle_t
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
/* Pass back a reference to the queues so the serial API file can
/* Pass back a reference to the queues so the serial API file can
post/receive characters. */
*pxRxedChars = xRxedChars;
*pxCharsForTx = xCharsForTx;
@@ -93,7 +93,7 @@ void vUART_ISR_Wrapper( void )
/* Save the context of the interrupted task. */
portSAVE_CONTEXT();
/* Call the handler. This must be a separate function to ensure the
/* Call the handler. This must be a separate function to ensure the
stack frame is correctly set up. */
__asm volatile( "bl vUART_ISR_Handler" );
@@ -126,7 +126,7 @@ unsigned long ulStatus;
{
/* Queue empty, nothing to send so turn off the Tx interrupt. */
AT91C_BASE_US0->US_IDR = US_TXRDY;
}
}
}
if (ulStatus & US_RXRDY)
@@ -37,7 +37,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
-----------------------------------------------------------*/
@@ -55,6 +55,9 @@
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -35,9 +35,9 @@
const unsigned long led_mask[ NB_LED ]= { LED1, LED2, LED3, LED4 };
void vParTestInitialise( void )
{
{
/* Start with all LED's off. */
AT91F_PIO_SetOutput( AT91C_BASE_PIOA, LED_MASK );
AT91F_PIO_SetOutput( AT91C_BASE_PIOA, LED_MASK );
}
/*-----------------------------------------------------------*/
@@ -67,7 +67,7 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
}
else
{
AT91F_PIO_SetOutput( AT91C_BASE_PIOA, led_mask[ uxLED ] );
AT91F_PIO_SetOutput( AT91C_BASE_PIOA, led_mask[ uxLED ] );
}
}
}
@@ -28,7 +28,7 @@
Sample interrupt driven USB device driver. This is a minimal implementation
for demonstration only. Although functional, it is not a full and compliant
implementation.
The USB device enumerates as a simple 3 axis joystick, and once configured
transmits 3 axis of data which can be viewed from the USB host machine.
@@ -36,13 +36,13 @@
task. The interrupt service routine handles the USB hardware - taking a
snapshot of the USB status at the point of the interrupt. The task receives
the status information from the interrupt for processing at the task level.
See the FreeRTOS.org WEB documentation for more information.
*/
/*
Changes from V2.5.5
+ Descriptors that have a length that is an exact multiple of usbFIFO_LENGTH
can now be transmitted. To this end an extra parameter has been
added to the prvSendControlData() function, and the state
@@ -332,7 +332,7 @@ const char pxManufacturerStringDescriptor[] =
'R', 0x00,
'T', 0x00,
'O', 0x00,
'S', 0x00
'S', 0x00
};
const char pxProductStringDescriptor[] =
@@ -571,18 +571,18 @@ unsigned long ulTemp, ulRxBytes;
/* Clear the interrupts from the ICR register. The bus end interrupt is
cleared separately as it does not appear in the mask register. */
AT91C_BASE_UDP->UDP_ICR = AT91C_BASE_UDP->UDP_IMR | AT91C_UDP_ENDBUSRES;
/* If there are bytes in the FIFO then we have to retrieve them here.
Ideally this would be done at the task level. However we need to clear the
RXSETUP interrupt before leaving the ISR, and this may cause the data in
the FIFO to be overwritten. Also the DIR bit has to be changed before the
RXSETUP bit is cleared (as per the SAM7 manual). */
ulTemp = pxMessage->ulCSR0;
/* Are there any bytes in the FIFO? */
ulRxBytes = ulTemp >> 16;
ulRxBytes &= usbRX_COUNT_MASK;
/* With this minimal implementation we are only interested in receiving
setup bytes on the control end point. */
if( ( ulRxBytes > 0 ) && ( ulTemp & AT91C_UDP_RXSETUP ) )
@@ -591,14 +591,14 @@ unsigned long ulTemp, ulRxBytes;
while( ulRxBytes > 0 )
{
ulRxBytes--;
pxMessage->ucFifoData[ ulRxBytes ] = AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_0 ];
pxMessage->ucFifoData[ ulRxBytes ] = AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_0 ];
}
/* The direction must be changed first. */
usbCSR_SET_BIT( &ulTemp, ( AT91C_UDP_DIR ) );
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulTemp;
}
/* Must write zero's to TXCOMP, STALLSENT, RXSETUP, and the RX DATA
registers to clear the interrupts in the CSR register. */
usbCSR_CLEAR_BIT( &ulTemp, usbINT_CLEAR_MASK );
@@ -606,7 +606,7 @@ unsigned long ulTemp, ulRxBytes;
/* Also clear the interrupts in the CSR1 register. */
ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ];
usbCSR_CLEAR_BIT( &ulTemp, usbINT_CLEAR_MASK );
usbCSR_CLEAR_BIT( &ulTemp, usbINT_CLEAR_MASK );
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ] = ulTemp;
/* The message now contains the entire state and optional data from
@@ -618,7 +618,7 @@ unsigned long ulTemp, ulRxBytes;
it the highest priority task that is ready to execute. */
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
/* Clear the AIC ready for the next interrupt. */
/* Clear the AIC ready for the next interrupt. */
AT91C_BASE_AIC->AIC_EOICR = 0;
}
/*-----------------------------------------------------------*/
@@ -652,7 +652,7 @@ xISRStatus *pxMessage;
if( pxMessage->ulISR & AT91C_UDP_ENDBUSRES )
{
/* Process an end of bus reset interrupt. */
prvResetEndPoints();
prvResetEndPoints();
}
}
else
@@ -685,21 +685,21 @@ static signed char x = 0, y = 0, z = 0;
lState = usbYUP;
}
break;
case usbXDOWN : x -= usbDATA_INC;
if( x <= -usbMAX_COORD )
{
lState = usbYDOWN;
}
break;
case usbYUP : y += usbDATA_INC;
if( y >= usbMAX_COORD )
{
lState = usbXDOWN;
}
break;
case usbYDOWN : y -= usbDATA_INC;
if( y <= -usbMAX_COORD )
{
@@ -718,7 +718,7 @@ static signed char x = 0, y = 0, z = 0;
AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_1 ] = x;
AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_1 ] = y;
AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_1 ] = z;
/* Send the data. */
portENTER_CRITICAL();
{
@@ -801,10 +801,10 @@ unsigned long ulTemp;
static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
{
if( pxMessage->ulCSR0 & AT91C_UDP_RX_DATA_BK0 )
{
{
/* We only expect to receive zero length data here as ACK's.
Set the data pointer to the end of the current Tx packet to
ensure we don't send out any more data. */
ensure we don't send out any more data. */
pxCharsForTx.ulNextCharIndex = pxCharsForTx.ulTotalDataLength;
}
@@ -824,33 +824,33 @@ static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
{
unsigned long ulTemp;
ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ];
ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ];
usbCSR_SET_BIT( &ulTemp, AT91C_UDP_EPEDS | AT91C_UDP_EPTYPE_INT_IN );
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ] = ulTemp;
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ] = ulTemp;
AT91F_UDP_EnableIt( AT91C_BASE_UDP, AT91C_UDP_EPINT1 );
}
portEXIT_CRITICAL();
eDriverState = eREADY_TO_SEND;
}
}
else if( eDriverState == eJUST_GOT_ADDRESS )
{
/* We sent an acknowledgement of a SET_ADDRESS request. Move
to the addressed state. */
if( ulReceivedAddress != ( unsigned long ) 0 )
{
{
AT91C_BASE_UDP->UDP_GLBSTATE = AT91C_UDP_FADDEN;
}
else
{
AT91C_BASE_UDP->UDP_GLBSTATE = 0;
}
}
AT91C_BASE_UDP->UDP_FADDR = ( AT91C_UDP_FEN | ulReceivedAddress );
AT91C_BASE_UDP->UDP_FADDR = ( AT91C_UDP_FEN | ulReceivedAddress );
eDriverState = eNOTHING;
}
else
{
{
/* The TXCOMP was not for any special type of transmission. See
if there is any more data to send. */
prvSendNextSegment();
@@ -863,7 +863,7 @@ static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
unsigned char ucRequest;
unsigned long ulRxBytes;
/* A data packet is available. */
/* A data packet is available. */
ulRxBytes = pxMessage->ulCSR0 >> 16;
ulRxBytes &= usbRX_COUNT_MASK;
@@ -878,15 +878,15 @@ static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
xRequest.usValue = pxMessage->ucFifoData[ usbVALUE_HIGH_BYTE ];
xRequest.usValue <<= 8;
xRequest.usValue |= pxMessage->ucFifoData[ usbVALUE_LOW_BYTE ];
xRequest.usIndex = pxMessage->ucFifoData[ usbINDEX_HIGH_BYTE ];
xRequest.usIndex <<= 8;
xRequest.usIndex |= pxMessage->ucFifoData[ usbINDEX_LOW_BYTE ];
xRequest.usLength = pxMessage->ucFifoData[ usbLENGTH_HIGH_BYTE ];
xRequest.usLength <<= 8;
xRequest.usLength |= pxMessage->ucFifoData[ usbLENGTH_LOW_BYTE ];
/* Manipulate the ucRequestType and the ucRequest parameters to
generate a zero based request selection. This is just done to
break up the requests into subsections for clarity. The
@@ -897,28 +897,28 @@ static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
switch( ucRequest )
{
case usbSTANDARD_DEVICE_REQUEST:
case usbSTANDARD_DEVICE_REQUEST:
/* Standard Device request */
prvHandleStandardDeviceRequest( &xRequest );
break;
case usbSTANDARD_INTERFACE_REQUEST:
case usbSTANDARD_INTERFACE_REQUEST:
/* Standard Interface request */
prvHandleStandardInterfaceRequest( &xRequest );
break;
case usbSTANDARD_END_POINT_REQUEST:
case usbSTANDARD_END_POINT_REQUEST:
/* Standard Endpoint request */
prvHandleStandardEndPointRequest( &xRequest );
break;
case usbCLASS_INTERFACE_REQUEST:
case usbCLASS_INTERFACE_REQUEST:
/* Class Interface request */
prvHandleClassInterfaceRequest( &xRequest );
break;
default: /* This is not something we want to respond to. */
prvSendStall();
prvSendStall();
}
}
}
@@ -933,7 +933,7 @@ static void prvGetStandardDeviceDescriptor( xUSB_REQUEST *pxRequest )
case usbDESCRIPTOR_TYPE_DEVICE:
prvSendControlData( ( unsigned char * ) &pxDeviceDescriptor, pxRequest->usLength, sizeof( pxDeviceDescriptor ), pdTRUE );
break;
case usbDESCRIPTOR_TYPE_CONFIGURATION:
prvSendControlData( ( unsigned char * ) &( pxConfigDescriptor ), pxRequest->usLength, sizeof( pxConfigDescriptor ), pdTRUE );
break;
@@ -942,7 +942,7 @@ static void prvGetStandardDeviceDescriptor( xUSB_REQUEST *pxRequest )
/* The index to the string descriptor is the lower byte. */
switch( pxRequest->usValue & 0xff )
{
{
case usbLANGUAGE_STRING:
prvSendControlData( ( unsigned char * ) &pxLanguageStringDescriptor, pxRequest->usLength, sizeof(pxLanguageStringDescriptor), pdTRUE );
break;
@@ -1005,13 +1005,13 @@ unsigned short usStatus = 0;
break;
case usbSET_ADDRESS_REQUEST:
/* Acknowledge the SET_ADDRESS, but (according to the manual) we
cannot actually move to the addressed state until we get a TXCOMP
interrupt from this NULL packet. Therefore we just remember the
address and set our state so we know we have received the address. */
prvUSBTransmitNull();
eDriverState = eJUST_GOT_ADDRESS;
prvUSBTransmitNull();
eDriverState = eJUST_GOT_ADDRESS;
ulReceivedAddress = ( unsigned long ) pxRequest->usValue;
break;
@@ -1020,7 +1020,7 @@ unsigned short usStatus = 0;
/* Acknowledge the SET_CONFIGURATION, but (according to the manual)
we cannot actually move to the configured state until we get a
TXCOMP interrupt from this NULL packet. Therefore we just remember the
config and set our state so we know we have received the go ahead. */
config and set our state so we know we have received the go ahead. */
ucUSBConfig = ( unsigned char ) ( pxRequest->usValue & 0xff );
eDriverState = eJUST_GOT_CONFIG;
prvUSBTransmitNull();
@@ -1048,7 +1048,7 @@ static void prvHandleClassInterfaceRequest( xUSB_REQUEST *pxRequest )
case usbGET_IDLE_REQUEST:
case usbGET_PROTOCOL_REQUEST:
case usbSET_REPORT_REQUEST:
case usbSET_PROTOCOL_REQUEST:
case usbSET_PROTOCOL_REQUEST:
default:
prvSendStall();
@@ -1092,7 +1092,7 @@ unsigned short usStatus = 0;
/* This minimal implementation does not respond to these. */
case usbGET_INTERFACE_REQUEST:
case usbSET_FEATURE_REQUEST:
case usbSET_INTERFACE_REQUEST:
case usbSET_INTERFACE_REQUEST:
default:
prvSendStall();
@@ -1110,7 +1110,7 @@ static void prvHandleStandardEndPointRequest( xUSB_REQUEST *pxRequest )
case usbCLEAR_FEATURE_REQUEST:
case usbSET_FEATURE_REQUEST:
default:
default:
prvSendStall();
break;
}
@@ -1214,7 +1214,7 @@ volatile unsigned long ulNextLength, ulStatus, ulLengthLeftToSend;
if( pxCharsForTx.ulTotalDataLength > pxCharsForTx.ulNextCharIndex )
{
ulLengthLeftToSend = pxCharsForTx.ulTotalDataLength - pxCharsForTx.ulNextCharIndex;
/* We can only send 8 bytes to the fifo at a time. */
if( ulLengthLeftToSend > usbFIFO_LENGTH )
{
@@ -1236,11 +1236,11 @@ volatile unsigned long ulNextLength, ulStatus, ulLengthLeftToSend;
while( ulNextLength > ( unsigned long ) 0 )
{
AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_0 ] = pxCharsForTx.ucTxBuffer[ pxCharsForTx.ulNextCharIndex ];
ulNextLength--;
pxCharsForTx.ulNextCharIndex++;
}
/* Start the transmission. */
portENTER_CRITICAL();
{
+22 -22
View File
@@ -24,9 +24,9 @@
*
*/
/*
/*
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
The processor MUST be in supervisor mode when vTaskStartScheduler is
The processor MUST be in supervisor mode when vTaskStartScheduler is
called. The demo applications included in the FreeRTOS.org download switch
to supervisor mode prior to main being called. If you are not using one of
these demo application projects then ensure Supervisor mode is used.
@@ -36,17 +36,17 @@
* Creates all the demo application tasks, then starts the scheduler. The WEB
* documentation provides more details of the demo application tasks. The SAM7
* includes a sample USB that emulates a Joystick input to a USB host.
*
* Main.c also creates a task called "Check". This only executes every three
* seconds but has the highest priority so is guaranteed to get processor time.
*
* Main.c also creates a task called "Check". This only executes every three
* seconds but has the highest priority so is guaranteed to get processor time.
* Its main function is to check that all the other tasks are still operational.
* Each task (other than the "flash" tasks) maintains a unique count that is
* incremented each time the task successfully completes its function. Should
* any error occur within such a task the count is permanently halted. The
* Each task (other than the "flash" tasks) maintains a unique count that is
* incremented each time the task successfully completes its function. Should
* any error occur within such a task the count is permanently halted. The
* check task inspects the count of each task to ensure it has changed since
* the last time the check task executed. If all the count variables have
* the last time the check task executed. If all the count variables have
* changed all the tasks are still executing error free, and the check task
* toggles the onboard LED. Should any task contain an error at any time
* toggles the onboard LED. Should any task contain an error at any time
* the LED toggle rate will change from 3 seconds to 500ms.
*
*/
@@ -88,7 +88,7 @@
#define mainCOM_TEST_LED ( 4 ) /* Off the board. */
/*
* The task that executes at the highest priority and calls
* The task that executes at the highest priority and calls
* prvCheckOtherTasksAreStillRunning(). See the description at the top
* of the file.
*/
@@ -111,7 +111,7 @@ static long prvCheckOtherTasksAreStillRunning( void );
/*-----------------------------------------------------------*/
/*
* Starts all the other tasks, then starts the scheduler.
* Starts all the other tasks, then starts the scheduler.
*/
void main( void )
{
@@ -130,17 +130,17 @@ void main( void )
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vStartDynamicPriorityTasks();
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
/* Also start the USB demo which is just for the SAM7. */
xTaskCreate( vUSBDemoTask, "USB", configMINIMAL_STACK_SIZE, NULL, mainUSB_PRIORITY, NULL );
/* Start the check task - which is defined in this file. */
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* Start the scheduler.
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
The processor MUST be in supervisor mode when vTaskStartScheduler is
The processor MUST be in supervisor mode when vTaskStartScheduler is
called. The demo applications included in the FreeRTOS.org download switch
to supervisor mode prior to main being called. If you are not using one of
these demo application projects then ensure Supervisor mode is used here. */
@@ -158,14 +158,14 @@ static void prvSetupHardware( void )
the correct default state. This line just ensures that this does not
cause all interrupts to be masked at the start. */
AT91C_BASE_AIC->AIC_EOICR = 0;
/* Most setup is performed by the low level init function called from the
/* Most setup is performed by the low level init function called from the
startup asm file. */
/* Configure the PIO Lines corresponding to LED1 to LED4 to be outputs as
/* Configure the PIO Lines corresponding to LED1 to LED4 to be outputs as
well as the UART Tx line. */
AT91F_PIO_CfgOutput( AT91C_BASE_PIOA, LED_MASK );
/* Enable the peripheral clock. */
AT91F_PMC_EnablePeriphClock( AT91C_BASE_PMC, 1 << AT91C_ID_PIOA );
}
@@ -187,15 +187,15 @@ TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD;
{
/* Delay until it is time to execute again. */
vTaskDelay( xDelayPeriod );
/* Check all the standard demo application tasks are executing without
/* Check all the standard demo application tasks are executing without
error. */
if( prvCheckOtherTasksAreStillRunning() != pdPASS )
{
/* An error has been detected in one of the tasks - flash faster. */
xDelayPeriod = mainERROR_FLASH_PERIOD;
}
vParTestToggleLED( mainCHECK_TASK_LED );
}
}
@@ -24,11 +24,11 @@
*
*/
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
*/
/* Standard includes. */
/* Standard includes. */
#include <stdlib.h>
/* Scheduler includes. */
@@ -58,8 +58,8 @@
/* Queues used to hold received characters, and characters waiting to be
transmitted. */
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
/*-----------------------------------------------------------*/
@@ -83,7 +83,7 @@ extern void ( vUART_ISR )( void );
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
/* If the queues were created correctly then setup the serial port
/* If the queues were created correctly then setup the serial port
hardware. */
if( ( xRxedChars != serINVALID_QUEUE ) && ( xCharsForTx != serINVALID_QUEUE ) )
{
@@ -115,7 +115,7 @@ extern void ( vUART_ISR )( void );
xReturn = ( xComPortHandle ) 0;
}
/* This demo file only supports a single port but we have to return
/* This demo file only supports a single port but we have to return
something to comply with the standard demo header file. */
return xReturn;
}
@@ -214,19 +214,19 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
{
/* Queue empty, nothing to send so turn off the Tx interrupt. */
vInterruptOff();
}
}
}
if( ulStatus & AT91C_US_RXRDY )
{
/* The interrupt was caused by a character being received. Grab the
character from the RHR and place it in the queue or received
character from the RHR and place it in the queue or received
characters. */
cChar = serCOM0->US_RHR;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
}
/* If a task was woken by either a character being received or a character
/* If a task was woken by either a character being received or a character
being transmitted then we may need to switch to another task. */
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
@@ -237,4 +237,4 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
@@ -37,7 +37,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@@ -56,6 +56,9 @@
#define configIDLE_SHOULD_YIELD 1
#define configQUEUE_REGISTRY_SIZE 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
+1 -1
View File
@@ -107,6 +107,6 @@ clean :
@@ -26,7 +26,7 @@
/*
Changes from V2.5.2
+ All LED's are turned off to start.
*/
@@ -69,9 +69,9 @@ unsigned long ulLED = partstFIRST_IO;
}
else
{
GPIO_IOSET = ulLED;
GPIO_IOSET = ulLED;
}
}
}
}
/*-----------------------------------------------------------*/
@@ -93,8 +93,8 @@ unsigned long ulLED = partstFIRST_IO, ulCurrentState;
}
else
{
GPIO_IOSET = ulLED;
GPIO_IOSET = ulLED;
}
}
}
}
+16 -16
View File
@@ -31,7 +31,7 @@
Changes from V2.4.1
+ Split serial.c into serial.c and serialISR.c. serial.c can be
+ Split serial.c into serial.c and serialISR.c. serial.c can be
compiled using ARM or THUMB modes. serialISR.c must always be
compiled in ARM mode.
+ Another small change to cSerialPutChar().
@@ -44,8 +44,8 @@
*/
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
This file contains all the serial port components that can be compiled to
either ARM or THUMB mode. Components that must be compiled to ARM mode are
@@ -89,17 +89,17 @@
/* Queues used to hold received characters, and characters waiting to be
transmitted. */
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
/*-----------------------------------------------------------*/
/* Communication flag between the interrupt service routine and serial API. */
static volatile long *plTHREEmpty;
/*
/*
* The queues are created in serialISR.c as they are used from the ISR.
* Obtain references to the queues and THRE Empty flag.
* Obtain references to the queues and THRE Empty flag.
*/
extern void vSerialISRCreateQueues( unsigned portBASE_TYPE uxQueueLength, QueueHandle_t *pxRxedChars, QueueHandle_t *pxCharsForTx, long volatile **pplTHREEmptyFlag );
@@ -115,10 +115,10 @@ extern void ( vUART_ISR_Wrapper )( void );
serialISR.c (which is always compiled to ARM mode. */
vSerialISRCreateQueues( uxQueueLength, &xRxedChars, &xCharsForTx, &plTHREEmpty );
if(
( xRxedChars != serINVALID_QUEUE ) &&
( xCharsForTx != serINVALID_QUEUE ) &&
( ulWantedBaud != ( unsigned long ) 0 )
if(
( xRxedChars != serINVALID_QUEUE ) &&
( xCharsForTx != serINVALID_QUEUE ) &&
( ulWantedBaud != ( unsigned long ) 0 )
)
{
portENTER_CRITICAL();
@@ -212,21 +212,21 @@ signed portBASE_TYPE xReturn;
/* Is there space to write directly to the UART? */
if( *plTHREEmpty == ( long ) pdTRUE )
{
/* We wrote the character directly to the UART, so was
/* We wrote the character directly to the UART, so was
successful. */
*plTHREEmpty = pdFALSE;
UART0_THR = cOutChar;
xReturn = pdPASS;
}
else
else
{
/* We cannot write directly to the UART, so queue the character.
Block for a maximum of xBlockTime if there is no space in the
queue. */
xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime );
/* Depending on queue sizing and task prioritisation: While we
were blocked waiting to post interrupts were not disabled. It is
/* Depending on queue sizing and task prioritisation: While we
were blocked waiting to post interrupts were not disabled. It is
possible that the serial ISR has emptied the Tx queue, in which
case we need to start the Tx off again. */
if( ( *plTHREEmpty == ( long ) pdTRUE ) && ( xReturn == pdPASS ) )
@@ -254,4 +254,4 @@ void vSerialClose( xComPortHandle xPort )
@@ -25,8 +25,8 @@
*/
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
This file contains all the serial port components that must be compiled
to ARM mode. The components that can be compiled to either ARM or THUMB
@@ -59,15 +59,15 @@
/* Queues used to hold received characters, and characters waiting to be
transmitted. */
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
static volatile long lTHREEmpty;
/*-----------------------------------------------------------*/
/*
/*
* The queues are created in serialISR.c as they are used from the ISR.
* Obtain references to the queues and THRE Empty flag.
* Obtain references to the queues and THRE Empty flag.
*/
void vSerialISRCreateQueues( unsigned portBASE_TYPE uxQueueLength, QueueHandle_t *pxRxedChars, QueueHandle_t *pxCharsForTx, long volatile **pplTHREEmptyFlag );
@@ -78,14 +78,14 @@ void vUART_ISR_Wrapper( void ) __attribute__ ((naked));
void vUART_ISR_Handler( void ) __attribute__ ((noinline));
/*-----------------------------------------------------------*/
void vSerialISRCreateQueues( unsigned portBASE_TYPE uxQueueLength, QueueHandle_t *pxRxedChars,
void vSerialISRCreateQueues( unsigned portBASE_TYPE uxQueueLength, QueueHandle_t *pxRxedChars,
QueueHandle_t *pxCharsForTx, long volatile **pplTHREEmptyFlag )
{
/* Create the queues used to hold Rx and Tx characters. */
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
/* Pass back a reference to the queues so the serial API file can
/* Pass back a reference to the queues so the serial API file can
post/receive characters. */
*pxRxedChars = xRxedChars;
*pxCharsForTx = xCharsForTx;
@@ -130,15 +130,15 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
}
else
{
/* There are no further characters
queued to send so we can indicate
/* There are no further characters
queued to send so we can indicate
that the THRE is available. */
lTHREEmpty = pdTRUE;
}
break;
case serSOURCE_RX_TIMEOUT :
case serSOURCE_RX : /* A character was received. Place it in
case serSOURCE_RX : /* A character was received. Place it in
the queue of received characters. */
cChar = UART0_RBR;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
@@ -162,4 +162,4 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
@@ -57,6 +57,9 @@
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -42,7 +42,7 @@
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
{
/* The ports are setup within prvInitialiseHardware(), called by main(). */
}
/*-----------------------------------------------------------*/
@@ -64,9 +64,9 @@ unsigned long ulLED = partstFIRST_IO;
}
else
{
IO1CLR = ulLED;
IO1CLR = ulLED;
}
}
}
}
/*-----------------------------------------------------------*/
@@ -88,9 +88,9 @@ unsigned long ulLED = partstFIRST_IO, ulCurrentState;
}
else
{
IO1SET = ulLED;
IO1SET = ulLED;
}
}
}
}
+4 -4
View File
@@ -144,7 +144,7 @@ void main( void )
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vStartDynamicPriorityTasks();
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
/* Start the check task - which is defined in this file. */
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
@@ -190,7 +190,7 @@ static void prvSetupHardware( void )
/* Setup the peripheral bus to be the same as the PLL output. */
APBDIV = mainBUS_CLK_FULL;
/* Configure the RS2332 pins. All other pins remain at their default of 0. */
PINSEL0 |= mainTX_ENABLE;
PINSEL0 |= mainRX_ENABLE;
@@ -219,7 +219,7 @@ TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD;
{
/* Delay until it is time to execute again. */
vTaskDelay( xDelayPeriod );
/* Check all the standard demo application tasks are executing without
error. */
if( prvCheckOtherTasksAreStillRunning() != pdPASS )
@@ -227,7 +227,7 @@ TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD;
/* An error has been detected in one of the tasks - flash faster. */
xDelayPeriod = mainERROR_FLASH_PERIOD;
}
vParTestToggleLED( mainCHECK_TASK_LED );
}
}
@@ -36,7 +36,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@@ -56,6 +56,9 @@
#define configQUEUE_REGISTRY_SIZE 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -60,9 +60,9 @@ unsigned long ulLED = partstFIRST_IO;
}
else
{
IOCLR1 = ulLED;
IOCLR1 = ulLED;
}
}
}
}
/*-----------------------------------------------------------*/
@@ -84,8 +84,8 @@ unsigned long ulLED = partstFIRST_IO, ulCurrentState;
}
else
{
IOSET1 = ulLED;
IOSET1 = ulLED;
}
}
}
}
+15 -15
View File
@@ -24,9 +24,9 @@
*
*/
/*
/*
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
The processor MUST be in supervisor mode when vTaskStartScheduler is
The processor MUST be in supervisor mode when vTaskStartScheduler is
called. The demo applications included in the FreeRTOS.org download switch
to supervisor mode prior to main being called. If you are not using one of
these demo application projects then ensure Supervisor mode is used.
@@ -36,17 +36,17 @@
/*
* Creates all the demo application tasks, then starts the scheduler. The WEB
* documentation provides more details of the demo application tasks.
*
* Main.c also creates a task called "Check". This only executes every three
* seconds but has the highest priority so is guaranteed to get processor time.
*
* Main.c also creates a task called "Check". This only executes every three
* seconds but has the highest priority so is guaranteed to get processor time.
* Its main function is to check that all the other tasks are still operational.
* Each task (other than the "flash" tasks) maintains a unique count that is
* incremented each time the task successfully completes its function. Should
* any error occur within such a task the count is permanently halted. The
* Each task (other than the "flash" tasks) maintains a unique count that is
* incremented each time the task successfully completes its function. Should
* any error occur within such a task the count is permanently halted. The
* check task inspects the count of each task to ensure it has changed since
* the last time the check task executed. If all the count variables have
* the last time the check task executed. If all the count variables have
* changed all the tasks are still executing error free, and the check task
* toggles the onboard LED. Should any task contain an error at any time
* toggles the onboard LED. Should any task contain an error at any time
* the LED toggle rate will change from 3 seconds to 500ms.
*
*/
@@ -106,7 +106,7 @@ then an error has been detected in at least one of the demo application tasks. *
static long prvCheckOtherTasksAreStillRunning( void );
/*
* The task that executes at the highest priority and calls
* The task that executes at the highest priority and calls
* prvCheckOtherTasksAreStillRunning(). See the description at the top
* of the file.
*/
@@ -125,7 +125,7 @@ static void prvSetupHardware( void );
/*
* Application entry point:
* Starts all the other tasks, then starts the scheduler.
* Starts all the other tasks, then starts the scheduler.
*/
int main( void )
{
@@ -141,14 +141,14 @@ int main( void )
vStartDynamicPriorityTasks();
/* Start the check task - which is defined in this file. This is the task
that periodically checks to see that all the other tasks are executing
that periodically checks to see that all the other tasks are executing
without error. */
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* Now all the tasks have been started - start the scheduler.
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
The processor MUST be in supervisor mode when vTaskStartScheduler is
The processor MUST be in supervisor mode when vTaskStartScheduler is
called. The demo applications included in the FreeRTOS.org download switch
to supervisor mode prior to main being called. If you are not using one of
these demo application projects then ensure Supervisor mode is used here. */
@@ -176,7 +176,7 @@ TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD;
for( ;; )
{
/* The period of the delay depends on whether an error has been
/* The period of the delay depends on whether an error has been
detected or not. If an error has been detected then the period
is reduced to increase the LED flash rate. */
vTaskDelay( xDelayPeriod );
@@ -25,8 +25,8 @@
*/
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
/*
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
Note this driver is used to test the FreeRTOS port. It is NOT intended to
be an example of an efficient implementation!
@@ -83,8 +83,8 @@
*/
extern void vUART_ISREntry( void );
/*
* The C function called from the asm wrapper.
/*
* The C function called from the asm wrapper.
*/
void vUART_ISRHandler( void );
@@ -92,8 +92,8 @@ void vUART_ISRHandler( void );
/* Queues used to hold received characters, and characters waiting to be
transmitted. */
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
/* Communication flag between the interrupt service routine and serial API. */
static volatile long lTHREEmpty;
@@ -112,10 +112,10 @@ xComPortHandle xReturn = serHANDLE;
/* Initialise the THRE empty flag. */
lTHREEmpty = pdTRUE;
if(
( xRxedChars != serINVALID_QUEUE ) &&
( xCharsForTx != serINVALID_QUEUE ) &&
( ulWantedBaud != ( unsigned long ) 0 )
if(
( xRxedChars != serINVALID_QUEUE ) &&
( xCharsForTx != serINVALID_QUEUE ) &&
( ulWantedBaud != ( unsigned long ) 0 )
)
{
portENTER_CRITICAL()
@@ -209,13 +209,13 @@ signed portBASE_TYPE xReturn;
/* Is there space to write directly to the UART? */
if( lTHREEmpty == ( long ) pdTRUE )
{
/* We wrote the character directly to the UART, so was
/* We wrote the character directly to the UART, so was
successful. */
lTHREEmpty = pdFALSE;
U1THR = cOutChar;
xReturn = pdPASS;
}
else
else
{
/* We cannot write directly to the UART, so queue the character.
Block for a maximum of xBlockTime if there is no space in the
@@ -223,8 +223,8 @@ signed portBASE_TYPE xReturn;
task has it's own critical section management. */
xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime );
/* Depending on queue sizing and task prioritisation: While we
were blocked waiting to post interrupts were not disabled. It is
/* Depending on queue sizing and task prioritisation: While we
were blocked waiting to post interrupts were not disabled. It is
possible that the serial ISR has emptied the Tx queue, in which
case we need to start the Tx off again. */
if( lTHREEmpty == ( long ) pdTRUE )
@@ -258,7 +258,7 @@ unsigned char ucInterrupt;
case serSOURCE_ERROR : /* Not handling this, but clear the interrupt. */
cChar = U1LSR;
break;
case serSOURCE_THRE : /* The THRE is empty. If there is another
character in the Tx queue, send it now. */
if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )
@@ -267,20 +267,20 @@ unsigned char ucInterrupt;
}
else
{
/* There are no further characters
queued to send so we can indicate
/* There are no further characters
queued to send so we can indicate
that the THRE is available. */
lTHREEmpty = pdTRUE;
}
break;
case serSOURCE_RX_TIMEOUT :
case serSOURCE_RX : /* A character was received. Place it in
case serSOURCE_RX : /* A character was received. Place it in
the queue of received characters. */
cChar = U1RBR;
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
break;
default : /* There is nothing to do, leave the ISR. */
break;
}
@@ -302,4 +302,4 @@ unsigned char ucInterrupt;
@@ -69,6 +69,9 @@ the CPU frequency. */
#define configUSE_RECURSIVE_MUTEXES 1
#define configCHECK_FOR_STACK_OVERFLOW 2
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
+1 -1
View File
@@ -29,7 +29,7 @@
#define isrCLEAR_EINT_1 2
/*
* Interrupt routine that simply wakes vButtonHandlerTask on each interrupt
* Interrupt routine that simply wakes vButtonHandlerTask on each interrupt
* generated by a push of the built in button. The wrapper takes care of
* the ISR entry. This then calls the actual handler function to perform
* the work. This work should not be done in the wrapper itself unless
@@ -34,7 +34,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@@ -53,6 +53,9 @@
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -48,10 +48,10 @@
#define partstFIRST_LED_BIT 4
/* This demo application uses files that are common to all port demo
/* This demo application uses files that are common to all port demo
applications. These files assume 6 LED's are available, whereas I have
only 5 (including the LED built onto the development board). To prevent
two tasks trying to use the same LED a bit of remapping is performed.
two tasks trying to use the same LED a bit of remapping is performed.
The ComTest tasks will try and use LED's 6 and 7. LED 6 is ignored and
has no effect, LED 7 is mapped to LED3. The LED usage is described in
the port documentation available from the FreeRTOS.org WEB site. */
@@ -61,7 +61,7 @@ the port documentation available from the FreeRTOS.org WEB site. */
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
{
/* Configure the bits used to flash LED's on port 1 as output. */
GPIO_Config(GPIO1, partstALL_LEDs, GPIO_OUT_OD);
}
+2 -2
View File
@@ -181,7 +181,7 @@ TickType_t xLastWakeTime;
/* Delay until it is time to execute again. The delay period is
shorter following an error so the LED flashes faster. */
vTaskDelayUntil( &xLastWakeTime, xDelayPeriod );
/* Check all the standard demo application tasks are executing without
error. */
if( prvCheckOtherTasksAreStillRunning() != pdPASS )
@@ -189,7 +189,7 @@ TickType_t xLastWakeTime;
/* An error has been detected in one of the tasks - flash faster. */
xDelayPeriod = mainERROR_FLASH_PERIOD;
}
vParTestToggleLED( mainCHECK_TASK_LED );
}
}
@@ -73,7 +73,7 @@ __arm void vSerialISR( void );
xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
{
xComPortHandle xReturn;
/* Create the queues used to hold Rx and Tx characters. */
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
@@ -209,7 +209,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
{
/* Queue empty, nothing to send so turn off the Tx interrupt. */
serINTERRUPT_OFF();
}
}
}
if( usStatus & UART_RxBufFull )
@@ -233,4 +233,4 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
@@ -36,7 +36,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@@ -55,6 +55,9 @@
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -35,7 +35,7 @@
#include "partest.h"
/*-----------------------------------------------------------
* Simple parallel port IO routines for the LED's
* Simple parallel port IO routines for the LED's
*-----------------------------------------------------------*/
#define partstNUM_LEDS 4
@@ -51,14 +51,14 @@ static GPIO_MAP xLEDMap[ partstNUM_LEDS ] =
{
{ ( GPIO_TypeDef * )GPIO1_BASE, GPIO_Pin_1, 0UL },
{ ( GPIO_TypeDef * )GPIO0_BASE, GPIO_Pin_16, 0UL },
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_18, 0UL },
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_19, 0UL }
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_18, 0UL },
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_19, 0UL }
};
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
{
GPIO_InitTypeDef GPIO_InitStructure ;
/* Configure the bits used to flash LED's on port 1 as output. */
@@ -97,7 +97,7 @@ void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
else
{
GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );
xLEDMap[ uxLED ].ulValue = 1;
xLEDMap[ uxLED ].ulValue = 1;
}
}
portEXIT_CRITICAL();
@@ -119,7 +119,7 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
else
{
GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );
xLEDMap[ uxLED ].ulValue = 1;
xLEDMap[ uxLED ].ulValue = 1;
}
}
portEXIT_CRITICAL();
+12 -12
View File
@@ -78,7 +78,7 @@ xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned port
xComPortHandle xReturn;
UART_InitTypeDef UART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
EIC_IRQInitTypeDef EIC_IRQInitStructure;
EIC_IRQInitTypeDef EIC_IRQInitStructure;
/* Create the queues used to hold Rx and Tx characters. */
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
@@ -88,24 +88,24 @@ EIC_IRQInitTypeDef EIC_IRQInitStructure;
hardware. */
if( ( xRxedChars != serINVALID_QUEUE ) && ( xCharsForTx != serINVALID_QUEUE ) )
{
vConfigureQueues( xRxedChars, xCharsForTx, &xQueueEmpty );
portENTER_CRITICAL();
{
/* Enable the UART0 Clock. */
MRCC_PeripheralClockConfig( MRCC_Peripheral_UART0, ENABLE );
/* Configure the UART0_Tx as alternate function */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_Init(GPIO0, &GPIO_InitStructure);
/* Configure the UART0_Rx as input floating */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_Init(GPIO0, &GPIO_InitStructure);
/* Configure UART0. */
UART_InitStructure.UART_WordLength = UART_WordLength_8D;
UART_InitStructure.UART_StopBits = UART_StopBits_1;
@@ -120,12 +120,12 @@ EIC_IRQInitTypeDef EIC_IRQInitStructure;
/* Enable the UART0 */
UART_Cmd(UART0, ENABLE);
/* Configure the IEC for the UART interrupts. */
/* Configure the IEC for the UART interrupts. */
EIC_IRQInitStructure.EIC_IRQChannelCmd = ENABLE;
EIC_IRQInitStructure.EIC_IRQChannel = UART0_IRQChannel;
EIC_IRQInitStructure.EIC_IRQChannelPriority = 1;
EIC_IRQInit(&EIC_IRQInitStructure);
xQueueEmpty = pdTRUE;
UART_ITConfig( UART0, UART_IT_Transmit | UART_IT_Receive, ENABLE );
}
@@ -201,13 +201,13 @@ portBASE_TYPE xReturn;
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
{
xReturn = pdFAIL;
}
}
else
{
xReturn = pdPASS;
xReturn = pdPASS;
}
}
xQueueEmpty = pdFALSE;
}
portEXIT_CRITICAL();
@@ -226,4 +226,4 @@ void vSerialClose( xComPortHandle xPort )
@@ -70,12 +70,12 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
}
else
{
*pxQueueEmpty = pdTRUE;
}
*pxQueueEmpty = pdTRUE;
}
UART_ClearITPendingBit( UART0, UART_IT_Transmit );
}
if( UART0->MIS & UART_IT_Receive )
{
/* The interrupt was caused by a character being received. Grab the
@@ -34,7 +34,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@@ -53,6 +53,9 @@
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -35,7 +35,7 @@
#include "partest.h"
/*-----------------------------------------------------------
* Simple parallel port IO routines for the LED's
* Simple parallel port IO routines for the LED's
*-----------------------------------------------------------*/
#define partstNUM_LEDS 4
@@ -51,14 +51,14 @@ static GPIO_MAP xLEDMap[ partstNUM_LEDS ] =
{
{ ( GPIO_TypeDef * )GPIO1_BASE, GPIO_Pin_1, 0UL },
{ ( GPIO_TypeDef * )GPIO0_BASE, GPIO_Pin_16, 0UL },
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_18, 0UL },
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_19, 0UL }
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_18, 0UL },
{ ( GPIO_TypeDef * )GPIO2_BASE, GPIO_Pin_19, 0UL }
};
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
{
GPIO_InitTypeDef GPIO_InitStructure ;
/* Configure the bits used to flash LED's on port 1 as output. */
@@ -97,7 +97,7 @@ void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
else
{
GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );
xLEDMap[ uxLED ].ulValue = 1;
xLEDMap[ uxLED ].ulValue = 1;
}
}
portEXIT_CRITICAL();
@@ -119,7 +119,7 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
else
{
GPIO_WriteBit( xLEDMap[ uxLED ].pxPort, xLEDMap[ uxLED ].ulPin, Bit_SET );
xLEDMap[ uxLED ].ulValue = 1;
xLEDMap[ uxLED ].ulValue = 1;
}
}
portEXIT_CRITICAL();
+13 -13
View File
@@ -68,7 +68,7 @@ xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned port
xComPortHandle xReturn;
UART_InitTypeDef UART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
EIC_IRQInitTypeDef EIC_IRQInitStructure;
EIC_IRQInitTypeDef EIC_IRQInitStructure;
/* Create the queues used to hold Rx and Tx characters. */
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );
@@ -82,17 +82,17 @@ EIC_IRQInitTypeDef EIC_IRQInitStructure;
{
/* Enable the UART0 Clock. */
MRCC_PeripheralClockConfig( MRCC_Peripheral_UART0, ENABLE );
/* Configure the UART0_Tx as alternate function */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_Init(GPIO0, &GPIO_InitStructure);
/* Configure the UART0_Rx as input floating */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_Init(GPIO0, &GPIO_InitStructure);
/* Configure UART0. */
UART_InitStructure.UART_WordLength = UART_WordLength_8D;
UART_InitStructure.UART_StopBits = UART_StopBits_1;
@@ -107,12 +107,12 @@ EIC_IRQInitTypeDef EIC_IRQInitStructure;
/* Enable the UART0 */
UART_Cmd(UART0, ENABLE);
/* Configure the IEC for the UART interrupts. */
/* Configure the IEC for the UART interrupts. */
EIC_IRQInitStructure.EIC_IRQChannelCmd = ENABLE;
EIC_IRQInitStructure.EIC_IRQChannel = UART0_IRQChannel;
EIC_IRQInitStructure.EIC_IRQChannelPriority = 1;
EIC_IRQInit(&EIC_IRQInitStructure);
xQueueEmpty = pdTRUE;
UART_ITConfig( UART0, UART_IT_Transmit | UART_IT_Receive, ENABLE );
}
@@ -188,13 +188,13 @@ portBASE_TYPE xReturn;
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
{
xReturn = pdFAIL;
}
}
else
{
xReturn = pdPASS;
xReturn = pdPASS;
}
}
xQueueEmpty = pdFALSE;
}
portEXIT_CRITICAL();
@@ -228,12 +228,12 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
}
else
{
xQueueEmpty = pdTRUE;
}
xQueueEmpty = pdTRUE;
}
UART_ClearITPendingBit( UART0, UART_IT_Transmit );
}
if( UART0->MIS & UART_IT_Receive )
{
/* The interrupt was caused by a character being received. Grab the
@@ -254,4 +254,4 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
@@ -52,6 +52,7 @@
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1
#define configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_RECURSIVE_MUTEXES 1
@@ -59,6 +60,7 @@
#define configUSE_COUNTING_SEMAPHORES 1
#define configMAX_PRIORITIES ( 6 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -35,7 +35,7 @@
*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
{
unsigned long ul;
for( ul = 0; ul < partstNUM_LEDS; ul++ )
@@ -88,7 +88,7 @@ xComPortHandle xReturn = serHANDLE;
hardware. */
if( ( xRxedChars != serINVALID_QUEUE ) && ( xCharsForTx != serINVALID_QUEUE ) )
{
PMC_EnablePeripheral( AT91C_ID_US0 );
PMC_EnablePeripheral( AT91C_ID_US0 );
portENTER_CRITICAL();
{
USART_Configure( serCOM0, ( AT91C_US_CHRL_8_BITS | AT91C_US_PAR_NONE ), ulWantedBaud, configCPU_CLOCK_HZ );
@@ -164,7 +164,7 @@ signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar
{
/* Just to remove compiler warning. */
( void ) pxPort;
/* Place the character in the queue of characters to be transmitted. */
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
{
@@ -215,7 +215,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
{
/* Queue empty, nothing to send so turn off the Tx interrupt. */
vInterruptOff();
}
}
}
if( ulStatus & AT91C_US_RXRDY )
@@ -238,4 +238,4 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
+4 -1
View File
@@ -53,7 +53,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@@ -73,6 +73,9 @@
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 0 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -38,7 +38,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@@ -56,6 +56,10 @@
#define configUSE_16_BIT_TICKS 1
#define configIDLE_SHOULD_YIELD 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -24,7 +24,7 @@
*
*/
/*
/*
Changes from V2.0.0
+ Use scheduler suspends in place of critical sections.
@@ -110,7 +110,7 @@ unsigned char ucBit;
PORTB = ucCurrentOutputValue;
}
xTaskResumeAll();
xTaskResumeAll();
}
}
+23 -10
View File
@@ -45,7 +45,7 @@
/*
Changes from V1.2.0
+ Changed the baud rate for the serial test from 19200 to 57600.
Changes from V1.2.3
@@ -71,6 +71,10 @@ Changes from V2.2.0
Changes from V2.6.1
+ The IAR and WinAVR AVR ports are now maintained separately.
Changes from V4.0.5
+ Modified to demonstrate the use of co-routines.
*/
#include <stdlib.h>
@@ -84,12 +88,14 @@ Changes from V2.6.1
/* Scheduler include files. */
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
/* Demo file headers. */
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "crflash.h"
#include "print.h"
#include "partest.h"
#include "regtest.h"
@@ -121,6 +127,9 @@ again. */
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( ( void * ) 0x50 )
/* The number of coroutines to create. */
#define mainNUM_FLASH_COROUTINES ( 3 )
/*
* The task function for the "Check" task.
*/
@@ -139,9 +148,9 @@ static void prvCheckOtherTasksAreStillRunning( void );
static void prvIncrementResetCount( void );
/*
* Idle hook (empty)
* Idle hook is used to scheduler co-routines.
*/
void vApplicationIdleHook( void );
void vApplicationIdleHook( void );
short main( void )
{
@@ -155,10 +164,13 @@ short main( void )
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartRegTestTasks();
/* Create the tasks defined within this file. */
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* Create the co-routines that flash the LED's. */
vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES );
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
as 1 in portmacro.h. To use the cooperative scheduler define
configUSE_PREEMPTION as 0. */
@@ -185,7 +197,7 @@ static volatile unsigned long ulDummyVariable = 3UL;
integer tasks get some exercise. The result here is not important -
see the demo application documentation for more info. */
ulDummyVariable *= 3;
prvCheckOtherTasksAreStillRunning();
}
}
@@ -214,7 +226,7 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE;
{
xErrorHasOccurred = pdTRUE;
}
if( xErrorHasOccurred == pdFALSE )
{
/* Toggle the LED if everything is okay so we know if an error occurs even if not
@@ -232,20 +244,20 @@ const unsigned char ucWrite1 = ( unsigned char ) 0x04;
const unsigned char ucWrite2 = ( unsigned char ) 0x02;
/* Increment the EEPROM value at 0x00.
Setup the EEPROM address. */
EEARH = 0x00;
EEARL = 0x00;
/* Set the read enable bit. */
EECR |= ucReadBit;
/* Wait for the read. */
while( EECR & ucReadBit );
/* The byte is ready. */
ucCount = EEDR;
/* Increment the reset count, then write the byte back. */
ucCount++;
EEDR = ucCount;
@@ -256,5 +268,6 @@ const unsigned char ucWrite2 = ( unsigned char ) 0x02;
void vApplicationIdleHook( void )
{
vCoRoutineSchedule();
}
+4 -4
View File
@@ -46,7 +46,7 @@ portBASE_TYPE xRegTestError = pdFALSE;
void vStartRegTestTasks( void )
{
xTaskCreate( prvRegisterCheck1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegisterCheck2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegisterCheck2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
}
/*-----------------------------------------------------------*/
@@ -64,7 +64,7 @@ portBASE_TYPE xReturn;
{
xReturn = pdFALSE;
}
return xReturn;
}
/*-----------------------------------------------------------*/
@@ -75,7 +75,7 @@ static void prvRegisterCheck1( void *pvParameters )
for( ;; )
{
asm( "LDI r31, 5" );
asm( "LDI r31, 5" );
asm( "MOV r0, r31" );
asm( "LDI r31, 6" );
asm( "MOV r1, r31" );
@@ -218,7 +218,7 @@ static void prvRegisterCheck2( void *pvParameters )
for( ;; )
{
asm( "LDI r31, 1" );
asm( "LDI r31, 1" );
asm( "MOV r0, r31" );
asm( "LDI r31, 2" );
asm( "MOV r1, r31" );
@@ -971,6 +971,9 @@
<file>
<name>$PROJ_DIR$\..\Common\Minimal\comtest.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\crflash.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_1.c</name>
</file>
@@ -995,6 +998,9 @@
</group>
<group>
<name>Kernel Source</name>
<file>
<name>$PROJ_DIR$\..\..\Source\croutine.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\list.c</name>
</file>
@@ -1012,3 +1018,5 @@
</file>
</group>
</project>
@@ -56,7 +56,7 @@ static QueueHandle_t xCharsForTx;
ucByte = UCSRB; \
ucByte |= serTX_INT_ENABLE; \
outb( UCSRB, ucByte ); \
}
}
/*-----------------------------------------------------------*/
#define vInterruptOff() \
@@ -84,12 +84,12 @@ unsigned char ucByte;
data sheet. */
ulBaudRateCounter = ( configCPU_CLOCK_HZ / ( serBAUD_DIV_CONSTANT * ulWantedBaud ) ) - ( unsigned long ) 1;
/* Set the baud rate. */
ucByte = ( unsigned char ) ( ulBaudRateCounter & ( unsigned long ) 0xff );
/* Set the baud rate. */
ucByte = ( unsigned char ) ( ulBaudRateCounter & ( unsigned long ) 0xff );
outb( UBRRL, ucByte );
ulBaudRateCounter >>= ( unsigned long ) 8;
ucByte = ( unsigned char ) ( ulBaudRateCounter & ( unsigned long ) 0xff );
ucByte = ( unsigned char ) ( ulBaudRateCounter & ( unsigned long ) 0xff );
outb( UBRRH, ucByte );
/* Enable the Rx interrupt. The Tx interrupt will get enabled
@@ -100,7 +100,7 @@ unsigned char ucByte;
outb( UCSRC, serUCSRC_SELECT | serEIGHT_DATA_BITS );
}
portEXIT_CRITICAL();
/* Unlike other ports, this serial code does not allow for more than one
com port. We therefore don't return a pointer to a port structure and can
instead just return NULL. */
@@ -36,7 +36,7 @@
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
@@ -55,6 +55,10 @@
#define configIDLE_SHOULD_YIELD 1
#define configQUEUE_REGISTRY_SIZE 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
@@ -24,7 +24,7 @@
*
*/
/*
/*
Changes from V2.0.0
+ Use scheduler suspends in place of critical sections.
@@ -39,7 +39,6 @@ Changes from V2.6.0
#include "FreeRTOS.h"
#include "task.h"
#include "partest.h"
#include <avr/io.h>
/*-----------------------------------------------------------
* Simple parallel port IO routines.
@@ -69,7 +68,7 @@ unsigned char ucBit = ( unsigned char ) 1;
if( uxLED <= partstMAX_OUTPUT_LED )
{
ucBit <<= uxLED;
ucBit <<= uxLED;
vTaskSuspendAll();
{
@@ -111,7 +110,7 @@ unsigned char ucBit;
PORTB = ucCurrentOutputValue;
}
xTaskResumeAll();
xTaskResumeAll();
}
}
+14 -1
View File
@@ -68,6 +68,10 @@ Changes from V2.6.1
+ The IAR and WinAVR AVR ports are now maintained separately.
Changes from V4.0.5
+ Modified to demonstrate the use of co-routines.
*/
#include <stdlib.h>
@@ -81,12 +85,14 @@ Changes from V2.6.1
/* Scheduler include files. */
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
/* Demo file headers. */
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "crflash.h"
#include "print.h"
#include "partest.h"
#include "regtest.h"
@@ -118,6 +124,9 @@ again. */
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( ( void * ) 0x50 )
/* The number of coroutines to create. */
#define mainNUM_FLASH_COROUTINES ( 3 )
/*
* The task function for the "Check" task.
*/
@@ -136,7 +145,7 @@ static void prvCheckOtherTasksAreStillRunning( void );
static void prvIncrementResetCount( void );
/*
* The idle hook is unused.
* The idle hook is used to scheduler co-routines.
*/
void vApplicationIdleHook( void );
@@ -158,6 +167,9 @@ short main( void )
/* Create the tasks defined within this file. */
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* Create the co-routines that flash the LED's. */
vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES );
/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
as 1 in portmacro.h. To use the cooperative scheduler define
configUSE_PREEMPTION as 0. */
@@ -235,5 +247,6 @@ unsigned char ucCount;
void vApplicationIdleHook( void )
{
vCoRoutineSchedule();
}
+27 -25
View File
@@ -1,4 +1,4 @@
# WinAVR Sample makefile written by Eric B. Weddington, J�rg Wunsch, et al.
# WinAVR Sample makefile written by Eric B. Weddington, Jörg Wunsch, et al.
# Released to the Public Domain
# Please read the make user manual!
#
@@ -57,8 +57,10 @@ regtest.c \
$(SOURCE_DIR)/tasks.c \
$(SOURCE_DIR)/queue.c \
$(SOURCE_DIR)/list.c \
$(SOURCE_DIR)/croutine.c \
$(SOURCE_DIR)/portable/MemMang/heap_1.c \
$(PORT_DIR)/port.c \
$(DEMO_DIR)/crflash.c \
$(DEMO_DIR)/integer.c \
$(DEMO_DIR)/PollQ.c \
$(DEMO_DIR)/comtest.c
@@ -81,12 +83,12 @@ $(DEMO_DIR)/comtest.c
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
ASRC =
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
EXTRAINCDIRS =
EXTRAINCDIRS =
# Optional compiler flags.
@@ -126,7 +128,7 @@ CFLAGS += -std=gnu99
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
@@ -154,7 +156,7 @@ LDFLAGS += -lm
# Programming support using avrdude. Settings and variables.
# Programming hardware: alf avr910 avrisp bascom bsd
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
@@ -181,7 +183,7 @@ AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
#AVRDUDE_FLAGS += -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_FLAGS += -v -v
@@ -225,7 +227,7 @@ ELFSIZE = $(SIZE) -A $(TARGET).elf
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -242,7 +244,7 @@ MSG_CLEANING = Cleaning project:
# Define all object files.
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
# Define all listing files.
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
@@ -284,7 +286,7 @@ sizeafter:
# Display compiler version information.
gccversion :
gccversion :
@$(CC) --version
@@ -296,7 +298,7 @@ COFFCONVERT=$(OBJCOPY) --debugging \
--change-section-address .data-0x800000 \
--change-section-address .bss-0x800000 \
--change-section-address .noinit-0x800000 \
--change-section-address .eeprom-0x810000
--change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@@ -313,7 +315,7 @@ extcoff: $(TARGET).elf
# Program the device.
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -322,26 +324,26 @@ program: $(TARGET).hex $(TARGET).eep
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
avr-nm -n $< > $@
@@ -382,8 +384,8 @@ program: $(TARGET).hex $(TARGET).eep
clean: begin clean_list finished end
clean_list :
@echo
@echo $(MSG_CLEANING)
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).obj
@@ -401,8 +403,8 @@ clean_list :
$(REMOVE) $(SRC:.c=.d)
# Automatically generate C source code dependencies.
# (Code originally taken from the GNU make user manual and modified
# Automatically generate C source code dependencies.
# (Code originally taken from the GNU make user manual and modified
# (See README.txt Credits).)
#
# Note that this will work with sh (bash) and sed that is shipped with WinAVR
@@ -27,7 +27,7 @@
/*
Changes from V1.2.3
+ The function xPortInitMinimal() has been renamed to
+ The function xPortInitMinimal() has been renamed to
xSerialPortInitMinimal() and the function xPortInit() has been renamed
to xSerialPortInit().
@@ -66,8 +66,8 @@ Changes from V2.6.0
#define serUCSRC_SELECT ( ( unsigned char ) 0x80 )
#define serEIGHT_DATA_BITS ( ( unsigned char ) 0x06 )
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
static QueueHandle_t xRxedChars;
static QueueHandle_t xCharsForTx;
#define vInterruptOn() \
{ \
@@ -76,7 +76,7 @@ static QueueHandle_t xCharsForTx;
ucByte = UCSRB; \
ucByte |= serTX_INT_ENABLE; \
UCSRB = ucByte; \
}
}
/*-----------------------------------------------------------*/
#define vInterruptOff() \
@@ -104,12 +104,12 @@ unsigned char ucByte;
data sheet. */
ulBaudRateCounter = ( configCPU_CLOCK_HZ / ( serBAUD_DIV_CONSTANT * ulWantedBaud ) ) - ( unsigned long ) 1;
/* Set the baud rate. */
ucByte = ( unsigned char ) ( ulBaudRateCounter & ( unsigned long ) 0xff );
/* Set the baud rate. */
ucByte = ( unsigned char ) ( ulBaudRateCounter & ( unsigned long ) 0xff );
UBRRL = ucByte;
ulBaudRateCounter >>= ( unsigned long ) 8;
ucByte = ( unsigned char ) ( ulBaudRateCounter & ( unsigned long ) 0xff );
ucByte = ( unsigned char ) ( ulBaudRateCounter & ( unsigned long ) 0xff );
UBRRH = ucByte;
/* Enable the Rx interrupt. The Tx interrupt will get enabled
@@ -120,7 +120,7 @@ unsigned char ucByte;
UCSRC = ( serUCSRC_SELECT | serEIGHT_DATA_BITS );
}
portEXIT_CRITICAL();
/* Unlike other ports, this serial code does not allow for more than one
com port. We therefore don't return a pointer to a port structure and can
instead just return NULL. */

Some files were not shown because too many files have changed in this diff Show More