mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-08-18 01:18:36 +08:00
Remove coroutines (#874)
* Remove co-routine centric CORTEX_LM3S102_Rowley demos. Remove CORTEX_LM3S102_Rowley Demo2 and Demo3. Update Demo1 to no longer use coroutines. * Remove co-routines from MB91460_Softune demo * FreeRTOS_96348hs_SK16FX100PMC: Remove co-routine usage. Remove co-routine usage from FreeRTOS_96348hs_SK16FX100PMC demo. * MB96350_Softune_Dice_Kit: Remove co-routine usage Remove co-routines usage from MB96350_Softune_Dice_Kit demo * AVR_Dx_IAR: Remove co-routine usage * AVR_Dx_Atmel_Studio: Remove co-routine usage * PIC24_MPLAB: Remove autogenerated files and add to .gitignore * PIC24_MPLAB: Remove co-routine usage from demo * AVR_ATMega323_IAR: Remove co-routine usage * ColdFire_MCF52221_CodeWarrior: Remove coroutine usage * AVR_ATMega4809_MPLAB.X: Remove co-routine usage * AVR_ATMega4809_IAR: Remove co-routine usage * AVR_ATMega4809_Atmel_Studio: Remove coroutine usage * AVR_ATMega323_WinAVR: Remove coroutine usage * AVR_Dx_MPLAB.X: Remove coroutine usage * dsPIC_MPLAB: Remove coroutine usage * CORTEX_LM3S102_GCC: Remove coroutines and coroutine centric demos * CORTEX_LM3S102_GCC: Update makefile to discard unused symbols Allows fitting in the limited ram/flash for this part. * CORTEX_LM3S316_IAR: Remove coroutines * Demos: Remove references to crflash.c, crhook.c, crflash.h, crhook.h * Remove coroutine options from FreeRTOSConfig.h files * Xilinx: Remove backup file generated by revup utility * Demos: Remove Coroutine related config items and references * Format CBMC FreeRTOSConfig.h * Update URL from aws.amazon.com/freertos to github.com/FreeRTOS * Fix copyright year and license text * Fix license text in demo files * Update header check excluded path list * Add configBENCHMARK to lexicon
This commit is contained in:
@@ -190,6 +190,7 @@ FREERTOS_IGNORED_EXTENSIONS = [
|
||||
'.resources',
|
||||
'.rom',
|
||||
'.rprj',
|
||||
'.s',
|
||||
'.s79',
|
||||
'.s82',
|
||||
'.s90',
|
||||
@@ -273,7 +274,14 @@ FREERTOS_IGNORED_PATTERNS = [
|
||||
r'.*/ThirdParty/.*',
|
||||
r'FreeRTOS\-Plus/Demo/Common/WinPCap/.*',
|
||||
r'FreeRTOS\-Plus/Source/FreeRTOS-Plus-Trace/.*',
|
||||
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/.*'
|
||||
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/.*',
|
||||
r'FreeRTOS/Demo/lwIP_AVR32_UC3/.*',
|
||||
r'FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.*',
|
||||
r'FreeRTOS/Demo/CORTEX_LM3S102_GCC/makedefs',
|
||||
r'FreeRTOS/Demo/AVR32_UC3/FreeRTOSConfig.h',
|
||||
r'FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/smc_gen/.*',
|
||||
r'FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/smc_gen/.*',
|
||||
r'FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS\+/src/smc_gen/.*'
|
||||
]
|
||||
|
||||
FREERTOS_IGNORED_FILES = [
|
||||
@@ -292,6 +300,7 @@ FREERTOS_IGNORED_FILES = [
|
||||
'platform_config.h',
|
||||
'FreeRTOS_asm_vectors.S',
|
||||
'interrupt_vector.s',
|
||||
'reg_test.S',
|
||||
'gdbinit'
|
||||
]
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,9 +59,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
# *
|
||||
# * https://www.FreeRTOS.org
|
||||
# * https://aws.amazon.com/freertos
|
||||
# * https://github.com/FreeRTOS
|
||||
# *
|
||||
# * 1 tab == 4 spaces!
|
||||
# */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
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;
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
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)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,9 +55,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
{
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,9 +56,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
# *
|
||||
# * https://www.FreeRTOS.org
|
||||
# * https://aws.amazon.com/freertos
|
||||
# * https://github.com/FreeRTOS
|
||||
# *
|
||||
# * 1 tab == 4 spaces!
|
||||
# */
|
||||
@@ -107,6 +107,6 @@ clean :
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -57,9 +57,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,9 +56,6 @@
|
||||
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
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 );
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
; *
|
||||
; * https://www.FreeRTOS.org
|
||||
; * https://aws.amazon.com/freertos
|
||||
; * https://github.com/FreeRTOS
|
||||
; *
|
||||
; * 1 tab == 4 spaces!
|
||||
; */
|
||||
|
||||
@@ -69,9 +69,6 @@ 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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
#include "FreeRTOS.h"
|
||||
@@ -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
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,9 +53,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,9 +55,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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 )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,9 +53,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#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
|
||||
@@ -60,7 +59,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestInitialise( void )
|
||||
{
|
||||
{
|
||||
unsigned long ul;
|
||||
|
||||
for( ul = 0; ul < partstNUM_LEDS; ul++ )
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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,9 +73,6 @@
|
||||
#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. */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,10 +56,6 @@
|
||||
#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. */
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
Changes from V2.0.0
|
||||
|
||||
+ Use scheduler suspends in place of critical sections.
|
||||
@@ -110,7 +110,7 @@ unsigned char ucBit;
|
||||
|
||||
PORTB = ucCurrentOutputValue;
|
||||
}
|
||||
xTaskResumeAll();
|
||||
xTaskResumeAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://aws.amazon.com/freertos
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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,10 +71,6 @@ 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>
|
||||
@@ -88,14 +84,12 @@ Changes from V4.0.5
|
||||
/* 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"
|
||||
@@ -127,9 +121,6 @@ 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.
|
||||
*/
|
||||
@@ -148,9 +139,9 @@ static void prvCheckOtherTasksAreStillRunning( void );
|
||||
static void prvIncrementResetCount( void );
|
||||
|
||||
/*
|
||||
* Idle hook is used to scheduler co-routines.
|
||||
* Idle hook (empty)
|
||||
*/
|
||||
void vApplicationIdleHook( void );
|
||||
void vApplicationIdleHook( void );
|
||||
|
||||
short main( void )
|
||||
{
|
||||
@@ -164,13 +155,10 @@ 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. */
|
||||
@@ -197,7 +185,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();
|
||||
}
|
||||
}
|
||||
@@ -226,7 +214,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
|
||||
@@ -244,20 +232,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;
|
||||
@@ -268,6 +256,5 @@ const unsigned char ucWrite2 = ( unsigned char ) 0x02;
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
vCoRoutineSchedule();
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user