Commit 48d80c4a authored by Stefan Tauner's avatar Stefan Tauner
Browse files

Add priority paramter to setups of Blink and UART tasks

parent 5581084e
......@@ -50,7 +50,7 @@ void BlinkFxn(UArg arg0, UArg arg1)
/*
* Setup task function
*/
int setup_Blink_Task(led_descriptor_t *led_desc, uint32_t wait_ticks)
int setup_Blink_Task(int prio, led_descriptor_t *led_desc, uint32_t wait_ticks)
{
Task_Params taskLedParams;
Task_Handle taskLed;
......@@ -63,7 +63,7 @@ int setup_Blink_Task(led_descriptor_t *led_desc, uint32_t wait_ticks)
Error_init(&eb);
Task_Params_init(&taskLedParams);
taskLedParams.stackSize = 1024; /* stack in bytes */
taskLedParams.priority = 15; /* 0-15 (15 is highest priority on default -> see RTOS Task configuration) */
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 */
taskLedParams.arg1 = (UArg)wait_ticks; /* pass periods in ticks as arg1 */
taskLed = Task_create((Task_FuncPtr)BlinkFxn, &taskLedParams, &eb);
......
......@@ -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(&led_desc[0], 500);
(void)setup_Blink_Task(15, &led_desc[0], 500);
/* System_printf() is VERY slow!*/
System_printf("Created Blink Task1\n");
System_flush();
......@@ -46,12 +46,12 @@ 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(&led_desc[1], 250);
(void)setup_Blink_Task(15, &led_desc[1], 250);
System_printf("Created Blink Task2\n");
System_flush();
/*Initialize+start UART Task*/
(void)setup_UART_Task();
(void)setup_UART_Task(15);
System_printf("Created UART Task\n");
/* SysMin will only print to the console upon calling flush or exit */
......
......@@ -73,7 +73,7 @@ void UARTFxn(UArg arg0, UArg arg1)
/*
* Setup task function
*/
int setup_UART_Task(void)
int setup_UART_Task(int prio)
{
Task_Params taskUARTParams;
Task_Handle taskUART;
......@@ -94,7 +94,7 @@ int setup_UART_Task(void)
Error_init(&eb);
Task_Params_init(&taskUARTParams);
taskUARTParams.stackSize = 1024; /* stack in bytes */
taskUARTParams.priority = 15; /* 0-15 (15 is highest priority on default -> see RTOS Task configuration) */
taskUARTParams.priority = prio; /* 0-15 (15 is highest priority on default -> see RTOS Task configuration) */
taskUART = Task_create((Task_FuncPtr)UARTFxn, &taskUARTParams, &eb);
if (taskUART == NULL) {
System_abort("TaskUART create failed");
......
......@@ -35,11 +35,12 @@ void BlinkFxn(UArg arg0, UArg arg1);
* Setup Blink task
* Task has highest priority and receives 1kB of stack
*
* \param prio the task's priority.
* \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(led_descriptor_t *led_desc, uint32_t wait_ticks);
int setup_Blink_Task(int prio, led_descriptor_t *led_desc, uint32_t wait_ticks);
#endif
......@@ -32,8 +32,10 @@ void UARTFxn(UArg arg0, UArg arg1);
* Setup UART task
* Task has highest priority and receives 1kB of stack
*
* \param prio the task's priority.
*
* \return always zero. In case of error the system halts.
*/
int setup_UART_Task(void);
int setup_UART_Task(int prio);
#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