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
parent 9ccae851e7
commit 1277ba1661
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
605 changed files with 11240 additions and 3628 deletions

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())

View file

@ -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. */

View file

@ -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;

View file

@ -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;

View file

@ -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)

View file

@ -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. */

View file

@ -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 ] );
}
}
}

View file

@ -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();
{

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 );
}
}

View file

@ -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;

View file

@ -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. */

View file

@ -107,6 +107,6 @@ clean :

View file

@ -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;
}
}
}
}

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 )

View file

@ -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;

View file

@ -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. */

View file

@ -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;
}
}
}
}

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 );
}
}

View file

@ -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. */

View file

@ -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;
}
}
}
}

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 );

View file

@ -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;

View file

@ -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. */

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

View file

@ -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. */

View file

@ -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);
}

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 );
}
}

View file

@ -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;

View file

@ -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. */

View file

@ -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();

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 )

View file

@ -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

View file

@ -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. */

View file

@ -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();

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;

View file

@ -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. */

View file

@ -35,7 +35,7 @@
*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
{
unsigned long ul;
for( ul = 0; ul < partstNUM_LEDS; ul++ )

View file

@ -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;

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. */

View file

@ -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. */

View file

@ -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();
}
}

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();
}

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" );

View file

@ -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>

View file

@ -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. */

View file

@ -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. */

View file

@ -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();
}
}

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();
}

View file

@ -1,4 +1,4 @@
# WinAVR Sample makefile written by Eric B. Weddington, J<EFBFBD>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

View file

@ -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. */

View file

@ -39,18 +39,18 @@
/*
* Timer instance | Value
* ----------------|---------
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* RTC | 4
* RTC | 4
*/
#define configUSE_TIMER_INSTANCE 0
#define configUSE_PREEMPTION 1
/* NOTE: You can choose the following clock frequencies (Hz):
20000000, 10000000, 5000000, 2000000.
20000000, 10000000, 5000000, 2000000.
For other frequency values, update clock_config.h with your own settings. */
#define configCPU_CLOCK_HZ 10000000
@ -89,6 +89,10 @@ For other frequency values, update clock_config.h with your own settings. */
#define configUSE_TRACE_FACILITY 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )

View file

@ -155,6 +155,10 @@
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="..\..\..\Source\croutine.c">
<SubType>compile</SubType>
<Link>Source\croutine.c</Link>
</Compile>
<Compile Include="..\..\..\Source\event_groups.c">
<SubType>compile</SubType>
<Link>Source\event_groups.c</Link>
@ -199,6 +203,10 @@
<SubType>compile</SubType>
<Link>Source\include\atomic.h</Link>
</Compile>
<Compile Include="..\..\..\Source\include\croutine.h">
<SubType>compile</SubType>
<Link>Source\include\croutine.h</Link>
</Compile>
<Compile Include="..\..\..\Source\include\deprecated_definitions.h">
<SubType>compile</SubType>
<Link>Source\include\deprecated_definitions.h</Link>
@ -304,6 +312,14 @@
<SubType>compile</SubType>
<Link>Common\Minimal\PollQ.c</Link>
</Compile>
<Compile Include="..\..\..\Demo\Common\include\crflash.h">
<SubType>compile</SubType>
<Link>Common\include\crflash.h</Link>
</Compile>
<Compile Include="..\..\..\Demo\Common\Minimal\crflash.c">
<SubType>compile</SubType>
<Link>Common\Minimal\crflash.c</Link>
</Compile>
<Compile Include="..\..\..\Demo\Common\include\recmutex.h">
<SubType>compile</SubType>
<Link>Common\include\recmutex.h</Link>

View file

@ -88,7 +88,7 @@ void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this

View file

@ -28,10 +28,12 @@
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "crflash.h"
#include "partest.h"
#include "regtest.h"
@ -61,6 +63,9 @@ again. */
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( 0x1400 )
/* The number of coroutines to create. */
#define mainNUM_FLASH_COROUTINES ( 3 )
/*
* The task function for the "Check" task.
*/
@ -87,10 +92,13 @@ void main_minimal( 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. */
@ -102,7 +110,7 @@ void init_minimal( void )
/* Configure UART pins: PB0 Rx, PB1 Tx */
PORTB.DIR &= ~PIN1_bm;
PORTB.DIR |= PIN0_bm;
vParTestInitialise();
}
@ -123,7 +131,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();
}
}
@ -152,7 +160,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
@ -174,4 +182,5 @@ unsigned char ucResetCount;
void vApplicationIdleHook( void )
{
vCoRoutineSchedule();
}

View file

@ -62,7 +62,7 @@ portBASE_TYPE xReturn;
{
xReturn = pdFALSE;
}
return xReturn;
}
/*-----------------------------------------------------------*/

View file

@ -39,23 +39,23 @@
/*
* Timer instance | Value
* ----------------|---------
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* RTC | 4
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* RTC | 4
*/
#define configUSE_TIMER_INSTANCE 0
#define configCALL_STACK_SIZE 30
#define configUSE_PREEMPTION 1
/* NOTE: You can choose the following clock frequencies (Hz):
20000000, 10000000, 5000000, 2000000.
20000000, 10000000, 5000000, 2000000.
For other frequency values, update clock_config.h with your own settings. */
#define configCPU_CLOCK_HZ 10000000
#define configTICK_RATE_HZ 1000
#define configMAX_PRIORITIES 4
#define configMINIMAL_STACK_SIZE 110
@ -91,6 +91,10 @@ For other frequency values, update clock_config.h with your own settings. */
#define configUSE_TRACE_FACILITY 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )

View file

@ -2121,6 +2121,9 @@
<file>
<name>$PROJ_DIR$\..\Common\include\comtest.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\include\crflash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\include\integer.h</name>
</file>
@ -2145,6 +2148,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$\..\Common\Minimal\integer.c</name>
</file>
@ -2193,6 +2199,9 @@
<file>
<name>$PROJ_DIR$\..\..\Source\include\atomic.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\croutine.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\deprecated_definitions.h</name>
</file>
@ -2269,6 +2278,9 @@
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\..\Source\croutine.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\event_groups.c</name>
</file>

View file

@ -2169,6 +2169,9 @@
<file>
<name>$PROJ_DIR$\..\Common\include\comtest.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\include\crflash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\include\integer.h</name>
</file>
@ -2193,6 +2196,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$\..\Common\Minimal\integer.c</name>
</file>
@ -2241,6 +2247,9 @@
<file>
<name>$PROJ_DIR$\..\..\Source\include\atomic.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\croutine.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\deprecated_definitions.h</name>
</file>
@ -2317,6 +2326,9 @@
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\..\Source\croutine.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\event_groups.c</name>
</file>

View file

@ -88,7 +88,7 @@ void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this
@ -114,7 +114,7 @@ void main_blinky( void )
more details on the FreeRTOS heap http://www.freertos.org/a00111.html. The
mode from which main() is called is set in the C start up code and must be
a privileged mode (not user mode). */
for( ;; );
for( ;; );
}
void init_blinky( void )

View file

@ -26,11 +26,13 @@
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "crflash.h"
#include "partest.h"
#include "regtest.h"
@ -60,6 +62,9 @@ again. */
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( 0x1400 )
/* The number of coroutines to create. */
#define mainNUM_FLASH_COROUTINES ( 3 )
/*
* The task function for the "Check" task.
*/
@ -86,10 +91,13 @@ void main_minimal( 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. */
@ -101,7 +109,7 @@ void init_minimal( void )
/* Configure UART pins: PB0 Rx, PB1 Tx */
PORTB.DIR &= ~PIN1_bm;
PORTB.DIR |= PIN0_bm;
vParTestInitialise();
}
@ -122,7 +130,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();
}
}
@ -151,7 +159,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
@ -171,4 +179,5 @@ static unsigned char __eeprom ucResetCount @ mainRESET_COUNT_ADDRESS;
void vApplicationIdleHook( void )
{
}
vCoRoutineSchedule();
}

View file

@ -62,7 +62,7 @@ portBASE_TYPE xReturn;
{
xReturn = pdFALSE;
}
return xReturn;
}
/*-----------------------------------------------------------*/

View file

@ -39,18 +39,18 @@
/*
* Timer instance | Value
* ----------------|---------
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* RTC | 4
* RTC | 4
*/
#define configUSE_TIMER_INSTANCE 0
#define configUSE_PREEMPTION 1
/* NOTE: You can choose the following clock frequencies (Hz):
20000000, 10000000, 5000000, 2000000.
20000000, 10000000, 5000000, 2000000.
For other frequency values, update clock_config.h with your own settings. */
#define configCPU_CLOCK_HZ 10000000
@ -89,6 +89,10 @@ For other frequency values, update clock_config.h with your own settings. */
#define configUSE_TRACE_FACILITY 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )

View file

@ -88,7 +88,7 @@ void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this

View file

@ -28,10 +28,12 @@
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "crflash.h"
#include "partest.h"
#include "regtest.h"
@ -61,6 +63,9 @@ again. */
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( 0x1400 )
/* The number of coroutines to create. */
#define mainNUM_FLASH_COROUTINES ( 3 )
/*
* The task function for the "Check" task.
*/
@ -87,10 +92,13 @@ void main_minimal( 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. */
@ -102,7 +110,7 @@ void init_minimal( void )
/* Configure UART pins: PB0 Rx, PB1 Tx */
PORTB.DIR &= ~PIN1_bm;
PORTB.DIR |= PIN0_bm;
vParTestInitialise();
}
@ -123,7 +131,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();
}
}
@ -152,7 +160,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
@ -174,4 +182,5 @@ unsigned char ucResetCount;
void vApplicationIdleHook( void )
{
vCoRoutineSchedule();
}

View file

@ -30,6 +30,8 @@
<itemPath>../Common/include/comtest2.h</itemPath>
<itemPath>../Common/include/comtest_strings.h</itemPath>
<itemPath>../Common/include/countsem.h</itemPath>
<itemPath>../Common/include/crflash.h</itemPath>
<itemPath>../Common/include/crhook.h</itemPath>
<itemPath>../Common/include/death.h</itemPath>
<itemPath>../Common/include/dynamic.h</itemPath>
<itemPath>../Common/include/fileIO.h</itemPath>
@ -48,6 +50,7 @@
<itemPath>../Common/Minimal/PollQ.c</itemPath>
<itemPath>../Common/Minimal/TaskNotify.c</itemPath>
<itemPath>../Common/Minimal/comtest.c</itemPath>
<itemPath>../Common/Minimal/crflash.c</itemPath>
<itemPath>../Common/Minimal/integer.c</itemPath>
<itemPath>../Common/Minimal/recmutex.c</itemPath>
</logicalFolder>
@ -57,6 +60,7 @@
<itemPath>../../Source/include/FreeRTOS.h</itemPath>
<itemPath>../../Source/include/StackMacros.h</itemPath>
<itemPath>../../Source/include/atomic.h</itemPath>
<itemPath>../../Source/include/croutine.h</itemPath>
<itemPath>../../Source/include/deprecated_definitions.h</itemPath>
<itemPath>../../Source/include/event_groups.h</itemPath>
<itemPath>../../Source/include/list.h</itemPath>
@ -85,6 +89,7 @@
<itemPath>../../Source/portable/MemMang/heap_1.c</itemPath>
</logicalFolder>
</logicalFolder>
<itemPath>../../Source/croutine.c</itemPath>
<itemPath>../../Source/event_groups.c</itemPath>
<itemPath>../../Source/list.c</itemPath>
<itemPath>../../Source/queue.c</itemPath>

View file

@ -63,7 +63,7 @@ portBASE_TYPE xReturn;
{
xReturn = pdFALSE;
}
return xReturn;
}
/*-----------------------------------------------------------*/

View file

@ -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
*----------------------------------------------------------*/
@ -63,7 +63,7 @@
/* FreeRTOS software timer. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY 2
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
/* FreeRTOS memory allocation scheme. */

View file

@ -28,8 +28,8 @@
#include "task.h"
#include "partest.h"
/*
* ATmega328PB Xplained Mini board has a user LED at PB5.
/*
* ATmega328PB Xplained Mini board has a user LED at PB5.
* Everything below is specific for this setup only.
* LED is lit when PB5 is set to a high.
*/
@ -55,11 +55,11 @@ void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue )
{
/* There's only one LED on this board. */
( void ) uxLED;
/* Turn on user LED.
/* Turn on user LED.
The compound action is guaranteed to be not interrupted by other tasks. */
vTaskSuspendAll();
if ( xValue == 0 )
{
/* Turn off, only when input value is zero. */
@ -74,7 +74,7 @@ void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue )
PORTB |= partestLED_PORTB_DIR_REG_BIT;
uCurrentLedOutputVal = partestLED_ON;
}
xTaskResumeAll();
}
@ -84,11 +84,11 @@ void vParTestToggleLED( UBaseType_t uxLED )
{
/* There's only one LED on this board. */
( void ) uxLED;
/* Toggle user LED.
/* Toggle user LED.
The compound action is guaranteed to be not interrupted by other tasks. */
vTaskSuspendAll();
if ( uCurrentLedOutputVal == partestLED_ON )
{
/* Turn off. */
@ -103,7 +103,7 @@ void vParTestToggleLED( UBaseType_t uxLED )
PORTB |= partestLED_PORTB_DIR_REG_BIT;
uCurrentLedOutputVal = partestLED_ON;
}
xTaskResumeAll();
}

View file

@ -204,6 +204,10 @@
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\Source\croutine.c">
<SubType>compile</SubType>
<Link>FreeRTOS\croutine.c</Link>
</Compile>
<Compile Include="..\..\..\Source\event_groups.c">
<SubType>compile</SubType>
<Link>FreeRTOS\event_groups.c</Link>
@ -212,6 +216,10 @@
<SubType>compile</SubType>
<Link>FreeRTOS\include\atomic.h</Link>
</Compile>
<Compile Include="..\..\..\Source\include\croutine.h">
<SubType>compile</SubType>
<Link>FreeRTOS\include\croutine.h</Link>
</Compile>
<Compile Include="..\..\..\Source\include\deprecated_definitions.h">
<SubType>compile</SubType>
<Link>FreeRTOS\include\deprecated_definitions.h</Link>

View file

@ -31,13 +31,13 @@
/* Demo file headers. */
#include "regtest.h"
/* The minimum stack size required by a register test task.
*
* The value should be at least the sum of:
* - Number of bytes used to save register context.
/* The minimum stack size required by a register test task.
*
* The value should be at least the sum of:
* - Number of bytes used to save register context.
* Refer to port.c, r0-r31 and/or RAMPZ and/or EIND.
* - Number of bytes used in nested function call.
* Refer to GCC Developer Option -fstack-usage.
* Refer to GCC Developer Option -fstack-usage.
*/
#define REGTEST_MIN_STACK_SIZE ( ( unsigned short ) 50 )
@ -48,8 +48,8 @@
static void prvRegisterCheck1( void *pvParameters );
static void prvRegisterCheck2( void *pvParameters );
/* Set to a none zero value should an error be found.
* Using two variables to identify offending task and register combination.
/* Set to a none zero value should an error be found.
* Using two variables to identify offending task and register combination.
*/
UBaseType_t uxRegTestError1 = 0;
UBaseType_t uxRegTestError2 = 0;
@ -63,7 +63,7 @@ void vStartRegTestTasks( void )
* context is not restored correctly, error is more likely to be caught.
*/
xTaskCreate( prvRegisterCheck1, "Reg1", REGTEST_MIN_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegisterCheck2, "Reg2", REGTEST_MIN_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegisterCheck2, "Reg2", REGTEST_MIN_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
}
/*-----------------------------------------------------------*/
@ -72,14 +72,14 @@ BaseType_t xAreRegTestTasksStillRunning( void )
BaseType_t xReturn;
/* If a register was found to contain an unexpected value then the
* uxRegTestError variable would have been set to a none zero value.
* uxRegTestError variable would have been set to a none zero value.
*
* This check guarantees no false positive, but does not guarantee test
* has actually run. Could have a counter to track how many times the loop
* has been entered and ensure that the number is monotonically incrementing.
* And then it'll subject to integer overflow issue. To make things simple
* straight forward, set a breakpoint at the end of the loop in prvRegisterCheck1()
* and prvRegisterCheck2(). Make sure both can be hit.
* has been entered and ensure that the number is monotonically incrementing.
* And then it'll subject to integer overflow issue. To make things simple
* straight forward, set a breakpoint at the end of the loop in prvRegisterCheck1()
* and prvRegisterCheck2(). Make sure both can be hit.
*/
if( uxRegTestError1 == 0 && uxRegTestError2 == 0 )
{
@ -89,7 +89,7 @@ BaseType_t xReturn;
{
xReturn = pdFALSE;
}
return xReturn;
}
/*-----------------------------------------------------------*/
@ -100,13 +100,13 @@ static void prvRegisterCheck1( void *pvParameters )
for( ;; )
{
/* Load register r0-r30 with known value.
* r31 is used to first load immediate value then copy into r0-15.
/* Load register r0-r30 with known value.
* r31 is used to first load immediate value then copy into r0-15.
*
* LDI Rd,K
* Rd<--K (16 <= d <= 31, 0 <= K <= 255)
*/
asm( "LDI r31, 0x80" );
asm( "LDI r31, 0x80" );
asm( "MOV r0, r31" );
asm( "LDI r31, 0x81" );
asm( "MOV r1, r31" );
@ -155,7 +155,7 @@ static void prvRegisterCheck1( void *pvParameters )
asm( "LDI r30, 0x9E" );
/* Check whether register r0-30 still contain known good values.
* If not, update uxRegTestError1 with the unique value.
* If not, update uxRegTestError1 with the unique value.
*/
asm( "LDI r31, 0x80" );
asm( "CPSE r31, r0" );
@ -250,7 +250,7 @@ static void prvRegisterCheck1( void *pvParameters )
asm( "LDI r31, 0x9E" );
asm( "CPSE r31, r30" );
asm( "STS uxRegTestError1, r30" );
/* Give other tasks of the same priority a chance to run. */
taskYIELD();
}
@ -263,13 +263,13 @@ static void prvRegisterCheck2( void *pvParameters )
for( ;; )
{
/* Load register r0-r30 with known value.
* r31 is used to first load immediate value then copy into r0-15.
/* Load register r0-r30 with known value.
* r31 is used to first load immediate value then copy into r0-15.
*
* LDI Rd,K
* Rd<--K (16 <= d <= 31, 0 <= K <= 255)
*/
asm( "LDI r31, 0" );
asm( "LDI r31, 0" );
asm( "MOV r0, r31" );
asm( "LDI r31, 1" );
asm( "MOV r1, r31" );
@ -316,9 +316,9 @@ static void prvRegisterCheck2( void *pvParameters )
asm( "LDI r28, 28" );
asm( "LDI r29, 29" );
asm( "LDI r30, 30" );
/* Check whether register r0-30 still contain known good values.
* If not, update uxRegTestError2 with the unique value.
* If not, update uxRegTestError2 with the unique value.
*/
asm( "LDI r31, 0" );
asm( "CPSE r31, r0" );
@ -413,7 +413,7 @@ static void prvRegisterCheck2( void *pvParameters )
asm( "LDI r31, 30" );
asm( "CPSE r31, r30" );
asm( "STS uxRegTestError2, r30" );
/* Give other tasks of the same priority a chance to run. */
taskYIELD();
}

View file

@ -39,12 +39,12 @@
/*
* Timer instance | Value
* ----------------|---------
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* TCB4 | 4
* RTC | 5
* RTC | 5
*/
#define configUSE_TIMER_INSTANCE 0
@ -91,6 +91,10 @@ For other frequency values, update clock_config.h with your own settings */
#define configUSE_TRACE_FACILITY 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )

View file

@ -152,6 +152,10 @@
<Compile Include="FreeRTOSConfig.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="..\..\..\Source\croutine.c">
<SubType>compile</SubType>
<Link>freeRTOS\croutine.c</Link>
</Compile>
<Compile Include="..\..\..\Source\event_groups.c">
<SubType>compile</SubType>
<Link>freeRTOS\event_groups.c</Link>
@ -196,6 +200,10 @@
<SubType>compile</SubType>
<Link>freeRTOS\include\atomic.h</Link>
</Compile>
<Compile Include="..\..\..\Source\include\croutine.h">
<SubType>compile</SubType>
<Link>freeRTOS\include\croutine.h</Link>
</Compile>
<Compile Include="..\..\..\Source\include\deprecated_definitions.h">
<SubType>compile</SubType>
<Link>freeRTOS\include\deprecated_definitions.h</Link>
@ -308,6 +316,14 @@
<SubType>compile</SubType>
<Link>Common\Minimal\PollQ.c</Link>
</Compile>
<Compile Include="..\..\..\Demo\Common\include\crflash.h">
<SubType>compile</SubType>
<Link>Common\include\crflash.h</Link>
</Compile>
<Compile Include="..\..\..\Demo\Common\Minimal\crflash.c">
<SubType>compile</SubType>
<Link>Common\Minimal\crflash.c</Link>
</Compile>
<Compile Include="..\..\..\Demo\Common\include\serial.h">
<SubType>compile</SubType>
<Link>Common\include\serial.h</Link>

View file

@ -88,7 +88,7 @@ void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this

View file

@ -27,10 +27,12 @@
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "crflash.h"
#include "partest.h"
#include "regtest.h"
@ -60,6 +62,9 @@ again. */
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( 0x1400 )
/* The number of coroutines to create. */
#define mainNUM_FLASH_COROUTINES ( 3 )
/*
* The task function for the "Check" task.
*/
@ -86,10 +91,13 @@ void main_minimal( 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. */
@ -101,7 +109,7 @@ void init_minimal( void )
/* Configure UART pins: PC1 Rx, PC0 Tx */
PORTC.DIR &= ~PIN0_bm;
PORTC.DIR |= PIN1_bm;
vParTestInitialise();
}
@ -122,7 +130,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();
}
}
@ -151,7 +159,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
@ -173,4 +181,5 @@ unsigned char ucResetCount;
void vApplicationIdleHook( void )
{
vCoRoutineSchedule();
}

View file

@ -62,7 +62,7 @@ portBASE_TYPE xReturn;
{
xReturn = pdFALSE;
}
return xReturn;
}
/*-----------------------------------------------------------*/

View file

@ -39,12 +39,12 @@
/*
* Timer instance | Value
* ----------------|---------
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* TCB4 | 4
* RTC | 5
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* TCB4 | 4
* RTC | 5
*/
#define configUSE_TIMER_INSTANCE 0
@ -93,6 +93,10 @@ For other frequency values, update clock_config.h with your own settings */
#define configUSE_TRACE_FACILITY 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )

View file

@ -2126,6 +2126,9 @@
<file>
<name>$PROJ_DIR$\..\Common\include\comtest.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\include\crflash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\include\integer.h</name>
</file>
@ -2156,6 +2159,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$\..\Common\Minimal\integer.c</name>
</file>
@ -2177,6 +2183,9 @@
<file>
<name>$PROJ_DIR$\..\..\Source\include\atomic.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\croutine.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\deprecated_definitions.h</name>
</file>
@ -2253,6 +2262,9 @@
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\..\Source\croutine.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\event_groups.c</name>
</file>

View file

@ -2169,6 +2169,9 @@
<file>
<name>$PROJ_DIR$\..\Common\include\comtest.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\include\crflash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\Common\include\integer.h</name>
</file>
@ -2199,6 +2202,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$\..\Common\Minimal\integer.c</name>
</file>
@ -2220,6 +2226,9 @@
<file>
<name>$PROJ_DIR$\..\..\Source\include\atomic.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\croutine.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\include\deprecated_definitions.h</name>
</file>
@ -2296,6 +2305,9 @@
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\..\Source\croutine.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\Source\event_groups.c</name>
</file>

View file

@ -62,7 +62,7 @@ portBASE_TYPE xReturn;
{
xReturn = pdFALSE;
}
return xReturn;
}
/*-----------------------------------------------------------*/

View file

@ -88,7 +88,7 @@ void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this

View file

@ -26,11 +26,13 @@
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "crflash.h"
#include "partest.h"
#include "regtest.h"
@ -60,6 +62,9 @@ again. */
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( 0x1400 )
/* The number of coroutines to create. */
#define mainNUM_FLASH_COROUTINES ( 3 )
/*
* The task function for the "Check" task.
*/
@ -86,10 +91,13 @@ void main_minimal( 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. */
@ -101,7 +109,7 @@ void init_minimal( void )
/* Configure UART pins: PC1 Rx, PC0 Tx */
PORTC.DIR &= ~PIN0_bm;
PORTC.DIR |= PIN1_bm;
vParTestInitialise();
}
@ -122,7 +130,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();
}
}
@ -151,7 +159,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
@ -171,4 +179,5 @@ static unsigned char __eeprom ucResetCount @ mainRESET_COUNT_ADDRESS;
void vApplicationIdleHook( void )
{
vCoRoutineSchedule();
}

View file

@ -39,12 +39,12 @@
/*
* Timer instance | Value
* ----------------|---------
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* TCB0 | 0
* TCB1 | 1
* TCB2 | 2
* TCB3 | 3
* TCB4 | 4
* RTC | 5
* RTC | 5
*/
#define configUSE_TIMER_INSTANCE 0
@ -91,6 +91,10 @@ For other frequency values, update clock_config.h with your own settings */
#define configUSE_TRACE_FACILITY 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )

View file

@ -63,7 +63,7 @@ portBASE_TYPE xReturn;
{
xReturn = pdFALSE;
}
return xReturn;
}
/*-----------------------------------------------------------*/

View file

@ -88,7 +88,7 @@ void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this

View file

@ -27,10 +27,12 @@
#include "FreeRTOS.h"
#include "task.h"
#include "croutine.h"
#include "PollQ.h"
#include "integer.h"
#include "serial.h"
#include "comtest.h"
#include "crflash.h"
#include "partest.h"
#include "regtest.h"
@ -60,6 +62,9 @@ again. */
the demo application is not unexpectedly resetting. */
#define mainRESET_COUNT_ADDRESS ( 0x1400 )
/* The number of coroutines to create. */
#define mainNUM_FLASH_COROUTINES ( 3 )
/*
* The task function for the "Check" task.
*/
@ -86,10 +91,13 @@ void main_minimal( 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. */
@ -101,7 +109,7 @@ void init_minimal( void )
/* Configure UART pins: PC1 Rx, PC0 Tx */
PORTC.DIR &= ~PIN0_bm;
PORTC.DIR |= PIN1_bm;
vParTestInitialise();
}
@ -122,7 +130,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();
}
}
@ -151,7 +159,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
@ -173,4 +181,5 @@ unsigned char ucResetCount;
void vApplicationIdleHook( void )
{
vCoRoutineSchedule();
}

View file

@ -10,6 +10,7 @@
<itemPath>../Common/include/PollQ.h</itemPath>
<itemPath>../Common/include/TaskNotify.h</itemPath>
<itemPath>../Common/include/comtest.h</itemPath>
<itemPath>../Common/include/crflash.h</itemPath>
<itemPath>../Common/include/integer.h</itemPath>
<itemPath>../Common/include/partest.h</itemPath>
<itemPath>../Common/include/print.h</itemPath>
@ -21,6 +22,7 @@
<itemPath>../Common/Minimal/PollQ.c</itemPath>
<itemPath>../Common/Minimal/TaskNotify.c</itemPath>
<itemPath>../Common/Minimal/comtest.c</itemPath>
<itemPath>../Common/Minimal/crflash.c</itemPath>
<itemPath>../Common/Minimal/integer.c</itemPath>
<itemPath>../Common/Minimal/recmutex.c</itemPath>
</logicalFolder>
@ -30,6 +32,7 @@
<itemPath>../../Source/include/FreeRTOS.h</itemPath>
<itemPath>../../Source/include/StackMacros.h</itemPath>
<itemPath>../../Source/include/atomic.h</itemPath>
<itemPath>../../Source/include/croutine.h</itemPath>
<itemPath>../../Source/include/deprecated_definitions.h</itemPath>
<itemPath>../../Source/include/event_groups.h</itemPath>
<itemPath>../../Source/include/list.h</itemPath>
@ -57,6 +60,7 @@
<itemPath>../../Source/portable/MemMang/heap_1.c</itemPath>
</logicalFolder>
</logicalFolder>
<itemPath>../../Source/croutine.c</itemPath>
<itemPath>../../Source/event_groups.c</itemPath>
<itemPath>../../Source/list.c</itemPath>
<itemPath>../../Source/queue.c</itemPath>

View file

@ -93,6 +93,9 @@
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1 /* Defaults to 1 anyway. */
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1

View file

@ -61,6 +61,9 @@
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1

View file

@ -61,6 +61,9 @@
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1

View file

@ -61,6 +61,9 @@
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1

View file

@ -108,6 +108,9 @@ uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
#define configUSE_TICK_HOOK 1
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1

View file

@ -26,8 +26,8 @@
/******************************************************************************
* NOTE 1: This project provides two demo applications. A simple blinky
* style project, and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
* style project, and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
* in main.c. This file implements the simply blinky style version.
*

View file

@ -95,6 +95,9 @@
/* Include the query-heap CLI command to query the free heap space. */
#define configINCLUDE_QUERY_HEAP_COMMAND 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1

View file

@ -44,8 +44,8 @@
/* include the port-dependent configuration */
#include "lwipcfg_msvc.h"
/* Dimensions the cTxBuffer array - which is itself used to hold replies from
command line commands. cTxBuffer is a shared buffer, so protected by the
/* Dimensions the cTxBuffer array - which is itself used to hold replies from
command line commands. cTxBuffer is a shared buffer, so protected by the
xTxBufferMutex mutex. */
#define lwipappsTX_BUFFER_SIZE 1024
@ -53,7 +53,7 @@ xTxBufferMutex mutex. */
available. */
#define lwipappsMAX_TIME_TO_WAIT_FOR_TX_BUFFER_MS ( 100 / portTICK_RATE_MS )
/* Definitions of the various SSI callback functions within the pccSSITags
/* Definitions of the various SSI callback functions within the pccSSITags
array. If pccSSITags is updated, then these definitions must also be updated. */
#define ssiTASK_STATS_INDEX 0
#define ssiRUN_TIME_STATS_INDEX 1
@ -74,9 +74,9 @@ static unsigned short uslwIPAppsSSIHandler( int iIndex, char *pcBuffer, int iBuf
/*-----------------------------------------------------------*/
/* The SSI strings that are embedded in the served html files. If this array
is changed, then the index position defined by the #defines such as
is changed, then the index position defined by the #defines such as
ssiTASK_STATS_INDEX above must also be updated. */
static const char *pccSSITags[] =
static const char *pccSSITags[] =
{
"rtos_stats",
"run_stats"
@ -85,11 +85,11 @@ static const char *pccSSITags[] =
/* Semaphore used to guard the Tx buffer. */
static xSemaphoreHandle xTxBufferMutex = NULL;
/* The Tx buffer itself. This is used to hold the text generated by the
execution of command line commands, and (hopefully) the execution of
/* The Tx buffer itself. This is used to hold the text generated by the
execution of command line commands, and (hopefully) the execution of
server side include callbacks. It is a shared buffer so protected by the
xTxBufferMutex mutex. pcLwipAppsBlockingGetTxBuffer() and
vLwipAppsReleaseTxBuffer() are provided to obtain and release the
xTxBufferMutex mutex. pcLwipAppsBlockingGetTxBuffer() and
vLwipAppsReleaseTxBuffer() are provided to obtain and release the
xTxBufferMutex respectively. pcLwipAppsBlockingGetTxBuffer() must be used with
caution as it has the potential to block. */
static signed char cTxBuffer[ lwipappsTX_BUFFER_SIZE ];
@ -157,7 +157,7 @@ static struct netif xNetIf;
/* Install the server side include handler. */
http_set_ssi_handler( uslwIPAppsSSIHandler, pccSSITags, sizeof( pccSSITags ) / sizeof( char * ) );
/* Create the mutex used to ensure mutual exclusive access to the Tx
/* Create the mutex used to ensure mutual exclusive access to the Tx
buffer. */
xTxBufferMutex = xSemaphoreCreateMutex();
configASSERT( xTxBufferMutex );
@ -185,7 +185,7 @@ extern char *pcMainGetTaskStatusMessage( void );
/* The SSI handler function that generates text depending on the index of
the SSI tag encountered. */
switch( iIndex )
{
case ssiTASK_STATS_INDEX :

View file

@ -102,6 +102,9 @@ LEDs are not visible in QEMU. */
/* Include the query-heap CLI command to query the free heap space. */
#define configINCLUDE_QUERY_HEAP_COMMAND 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1

View file

@ -50,11 +50,13 @@
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configMAX_PRIORITIES ( 5 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
#define configQUEUE_REGISTRY_SIZE 10
/* Set the following definitions to 1 to include the API function, or zero

View file

@ -66,11 +66,11 @@ void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
portENTER_CRITICAL();
{
if( xLEDPins[ uxLED ].type == PIO_OUTPUT_0 )
{
{
PIO_Set( &( xLEDPins[ uxLED ]) );
}
else
{
{
PIO_Clear( &( xLEDPins[ uxLED ] ) );
}
}
@ -82,11 +82,11 @@ void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
portENTER_CRITICAL();
{
if( xLEDPins[ uxLED ].type == PIO_OUTPUT_0 )
{
{
PIO_Clear( &( xLEDPins[ uxLED ] ) );
}
else
{
{
PIO_Set( &( xLEDPins[ uxLED ] ) );
}
}
@ -101,15 +101,15 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
if( uxLED < partestNUM_LEDS )
{
if( PIO_GetOutputDataStatus( &( xLEDPins[ uxLED ] ) ) )
{
{
PIO_Clear( &( xLEDPins[ uxLED ] ) );
}
else
{
{
PIO_Set( &( xLEDPins[ uxLED ] ) );
}
}
}
}

View file

@ -93,19 +93,19 @@ const Pin xUSART_Pins[] = { BOARD_PIN_USART_RXD, BOARD_PIN_USART_TXD };
{
/* Enable the peripheral clock in the PMC. */
PMC_EnablePeripheral( BOARD_ID_USART );
/* Configure the USART. */
USART_Configure( BOARD_USART_BASE, AT91C_US_CHRL_8_BITS | AT91C_US_PAR_NONE | AT91C_US_NBSTOP_1_BIT, ulWantedBaud, configCPU_CLOCK_HZ );
/* Configure the interrupt. Note the pre-emption priority is set
in bits [8:15] of the priority value passed as the parameter. */
IRQ_ConfigureIT( BOARD_ID_USART, ( configMAX_SYSCALL_INTERRUPT_PRIORITY << 8 ), vSerialISR );
IRQ_EnableIT( BOARD_ID_USART );
/* Enable receiver & transmitter. */
USART_SetTransmitterEnabled( BOARD_USART_BASE, pdTRUE );
USART_SetReceiverEnabled( BOARD_USART_BASE, pdTRUE );
/* Configure IO for USART use. */
PIO_Configure( xUSART_Pins, PIO_LISTSIZE( xUSART_Pins ) );
}
@ -211,7 +211,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
{
/* Queue empty, nothing to send so turn off the Tx interrupt. */
vInterruptOff();
}
}
}
if( ulStatus & AT91C_US_RXRDY )
@ -231,4 +231,4 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;

View file

@ -354,6 +354,9 @@
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="src\asf\thirdparty\FreeRTOS\include\croutine.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\asf\thirdparty\FreeRTOS\include\FreeRTOS.h">
<SubType>compile</SubType>
</Compile>

View file

@ -30,58 +30,58 @@
typedef void * xComPortHandle;
typedef enum
{
serCOM1,
serCOM2,
serCOM3,
serCOM4,
serCOM5,
serCOM6,
serCOM7,
serCOM8
{
serCOM1,
serCOM2,
serCOM3,
serCOM4,
serCOM5,
serCOM6,
serCOM7,
serCOM8
} eCOMPort;
typedef enum
{
serNO_PARITY,
serODD_PARITY,
serEVEN_PARITY,
serMARK_PARITY,
serSPACE_PARITY
typedef enum
{
serNO_PARITY,
serODD_PARITY,
serEVEN_PARITY,
serMARK_PARITY,
serSPACE_PARITY
} eParity;
typedef enum
{
serSTOP_1,
serSTOP_2
typedef enum
{
serSTOP_1,
serSTOP_2
} eStopBits;
typedef enum
{
serBITS_5,
serBITS_6,
serBITS_7,
serBITS_8
typedef enum
{
serBITS_5,
serBITS_6,
serBITS_7,
serBITS_8
} eDataBits;
typedef enum
{
ser50,
ser75,
ser110,
ser134,
ser150,
typedef enum
{
ser50,
ser75,
ser110,
ser134,
ser150,
ser200,
ser300,
ser600,
ser1200,
ser1800,
ser2400,
ser300,
ser600,
ser1200,
ser1800,
ser2400,
ser4800,
ser9600,
ser19200,
ser38400,
ser57600,
ser9600,
ser19200,
ser38400,
ser57600,
ser115200
} eBaud;

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