Chris O'Byrne - YAVRTOS

API Usage Restrictions


Callable by

Callable on


API call

ISR

Idle task

Non-idle task

Lower-priority task

Before RTOS start

Current task

Idle task

Could switch tasks

reserve_task()

Y

Y

Y

n/a

Y

n/a

n/a

N

create_task()

Y

Y

Y

n/a

Y

n/a

n/a

Y

stop_task()

Y

N

Y

N

Y

Y

N

Y

lock_on()

N

N

Y

n/a

N

n/a

n/a

Y

lock_off()

N

N

Y

n/a

N

n/a

n/a

Y

get_current_mbox_version()

Y

Y

Y

n/a

Y

n/a

n/a

N

read_mbox_min_version()

N

N

Y

n/a

N

n/a

n/a

Y

read_mbox()

N

Y

Y

n/a

N

n/a

n/a

Y

release_mbox_read()

N

Y

Y

n/a

N

n/a

n/a

Y

initialise_mbox()

Y

Y

Y

n/a

Y

n/a

n/a

N

write_mbox()

N

N

Y

n/a

N

n/a

n/a

Y

write_mbox_now()

Y

Y

Y

n/a

Y

n/a

n/a

Y

wait_for_receiver()

N

N

Y

n/a

N

n/a

n/a

Y

get_semaphore_value()

Y

Y

Y

n/a

Y

n/a

n/a

N

increment_semaphore_by()

Y

Y

Y

n/a

Y

n/a

n/a

Y

wait_for_min_value()

N

N

Y

n/a

N

n/a

n/a

Y

wait_for_increment_of()

N

N

Y

n/a

N

n/a

n/a

Y

yield()

N

Y

Y

n/a

N

n/a

n/a

Y

disable_interrupts()

Y

Y

Y

n/a

Y

n/a

n/a

N

restore_interrupts()

Y

Y

Y

n/a

Y

n/a

n/a

Y

task_switcher_start()

N

N

N

n/a

Y

n/a

n/a

Y


The columns in the above table are

  • "ISR" indicates whether the API call can be made from within an ISR
  • "Idle task" indicates whether an idle (i.e. zero-priority) task may use the API call
  • "Non-idle task" indicates whether a task with non-zero priority may use the call
  • "Lower-priority task" - for those calls that take a task argument, indicates whether a task with a lower priority than that of the argument may use the call
  • "Before RTOS start" indicates whether the call can be made before task_switcher_start() is called
  • "Current task" - for those calls that take a task argument, indicates whether the value of that argument may be current_task
  • "Idle task" - for those calls that take a task argument, indicates whether the value of that argument may be a zero-priority idle task
  • "Could switch tasks" indicates whether a side-effect of making the call could be that the task scheduler runs and switches tasks - see yield(). A side-effect of this is that interrupts could be re-enabled if the task switcher chooses a task that didn't disable them.
In addition, the only time that it is safe to directly set the value of a semaphore (i.e. without using the increment_semaphore_by() API call) is before the RTOS starts.

Finally, when an ISR finishes executing, the task scheduler is called, as the ISR may have changed the list of runnable tasks (e.g. by incrementing the value of a semaphore, or by successfully posting a message to a task).


YAVRTOS and YAVRTOS documentation Copyright © 2007-2008 Chris O'Byrne. Email - chris <at> obyrne <dot> com