4. /* The Tx and Rx tasks as described at the top of this file. */
static void prvTxTask( void *pvParameters );
static void prvRxTask( void *pvParameters );
static void vTimerCallback( TimerHandle_t pxTimer );
Vincent Claes
5. /* The queue used by the Tx and Rx tasks, as described at the top of this file. */
static TaskHandle_t xTxTask;
static TaskHandle_t xRxTask;
static QueueHandle_t xQueue = NULL;
static TimerHandle_t xTimer = NULL;
char HWstring[15] = "Hello World";
long RxtaskCntr = 0;
Vincent Claes
6. int main( void )
{
/* pdMS_TO_TICKS: Converts a time in milliseconds to a time in ticks. */
const TickType_t x10seconds = pdMS_TO_TICKS(DELAY_10_SECONDS );
xil_printf( "Hello from Freertos example mainrn" );
xTaskCreate( prvTxTask, ( const char * ) "Tx",
configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, &xTxTask );
xTaskCreate( prvRxTask, ( const char * ) "GB",
configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, &xRxTask );
Vincent Claes
7. xTaskCreate( prvTxTask, ( const char * ) "Tx",
configMINIMAL_STACK_SIZE, NULL,
tskIDLE_PRIORITY, &xTxTask );
/* prvTxTask : function that implements the task */
/* “TX” : Name for the task */
/* configMINIMAL_STACK_SIZE : stack allocated tot he task */
/* NULL : parameter not used */
/* tskIDLE_PRIORITY : task runs at idle priority */
/* &xTxTask : TX Taskhandler */
Vincent Claes
8. xTaskCreate( prvRxTask, ( const char * ) "GB",
configMINIMAL_STACK_SIZE, NULL,
tskIDLE_PRIORITY + 1, &xRxTask );
/* prvRxTask : function that implements the task */
/* “GB” : Name for the task */
/* configMINIMAL_STACK_SIZE : stack allocated tot he task */
/* NULL : parameter not used */
/* tskIDLE_PRIORITY : task runs at idle priority +1 */
/* &xRxTask : RX Taskhandler */
Vincent Claes
10. xQueue = xQueueCreate(1, sizeof( HWstring ) );
/* 1 : One place in queue */
/* sizeof (HWstring) : place in queue can hold HWstring */
/* char HWstring[15] : “Hello World”; */
Vincent Claes
11. xTimer = xTimerCreate( (const char *) "Timer",
x10seconds, pdFALSE, (void *) TIMER_ID,
vTimerCallback);
/* “Timer” : Name of Timer */
/* x10seconds : expires after 10 seconds */
/* pdFALSE : Don’t autoreload */
/* TIMER_ID : Timer identifier */
/* vTimerCallback : Timer callback function */
Vincent Claes
13. xQueueReceive( xQueue, Recdstring,
portMAX_DELAY );
/* xQueue : Queue being read */
/* Recdstring : Data read intro this address */
/* portMAX_DELAY : wait without timeout for data */
Vincent Claes