From 63c6a6afc033432f58d1ec3de39640c584553153 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Mon, 27 Sep 2021 10:12:32 +0200 Subject: More docs updates --- book/en/src/by-example/software_tasks.md | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'book/en/src/by-example/software_tasks.md') diff --git a/book/en/src/by-example/software_tasks.md b/book/en/src/by-example/software_tasks.md index 0c9b62e..f78efea 100644 --- a/book/en/src/by-example/software_tasks.md +++ b/book/en/src/by-example/software_tasks.md @@ -1,9 +1,20 @@ # Software tasks & spawn +Software tasks, as hardware tasks, are run as interrupt handlers where all software tasks at the +same priority shares a "free" interrupt handler to run from, called a dispatcher. These free +interrupts are interrupt vectors not used by hardware tasks. + To declare tasks in the framework the `#[task]` attribute is used on a function. By default these tasks are referred to as software tasks as they do not have a direct coupling to an interrupt handler. Software tasks can be spawned (started) using the `task_name::spawn()` static method which will directly run the task given that there are no higher priority tasks running. + +To indicate to the framework which interrupts are free for use to dispatch software tasks with the +`#[app]` attribute has a `dispatchers = [FreeInterrupt1, FreeInterrupt2, ...]` argument. You need +to provide as many dispatchers as there are priority levels used by software tasks, as an +dispatcher is assigned per interrupt level. The framework will also give a compile error if there +are not enough dispatchers provided. + This is exemplified in the following: ``` rust -- cgit v1.2.3