Commit b1af1384 authored by Stefan Tauner's avatar Stefan Tauner
Browse files

Give Blink tasks a custom name based on a new setup parameter

parent 48d80c4a
......@@ -50,7 +50,7 @@ void BlinkFxn(UArg arg0, UArg arg1)
/*
* Setup task function
*/
int setup_Blink_Task(int prio, led_descriptor_t *led_desc, uint32_t wait_ticks)
int setup_Blink_Task(int prio, xdc_String name, led_descriptor_t *led_desc, uint32_t wait_ticks)
{
Task_Params taskLedParams;
Task_Handle taskLed;
......@@ -62,6 +62,7 @@ int setup_Blink_Task(int prio, led_descriptor_t *led_desc, uint32_t wait_ticks)
/* Create blink task with priority 15*/
Error_init(&eb);
Task_Params_init(&taskLedParams);
taskLedParams.instance->name = name;
taskLedParams.stackSize = 1024; /* stack in bytes */
taskLedParams.priority = prio; /* 0-15 (15 is highest priority on default -> see RTOS Task configuration) */
taskLedParams.arg0 = (UArg)led_desc; /* pass led descriptor as arg0 */
......
......@@ -38,7 +38,7 @@ int main(void)
led_desc[0].port_base = GPIO_PORTN_BASE;
led_desc[0].led = GPIO_PIN_1;
/* Initialize+start Blink Task*/
(void)setup_Blink_Task(15, &led_desc[0], 500);
(void)setup_Blink_Task(15, "Blink 500", &led_desc[0], 500);
/* System_printf() is VERY slow!*/
System_printf("Created Blink Task1\n");
System_flush();
......@@ -46,7 +46,7 @@ int main(void)
led_desc[1].port_base = GPIO_PORTF_BASE;
led_desc[1].led = GPIO_PIN_0;
/*Initialize+start Blink Task*/
(void)setup_Blink_Task(15, &led_desc[1], 250);
(void)setup_Blink_Task(15, "Blink 250", &led_desc[1], 250);
System_printf("Created Blink Task2\n");
System_flush();
......
......@@ -68,3 +68,4 @@ it is SLOW, needs system_flush() after every call and
may cause observation of unpredictable behaviour
*/
SysMin.bufSize = 1024;
Defaults.common$.namedInstance = true;
......@@ -36,11 +36,12 @@ void BlinkFxn(UArg arg0, UArg arg1);
* Task has highest priority and receives 1kB of stack
*
* \param prio the task's priority.
* \param name the task's name.
* \param led_desc LED descriptor.
* \param time to wait in ticks for led to toggle
*
* \return always zero. In case of error the system halts.
*/
int setup_Blink_Task(int prio, led_descriptor_t *led_desc, uint32_t wait_ticks);
int setup_Blink_Task(int prio, xdc_String name, led_descriptor_t *led_desc, uint32_t wait_ticks);
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment