This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

task switching

Hi,

Does os_send_token() cause task switching?If so, my code given below is not working properly,task_1 is running continuously, and task_2 is never getting executed.
Please clarify my doubt.



void setup_serial_io (void)
{
SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 0xF0; /* TH1: reload value */
TR1 = 1; /* TR1: timer 1 run */
TI = 1; /* TI: set TI to send first char of UART */
}


void task_1 (void) _task_ TASK1 _priority_ 0
{
while (1)
{
// Delay for 200 ticks
os_wait (K_MBX + SEM_PRINTF, 255, 0); // Wait for printf
printf ("Task # %d\n", (int) os_running_task_id ());
os_send_token (SEM_PRINTF); // Done with printf
}
}


void task_2 (void) _task_ TASK2 _priority_ 0
{
while (1)
{

os_wait (K_MBX + SEM_PRINTF, 255, 0); // Wait for printf
printf ("Task # %d\n", (int) os_running_task_id ());
os_send_token (SEM_PRINTF); // Done with printf
}
}

regards,

srilatha.