/* The number of LEDs available to the user on the evaluation kit. */\r
#define partestNUM_LEDS ( 3UL )\r
\r
-/* Definitions not included in sam3s_ek.h. */\r
+/* Definitions not included in sam4s_ek.h. */\r
#define LED2_GPIO ( PIO_PC20_IDX )\r
\r
/* One of the LEDs is wired in the inverse to the others as it is also used as\r
if( xValue != pdFALSE )\r
{\r
/* Turn the LED on. */\r
- portENTER_CRITICAL();\r
+ taskENTER_CRITICAL();\r
{\r
gpio_set_pin_low( ulLED[ uxLED ]);\r
}\r
- portEXIT_CRITICAL();\r
+ taskEXIT_CRITICAL();\r
}\r
else\r
{\r
/* Turn the LED off. */\r
- portENTER_CRITICAL();\r
+ taskENTER_CRITICAL();\r
{\r
gpio_set_pin_high( ulLED[ uxLED ]);\r
}\r
- portEXIT_CRITICAL();\r
+ taskEXIT_CRITICAL();\r
}\r
}\r
}\r
{\r
if( uxLED < partestNUM_LEDS )\r
{\r
- gpio_toggle_pin( ulLED[ uxLED ] );\r
+ taskENTER_CRITICAL();\r
+ { \r
+ gpio_toggle_pin( ulLED[ uxLED ] );\r
+ }\r
+ taskEXIT_CRITICAL(); \r
}\r
}\r
\r
\r
/*-----------------------------------------------------------*/\r
\r
+\r
/*\r
* See the serial.h header file.\r
*/\r
}\r
/*-----------------------------------------------------------*/\r
\r
+/* \r
+ * It should be noted that the com test tasks (which use make use of this file) \r
+ * are included to demonstrate queues being used to communicate between tasks \r
+ * and interrupts, and to demonstrate a context switch being performed from \r
+ * inside an interrupt service routine. The serial driver used here is *not* \r
+ * intended to represent an efficient implementation. Real applications should \r
+ * make use of the USARTS peripheral DMA channel (PDC).\r
+ */\r
void USART1_Handler( void )\r
{\r
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
signed portBASE_TYPE MPU_xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );\r
signed portBASE_TYPE MPU_xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );\r
void MPU_vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName );\r
+void MPU_vQueueDelete( xQueueHandle xQueue );\r
void *MPU_pvPortMalloc( size_t xSize );\r
void MPU_vPortFree( void *pv );\r
void MPU_vPortInitialiseBlocks( void );\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
+void MPU_vQueueDelete( xQueueHandle xQueue )\r
+{\r
+portBASE_TYPE xRunningPrivileged = prvRaisePrivilege();\r
+\r
+ vQueueDelete( xQueue );\r
+ \r
+ portRESET_PRIVILEGE( xRunningPrivileged );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
void *MPU_pvPortMalloc( size_t xSize )\r
{\r
void *pvReturn;\r
* PUBLIC LIST API documented in list.h\r
*----------------------------------------------------------*/\r
\r
-/* Constants used with the cRxLock and cTxLock structure members. */\r
+/* Constants used with the cRxLock and xTxLock structure members. */\r
#define queueUNLOCKED ( ( signed portBASE_TYPE ) -1 )\r
#define queueLOCKED_UNMODIFIED ( ( signed portBASE_TYPE ) 0 )\r
\r
unsigned portBASE_TYPE uxLength; /*< The length of the queue defined as the number of items it will hold, not the number of bytes. */\r
unsigned portBASE_TYPE uxItemSize; /*< The size of each items that the queue will hold. */\r
\r
- signed portBASE_TYPE xRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */\r
- signed portBASE_TYPE xTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */\r
+ volatile signed portBASE_TYPE xRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */\r
+ volatile signed portBASE_TYPE xTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */\r
\r
#if ( configUSE_TRACE_FACILITY == 1 )\r
unsigned char ucQueueNumber;\r
{\r
/* Create the timer task, storing its handle in xTimerTaskHandle so\r
it can be returned by the xTimerGetTimerDaemonTaskHandle() function. */\r
- xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY, &xTimerTaskHandle ); \r
+ xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle ); \r
}\r
#else\r
{\r
/* Create the timer task without storing its handle. */\r
- xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY, NULL);\r
+ xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL);\r
}\r
#endif\r
}\r
static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )\r
{\r
portTickType xTimeNow;\r
-static portTickType xLastTime = ( portTickType ) 0U;\r
+PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U;\r
\r
xTimeNow = xTaskGetTickCount();\r
\r