/** * @brief Context switch to the highest priority task that is not this task -- * don't save the current task state. * * There is always an idle task to switch to. */ void dispatch_nosave(void) { uint8_t prio = highest_prio(); tcb_t *next_task = runqueue_remove(prio); //Enqueue current task runqueue_add(cur_tcb, cur_tcb->cur_prio); cur_tcb = next_task; ctx_switch_half(&(next_task->context)); }
/** * @brief Context switch to the highest priority task that is not this task -- * don't save the current task state. * * There is always an idle task to switch to. */ void dispatch_nosave(void) { /* This executes the first task This ends up being the initial high prio task */ /* Set cur_tcb to the task that we are about to run */ cur_tcb = runqueue_remove(highest_prio()); /* Set the cur_kstack var of the task that we are about to run */ cur_kstack = (int)cur_tcb->kstack_high; ctx_switch_half(&(cur_tcb->context)); }
/** * @brief Context switch to the highest priority task that is not this task -- * don't save the current task state. * * There is always an idle task to switch to. */ void dispatch_nosave(void) { uint8_t next_prio; tcb_t *next_tcb; // printf("inside dispatch no save\n"); next_prio = highest_prio(); // printf("next_prio is %u\n", next_prio); /* * manage the run queue... */ next_tcb = runqueue_remove(next_prio); // printf("d nosave: removed next_tcb %u %p from run queue\n", next_tcb->cur_prio, next_tcb); // print_run_queue(); cur_tcb = next_tcb; // printf("before calling ctx sw half, context->sp is %p\n", next_tcb->context.sp); ctx_switch_half((volatile void *)(&(next_tcb->context))); }