Hi,
i'm new to TI RTOS and i was wondering:
i want to have 2 communication tasks doing the same actions but on a different hardware interface. So i wrote one C function and i have 2 data structs that represent the different interfaces.
ex:
typedef struct {blabla}INTERFACE;
INTERFACE interface1, interface2;
void handle_interface(INTERFACE*);
void Task1()
{
while(1) handle_interface(&interface1);
}
void Task2()
{
while(1) handle_interface(&interface2);
}
question1:
Lets say task 2 has higher priority then task 1. I suppose TI RTOS knows that if task1 gets preempted by task2 that even if it will run the same code (handle_interface) that it will have to use interface2 struct instead of interface1 ? Or do i have to code it different and give the struct as a parameter to the task ?
void Task1(&interface)
{
handle_interface(interface);
}
void Task2(&interface)
{
handle_interface(interface);
}
question2: can i use local variables in the handle_interface() function ? lets day i have a local variable index running in task1 with a value of 3, task 2 takes over and resets the index to 0 and on exit index = 10. Will it be reset to 3 when task1 resumes or do i have to embed it in the INTERFACE struct to get saved/restored...
Thanks for the help
Kind regards
Jan