You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2016/02/29 23:11:55 UTC
[2/2] incubator-mynewt-site git commit: Context switch documentation
added. This closes pull request #12.
Context switch documentation added. This closes pull request #12.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/284e6030
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/284e6030
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/284e6030
Branch: refs/heads/asf-site
Commit: 284e6030933ddf570f4dcc4e88eca8e1f83967cc
Parents: 5f2a524
Author: aditihilbert <ad...@runtime.io>
Authored: Mon Feb 29 14:11:41 2016 -0800
Committer: aditihilbert <ad...@runtime.io>
Committed: Mon Feb 29 14:11:41 2016 -0800
----------------------------------------------------------------------
mkdocs/search_index.json | 325 ++++++++-
.../context_switch/context_switch/index.html | 14 +-
.../context_switch/os_arch_ctx_sw/index.html | 664 +++++++++++++++++++
.../os_arch_ctx_sw_isr/index.html | 664 +++++++++++++++++++
os/core_os/context_switch/os_sched/index.html | 65 +-
.../os_sched_ctx_sw_hook/index.html | 41 +-
.../os_sched_get_current_task/index.html | 44 +-
.../context_switch/os_sched_insert/index.html | 44 +-
.../os_sched_next_task/index.html | 29 +-
.../os_sched_os_timer_exp/index.html | 41 +-
.../context_switch/os_sched_resort/index.html | 57 +-
.../os_sched_set_current_task/index.html | 44 +-
.../context_switch/os_sched_sleep/index.html | 80 ++-
.../context_switch/os_sched_wakeup/index.html | 59 +-
sitemap.xml | 16 +-
15 files changed, 2151 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/mkdocs/search_index.json
----------------------------------------------------------------------
diff --git a/mkdocs/search_index.json b/mkdocs/search_index.json
index bf9ba54..9e2ec09 100644
--- a/mkdocs/search_index.json
+++ b/mkdocs/search_index.json
@@ -357,80 +357,375 @@
},
{
"location": "/os/core_os/context_switch/context_switch/",
- "text": "Scheduler/Context Switching\n\n\nInsert synopsis here\n\n\nDescription\n\n\nDescribe scheduler here\n\n\nData structures\n\n\nReplace this with the list of data structures used, why, any neat features\n\n\nList of Functions\n\n\nThe functions available in context_switch are:\n\n\n\n\nos_sched\n\n\nos_sched_ctx_sw_hook\n\n\nos_sched_get_current_task\n\n\nos_sched_insert\n\n\nos_sched_next_task\n\n\nos_sched_os_timer_exp\n\n\nos_sched_resort\n\n\nos_sched_set_current_task\n\n\nos_sched_sleep\n\n\nos_sched_wakeup",
+ "text": "Scheduler/Context Switching\n\n\nScheduler's job is to maintain the list of tasks and decide which one should be running next.\n\n\nDescription\n\n\nTask states can be \nrunning\n, \nready to run\n or \nsleeping\n.\n\n\nWhen task is \nrunning\n, CPU is executing in that task's context. The program counter (PC) is pointing to instructions task wants to execute and stack pointer (SP) is pointing to task's stack.\n\n\nTask which is \nready to run\n wants to get on the CPU to do its work.\n\n\nTask which is \nsleeping\n has no more work to do. It's waiting for someone else to wake it up.\n\n\nScheduler algorithm is simple: from among the tasks which are ready to run, pick the the one with highest priority (lowest numeric value in task's t_prio field), and make its state \nrunning\n.\n\n\nTasks which are either \nrunning\n or \nready to run\n are kept in linked list \ng_os_run_list\n. This list is ordered by priority.\n\n\nTasks which are \nsleeping\n are kept in lin
ked list \ng_os_sleep_list\n.\n\n\nScheduler has a CPU architecture specific component; this code is responsible for swapping in the task which should be \nrunning\n. This process is called context switch. During context switching the state of the CPU (e.g. registers) for the currently \nrunning\n task is stored and the new task is swapped in.\n\n\nData structures\n\n\nList of Functions\n\n\nThe functions available in context_switch are:\n\n\n\n\nos_sched\n\n\nos_arch_ctx_sw\n\n\nos_arch_ctx_sw_isr\n\n\nos_sched_ctx_sw_hook\n\n\nos_sched_get_current_task\n\n\nos_sched_insert\n\n\nos_sched_next_task\n\n\nos_sched_os_timer_exp\n\n\nos_sched_resort\n\n\nos_sched_set_current_task\n\n\nos_sched_sleep\n\n\nos_sched_wakeup",
"title": "Overview"
},
{
"location": "/os/core_os/context_switch/context_switch/#schedulercontext-switching",
- "text": "Insert synopsis here",
+ "text": "Scheduler's job is to maintain the list of tasks and decide which one should be running next.",
"title": "Scheduler/Context Switching"
},
{
"location": "/os/core_os/context_switch/context_switch/#description",
- "text": "Describe scheduler here",
+ "text": "Task states can be running , ready to run or sleeping . When task is running , CPU is executing in that task's context. The program counter (PC) is pointing to instructions task wants to execute and stack pointer (SP) is pointing to task's stack. Task which is ready to run wants to get on the CPU to do its work. Task which is sleeping has no more work to do. It's waiting for someone else to wake it up. Scheduler algorithm is simple: from among the tasks which are ready to run, pick the the one with highest priority (lowest numeric value in task's t_prio field), and make its state running . Tasks which are either running or ready to run are kept in linked list g_os_run_list . This list is ordered by priority. Tasks which are sleeping are kept in linked list g_os_sleep_list . Scheduler has a CPU architecture specific component; this code is responsible for swapping in the task which should be running . This process is called context switc
h. During context switching the state of the CPU (e.g. registers) for the currently running task is stored and the new task is swapped in.",
"title": "Description"
},
{
"location": "/os/core_os/context_switch/context_switch/#data-structures",
- "text": "Replace this with the list of data structures used, why, any neat features",
+ "text": "",
"title": "Data structures"
},
{
"location": "/os/core_os/context_switch/context_switch/#list-of-functions",
- "text": "The functions available in context_switch are: os_sched os_sched_ctx_sw_hook os_sched_get_current_task os_sched_insert os_sched_next_task os_sched_os_timer_exp os_sched_resort os_sched_set_current_task os_sched_sleep os_sched_wakeup",
+ "text": "The functions available in context_switch are: os_sched os_arch_ctx_sw os_arch_ctx_sw_isr os_sched_ctx_sw_hook os_sched_get_current_task os_sched_insert os_sched_next_task os_sched_os_timer_exp os_sched_resort os_sched_set_current_task os_sched_sleep os_sched_wakeup",
"title": "List of Functions"
},
{
"location": "/os/core_os/context_switch/os_sched/",
- "text": "",
+ "text": "os_sched \n\n\nvoid os_sched(struct os_task *next_t, int isr)\n\n\n\n\nPerforms context switch if needed. If \nnext_t\n is set, that task will be made \nrunning\n. If \nnext_t\n is NULL, highest priority \nready to run\n is swapped in. This function can be called when new tasks were made \nready to run\n or if the current task is moved to \nsleeping\n state.\n\n\nThis function will call the architecture specific routine to swap in the new task.\n\n\nArguments\n\n\n\n\n\n\n\n\nArguments\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nnext_t\n\n\nPointer to task which must run next (optional)\n\n\n\n\n\n\nisr\n\n\nFlag indicating whether function is called from interrupt handler or not\n\n\n\n\n\n\n\n\nReturned values\n\n\nN/A\n\n\nNotes\n\n\nInterrupts must be disabled when calling this.\n\n\nExample\n\n\n\n\nos_error_t\nos_mutex_release(struct os_mutex *mu)\n{\n ...\n OS_EXIT_CRITICAL(sr);\n\n /* Re-schedule if needed */\n if (resched) {\n os_sched(rdy,
0);\n }\n\n return OS_OK;\n\n}",
"title": "os_sched"
},
{
+ "location": "/os/core_os/context_switch/os_sched/#os_sched",
+ "text": "void os_sched(struct os_task *next_t, int isr) Performs context switch if needed. If next_t is set, that task will be made running . If next_t is NULL, highest priority ready to run is swapped in. This function can be called when new tasks were made ready to run or if the current task is moved to sleeping state. This function will call the architecture specific routine to swap in the new task.",
+ "title": " os_sched "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched/#arguments",
+ "text": "Arguments Description next_t Pointer to task which must run next (optional) isr Flag indicating whether function is called from interrupt handler or not",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched/#returned-values",
+ "text": "N/A",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched/#notes",
+ "text": "Interrupts must be disabled when calling this.",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched/#example",
+ "text": "os_error_t\nos_mutex_release(struct os_mutex *mu)\n{\n ...\n OS_EXIT_CRITICAL(sr);\n\n /* Re-schedule if needed */\n if (resched) {\n os_sched(rdy, 0);\n }\n\n return OS_OK;\n\n}",
+ "title": "Example"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw/",
+ "text": "os_arch_ctx_sw \n\n\nvoid os_arch_ctx_sw(struct os_task *next_t)\n\n\n\n\nChange the state of task pointed by \nnext_t\n to be \nrunning\n.\n\n\nArguments\n\n\n\n\n\n\n\n\nArguments\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nnext_t\n\n\nPointer to task which must run next\n\n\n\n\n\n\n\n\nReturned values\n\n\nN/A\n\n\nNotes\n\n\nThis would get called from another task's context.\n\n\nExample\n\n\n\n\nvoid\nos_sched(struct os_task *next_t, int isr) \n{\n os_sr_t sr;\n\n OS_ENTER_CRITICAL(sr);\n\n if (!next_t) {\n next_t = os_sched_next_task();\n }\n\n if (next_t != g_current_task) {\n OS_EXIT_CRITICAL(sr);\n if (isr) {\n os_arch_ctx_sw_isr(next_t);\n } else {\n os_arch_ctx_sw(next_t);\n }\n\n } else {\n OS_EXIT_CRITICAL(sr);\n }\n}",
+ "title": "os_arch_ctx_sw"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw/#os_arch_ctx_sw",
+ "text": "void os_arch_ctx_sw(struct os_task *next_t) Change the state of task pointed by next_t to be running .",
+ "title": " os_arch_ctx_sw "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw/#arguments",
+ "text": "Arguments Description next_t Pointer to task which must run next",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw/#returned-values",
+ "text": "N/A",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw/#notes",
+ "text": "This would get called from another task's context.",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw/#example",
+ "text": "void\nos_sched(struct os_task *next_t, int isr) \n{\n os_sr_t sr;\n\n OS_ENTER_CRITICAL(sr);\n\n if (!next_t) {\n next_t = os_sched_next_task();\n }\n\n if (next_t != g_current_task) {\n OS_EXIT_CRITICAL(sr);\n if (isr) {\n os_arch_ctx_sw_isr(next_t);\n } else {\n os_arch_ctx_sw(next_t);\n }\n\n } else {\n OS_EXIT_CRITICAL(sr);\n }\n}",
+ "title": "Example"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw_isr/",
+ "text": "os_arch_ctx_sw_isr \n\n\nvoid os_arch_ctx_sw_isr(struct os_task *next_t)\n\n\n\n\nChange the state of task pointed by \nnext_t\n to be \nrunning\n.\n\n\nArguments\n\n\n\n\n\n\n\n\nArguments\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nnext_t\n\n\nPointer to task which must run next\n\n\n\n\n\n\n\n\nReturned values\n\n\nN/A\n\n\nNotes\n\n\nThis would get called from interrupt context.\n\n\nExample\n\n\n\n\nvoid\nos_sched(struct os_task *next_t, int isr) \n{\n os_sr_t sr;\n\n OS_ENTER_CRITICAL(sr);\n\n if (!next_t) {\n next_t = os_sched_next_task();\n }\n\n if (next_t != g_current_task) {\n OS_EXIT_CRITICAL(sr);\n if (isr) {\n os_arch_ctx_sw_isr(next_t);\n } else {\n os_arch_ctx_sw(next_t);\n }\n\n } else {\n OS_EXIT_CRITICAL(sr);\n }\n}",
+ "title": "os_arch_ctx_sw_isr"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw_isr/#os_arch_ctx_sw_isr",
+ "text": "void os_arch_ctx_sw_isr(struct os_task *next_t) Change the state of task pointed by next_t to be running .",
+ "title": " os_arch_ctx_sw_isr "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw_isr/#arguments",
+ "text": "Arguments Description next_t Pointer to task which must run next",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw_isr/#returned-values",
+ "text": "N/A",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw_isr/#notes",
+ "text": "This would get called from interrupt context.",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_arch_ctx_sw_isr/#example",
+ "text": "void\nos_sched(struct os_task *next_t, int isr) \n{\n os_sr_t sr;\n\n OS_ENTER_CRITICAL(sr);\n\n if (!next_t) {\n next_t = os_sched_next_task();\n }\n\n if (next_t != g_current_task) {\n OS_EXIT_CRITICAL(sr);\n if (isr) {\n os_arch_ctx_sw_isr(next_t);\n } else {\n os_arch_ctx_sw(next_t);\n }\n\n } else {\n OS_EXIT_CRITICAL(sr);\n }\n}",
+ "title": "Example"
+ },
+ {
"location": "/os/core_os/context_switch/os_sched_ctx_sw_hook/",
- "text": "",
+ "text": "os_sched_ctx_sw_hook \n\n\nvoid os_sched_ctx_sw_hook(struct os_task *next_t)\n\n\n\n\nPerforms task accounting when context switching.\n\n\nThis function must be called from the architecture specific context switching routines \nos_arch_ctx_sw_isr()\n and \nos_arch_ctx_sw()\n before they resume execution of the \nrunning\n task.\n\n\nArguments\n\n\nN/A\n\n\nReturned values\n\n\nN/A\n\n\nNotes\n\n\nExample\n\n\n\n\nvoid\nos_arch_ctx_sw(struct os_task *t)\n{\n os_sched_ctx_sw_hook(t);\n\n /* Set PendSV interrupt pending bit to force context switch */\n SCB-\nICSR = SCB_ICSR_PENDSVSET_Msk;\n}",
"title": "os_sched_ctx_sw_hook"
},
{
- "location": "/os/core_os/context_switch/os_sched_get_current_task/",
+ "location": "/os/core_os/context_switch/os_sched_ctx_sw_hook/#os_sched_ctx_sw_hook",
+ "text": "void os_sched_ctx_sw_hook(struct os_task *next_t) Performs task accounting when context switching. This function must be called from the architecture specific context switching routines os_arch_ctx_sw_isr() and os_arch_ctx_sw() before they resume execution of the running task.",
+ "title": " os_sched_ctx_sw_hook "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_ctx_sw_hook/#arguments",
+ "text": "N/A",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_ctx_sw_hook/#returned-values",
+ "text": "N/A",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_ctx_sw_hook/#notes",
"text": "",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_ctx_sw_hook/#example",
+ "text": "void\nos_arch_ctx_sw(struct os_task *t)\n{\n os_sched_ctx_sw_hook(t);\n\n /* Set PendSV interrupt pending bit to force context switch */\n SCB- ICSR = SCB_ICSR_PENDSVSET_Msk;\n}",
+ "title": "Example"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_get_current_task/",
+ "text": "os_sched_get_current_task \n\n\nstruct os_task *os_sched_get_current_task(void)\n\n\n\n\nReturns the pointer to task which is currently \nrunning\n.\n\n\nArguments\n\n\nN/A\n\n\nReturned values\n\n\nSee description.\n\n\nNotes\n\n\nExample\n\n\n\n\nvoid\nos_time_delay(int32_t osticks)\n{\n os_sr_t sr;\n\n if (osticks \n 0) {\n OS_ENTER_CRITICAL(sr);\n os_sched_sleep(os_sched_get_current_task(), (os_time_t)osticks);\n OS_EXIT_CRITICAL(sr);\n os_sched(NULL, 0);\n }\n}",
"title": "os_sched_get_current_task"
},
{
- "location": "/os/core_os/context_switch/os_sched_insert/",
+ "location": "/os/core_os/context_switch/os_sched_get_current_task/#os_sched_get_current_task",
+ "text": "struct os_task *os_sched_get_current_task(void) Returns the pointer to task which is currently running .",
+ "title": " os_sched_get_current_task "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_get_current_task/#arguments",
+ "text": "N/A",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_get_current_task/#returned-values",
+ "text": "See description.",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_get_current_task/#notes",
"text": "",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_get_current_task/#example",
+ "text": "void\nos_time_delay(int32_t osticks)\n{\n os_sr_t sr;\n\n if (osticks 0) {\n OS_ENTER_CRITICAL(sr);\n os_sched_sleep(os_sched_get_current_task(), (os_time_t)osticks);\n OS_EXIT_CRITICAL(sr);\n os_sched(NULL, 0);\n }\n}",
+ "title": "Example"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_insert/",
+ "text": "os_sched_insert \n\n\nos_error_t\nos_sched_insert(struct os_task *t)\n\n\n\n\nInsert task into scheduler's \nready to run\n list.\n\n\nArguments\n\n\n\n\n\n\n\n\nArguments\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nt\n\n\nPointer to task\n\n\n\n\n\n\n\n\nReturned values\n\n\nReturns OS_EINVAL if task state is not \nREADY\n.\nReturns 0 on success.\n\n\nNotes\n\n\nYou probably don't need to call this.",
"title": "os_sched_insert"
},
{
+ "location": "/os/core_os/context_switch/os_sched_insert/#os_sched_insert",
+ "text": "os_error_t\nos_sched_insert(struct os_task *t) Insert task into scheduler's ready to run list.",
+ "title": " os_sched_insert "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_insert/#arguments",
+ "text": "Arguments Description t Pointer to task",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_insert/#returned-values",
+ "text": "Returns OS_EINVAL if task state is not READY .\nReturns 0 on success.",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_insert/#notes",
+ "text": "You probably don't need to call this.",
+ "title": "Notes"
+ },
+ {
"location": "/os/core_os/context_switch/os_sched_next_task/",
- "text": "",
+ "text": "os_sched_next_task \n\n\nstruct os_task *os_sched_next_task(void)\n\n\n\n\nReturns the pointer to highest priority task from the list which are \nready to run\n.\n\n\nArguments\n\n\nN/A\n\n\nReturned values\n\n\nSee description.\n\n\nNotes\n\n\nShould be called with interrupts disabled.",
"title": "os_sched_next_task"
},
{
+ "location": "/os/core_os/context_switch/os_sched_next_task/#os_sched_next_task",
+ "text": "struct os_task *os_sched_next_task(void) Returns the pointer to highest priority task from the list which are ready to run .",
+ "title": " os_sched_next_task "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_next_task/#arguments",
+ "text": "N/A",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_next_task/#returned-values",
+ "text": "See description.",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_next_task/#notes",
+ "text": "Should be called with interrupts disabled.",
+ "title": "Notes"
+ },
+ {
"location": "/os/core_os/context_switch/os_sched_os_timer_exp/",
- "text": "",
+ "text": "os_sched_os_timer_exp \n\n\nvoid os_sched_os_timer_exp(void)\n\n\n\n\nInform scheduler that OS time has moved forward, and it should inspect tasks which are \nsleeping\n to check whether they should be moved to \ng_run_list\n or not.\n\n\nThis function should be called from code which handles moving OS time forward. After calling it, the highest priority task which is \nready to run\n might've changed, so call to \nos_sched()\n should be done.\n\n\nArguments\n\n\nN/A\n\n\nReturned values\n\n\nN/A\n\n\nNotes\n\n\nExample\n\n\n\n\nvoid\ntimer_handler(void)\n{\n os_time_tick();\n os_callout_tick();\n os_sched_os_timer_exp();\n os_sched(NULL, 1);\n}",
"title": "os_sched_os_timer_exp"
},
{
- "location": "/os/core_os/context_switch/os_sched_resort/",
+ "location": "/os/core_os/context_switch/os_sched_os_timer_exp/#os_sched_os_timer_exp",
+ "text": "void os_sched_os_timer_exp(void) Inform scheduler that OS time has moved forward, and it should inspect tasks which are sleeping to check whether they should be moved to g_run_list or not. This function should be called from code which handles moving OS time forward. After calling it, the highest priority task which is ready to run might've changed, so call to os_sched() should be done.",
+ "title": " os_sched_os_timer_exp "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_os_timer_exp/#arguments",
+ "text": "N/A",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_os_timer_exp/#returned-values",
+ "text": "N/A",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_os_timer_exp/#notes",
"text": "",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_os_timer_exp/#example",
+ "text": "void\ntimer_handler(void)\n{\n os_time_tick();\n os_callout_tick();\n os_sched_os_timer_exp();\n os_sched(NULL, 1);\n}",
+ "title": "Example"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_resort/",
+ "text": "os_sched_resort \n\n\nvoid os_sched_resort(struct os_task *t)\n\n\n\n\nInform scheduler that the priority of the task \nt\n has changed (e.g. in order to avoid priority inversion), and the \nready to run\n list should be re-sorted.\n\n\nArguments\n\n\n\n\n\n\n\n\nArguments\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nt\n\n\nPointer to a task whose priority has changed\n\n\n\n\n\n\n\n\nReturned values\n\n\nN/A\n\n\nNotes\n\n\nt\n must be \nready to run\n before calling this.\n\n\nExample\n\n\n\n\nos_error_t\nos_mutex_pend(struct os_mutex *mu, uint32_t timeout)\n{\n ....\n /* Change priority of owner if needed */\n if (mu-\nmu_owner-\nt_prio \n current-\nt_prio) {\n mu-\nmu_owner-\nt_prio = current-\nt_prio;\n os_sched_resort(mu-\nmu_owner);\n }\n ....\n}",
"title": "os_sched_resort"
},
{
+ "location": "/os/core_os/context_switch/os_sched_resort/#os_sched_resort",
+ "text": "void os_sched_resort(struct os_task *t) Inform scheduler that the priority of the task t has changed (e.g. in order to avoid priority inversion), and the ready to run list should be re-sorted.",
+ "title": " os_sched_resort "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_resort/#arguments",
+ "text": "Arguments Description t Pointer to a task whose priority has changed",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_resort/#returned-values",
+ "text": "N/A",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_resort/#notes",
+ "text": "t must be ready to run before calling this.",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_resort/#example",
+ "text": "os_error_t\nos_mutex_pend(struct os_mutex *mu, uint32_t timeout)\n{\n ....\n /* Change priority of owner if needed */\n if (mu- mu_owner- t_prio current- t_prio) {\n mu- mu_owner- t_prio = current- t_prio;\n os_sched_resort(mu- mu_owner);\n }\n ....\n}",
+ "title": "Example"
+ },
+ {
"location": "/os/core_os/context_switch/os_sched_set_current_task/",
- "text": "",
+ "text": "os_sched_set_current_task \n\n\nvoid \nos_sched_set_current_task(struct os_task *t)\n\n\n\n\nSets the currently running task to 't'.\n\n\nThis is called from architecture specific context switching code to update scheduler state. Call is made when state of the task 't' is made \nrunning\n.\n\n\nArguments\n\n\n\n\n\n\n\n\nArguments\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nt\n\n\nPointer to a task\n\n\n\n\n\n\n\n\nReturned values\n\n\nN/A\n\n\nNotes\n\n\nThis function simply sets the global variable holding the currently running task. It does not perform a context switch or change the os run or sleep list.",
"title": "os_sched_set_current_task"
},
{
+ "location": "/os/core_os/context_switch/os_sched_set_current_task/#os_sched_set_current_task",
+ "text": "void \nos_sched_set_current_task(struct os_task *t) Sets the currently running task to 't'. This is called from architecture specific context switching code to update scheduler state. Call is made when state of the task 't' is made running .",
+ "title": " os_sched_set_current_task "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_set_current_task/#arguments",
+ "text": "Arguments Description t Pointer to a task",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_set_current_task/#returned-values",
+ "text": "N/A",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_set_current_task/#notes",
+ "text": "This function simply sets the global variable holding the currently running task. It does not perform a context switch or change the os run or sleep list.",
+ "title": "Notes"
+ },
+ {
"location": "/os/core_os/context_switch/os_sched_sleep/",
- "text": "",
+ "text": "os_sched_sleep \n\n\nint\nos_sched_sleep(struct os_task *t, os_time_t nticks)\n\n\n\n\nTask 't' state is changed from \nready to run\n to \nsleeping\n. Sleep time will be specified in \nnticks\n.\n\n\nTask will be woken up after sleep timer expires, unless there are other signals causing it to wake up.\n\n\nIf \nnticks\n is set to \nOS_TIMEOUT_NEVER\n, task never wakes up with a sleep timer.\n\n\nArguments\n\n\n\n\n\n\n\n\nArguments\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nt\n\n\nPointer to task\n\n\n\n\n\n\nnticks\n\n\nNumber of ticks to sleep in OS ticks\n\n\n\n\n\n\n\n\nReturned values\n\n\nReturns 0 on success.\n\n\nNotes\n\n\nMust be called with interrupts disabled.\n\n\nExample\n\n\n\n\nstruct os_event *\nos_eventq_get(struct os_eventq *evq)\n{\n struct os_event *ev;\n os_sr_t sr;\n\n OS_ENTER_CRITICAL(sr);\npull_one:\n ev = STAILQ_FIRST(\nevq-\nevq_list);\n if (ev) {\n STAILQ_REMOVE(\nevq-\nevq_list, ev, os_event, ev_next);\n ev
-\nev_queued = 0;\n } else {\n evq-\nevq_task = os_sched_get_current_task();\n os_sched_sleep(evq-\nevq_task, OS_TIMEOUT_NEVER);\n OS_EXIT_CRITICAL(sr);\n\n os_sched(NULL, 0);\n\n OS_ENTER_CRITICAL(sr);\n evq-\nevq_task = NULL;\n goto pull_one;\n }\n OS_EXIT_CRITICAL(sr);\n\n return (ev);\n}",
"title": "os_sched_sleep"
},
{
+ "location": "/os/core_os/context_switch/os_sched_sleep/#os_sched_sleep",
+ "text": "int\nos_sched_sleep(struct os_task *t, os_time_t nticks) Task 't' state is changed from ready to run to sleeping . Sleep time will be specified in nticks . Task will be woken up after sleep timer expires, unless there are other signals causing it to wake up. If nticks is set to OS_TIMEOUT_NEVER , task never wakes up with a sleep timer.",
+ "title": " os_sched_sleep "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_sleep/#arguments",
+ "text": "Arguments Description t Pointer to task nticks Number of ticks to sleep in OS ticks",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_sleep/#returned-values",
+ "text": "Returns 0 on success.",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_sleep/#notes",
+ "text": "Must be called with interrupts disabled.",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_sleep/#example",
+ "text": "struct os_event *\nos_eventq_get(struct os_eventq *evq)\n{\n struct os_event *ev;\n os_sr_t sr;\n\n OS_ENTER_CRITICAL(sr);\npull_one:\n ev = STAILQ_FIRST( evq- evq_list);\n if (ev) {\n STAILQ_REMOVE( evq- evq_list, ev, os_event, ev_next);\n ev- ev_queued = 0;\n } else {\n evq- evq_task = os_sched_get_current_task();\n os_sched_sleep(evq- evq_task, OS_TIMEOUT_NEVER);\n OS_EXIT_CRITICAL(sr);\n\n os_sched(NULL, 0);\n\n OS_ENTER_CRITICAL(sr);\n evq- evq_task = NULL;\n goto pull_one;\n }\n OS_EXIT_CRITICAL(sr);\n\n return (ev);\n}",
+ "title": "Example"
+ },
+ {
"location": "/os/core_os/context_switch/os_sched_wakeup/",
- "text": "",
+ "text": "os_sched_wakeup \n\n\nint\nos_sched_wakeup(struct os_task *t)\n\n\n\n\nCalled to make task \nready to run\n. If task is \nsleeping\n, it is woken up.\n\n\nArguments\n\n\n\n\n\n\n\n\nArguments\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nt\n\n\nPointer to task\n\n\n\n\n\n\n\n\nReturned values\n\n\nReturns 0 on success.\n\n\nNotes\n\n\nExample\n\n\n\n\nvoid\nos_eventq_put2(struct os_eventq *evq, struct os_event *ev, int isr)\n{\n ....\n /* If task waiting on event, wake it up. */\n resched = 0;\n if (evq-\nevq_task) {\n os_sched_wakeup(evq-\nevq_task);\n evq-\nevq_task = NULL;\n resched = 1;\n }\n ....\n}",
"title": "os_sched_wakeup"
},
{
+ "location": "/os/core_os/context_switch/os_sched_wakeup/#os_sched_wakeup",
+ "text": "int\nos_sched_wakeup(struct os_task *t) Called to make task ready to run . If task is sleeping , it is woken up.",
+ "title": " os_sched_wakeup "
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_wakeup/#arguments",
+ "text": "Arguments Description t Pointer to task",
+ "title": "Arguments"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_wakeup/#returned-values",
+ "text": "Returns 0 on success.",
+ "title": "Returned values"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_wakeup/#notes",
+ "text": "",
+ "title": "Notes"
+ },
+ {
+ "location": "/os/core_os/context_switch/os_sched_wakeup/#example",
+ "text": "void\nos_eventq_put2(struct os_eventq *evq, struct os_event *ev, int isr)\n{\n ....\n /* If task waiting on event, wake it up. */\n resched = 0;\n if (evq- evq_task) {\n os_sched_wakeup(evq- evq_task);\n evq- evq_task = NULL;\n resched = 1;\n }\n ....\n}",
+ "title": "Example"
+ },
+ {
"location": "/os/core_os/time/os_time/",
"text": "OS_Time\n\n\nThe system time for ther Mynewt OS.\n\n\nDescription\n\n\nThe Mynewt OS contains an incrementing time that drives the OS scheduler and time delays. The time is a fixed size (e.g. 32 bits) and will eventually wrap back to zero. The time to wrap from zero back to zero is called the \nOS time epoch\n. \n\n\nThe frequency of the OS time tick is specified in the architecture-specific OS code \nos_arch.h\n and is named \nOS_TICKS_PER_SEC\n.\n\n\nData Structures\n\n\nTime is stored in Mynewt as an \nos_time_t\n value. \n\n\nList of Functions\n\n\nThe functions available in time are:\n\n\n\n\nos_time_delay\n\n\nos_time_get\n\n\nos_time_tick\n\n\n\n\nList of Macros\n\n\nSeveral macros help with the evalution of times with respect to each other.\n\n\n\n\nOS_TIME_TICK_LT(t1,t2)\n -- evaluates to true if t1 is before t2 in time.\n\n\nOS_TIME_TICK_GT(t1,t2)\n -- evaluates to true if t1 is after t2 in time \n\n\nOS_TIME_TICK_GEQ(t1,t2)\n -- evaluates to true if t
1 is on or after t2 in time.\n\n\n\n\nNOTE: For all of these macros the calculations are done modulo 'os_time_t'. \n\n\nEnsure that comparison of OS time always uses the macros above (to compensate for the possible wrap of OS time)\n\n\nSpecial Notes\n\n\nIts important to understand how quickly the time wraps especially when doing time comparison using the macros above (or by any other means). \n\n\nFor example, if a tick is 1 millisecond and \nos_time_t\n is 32-bits the OS time will wrap back to zero in about 49.7 days or stated another way, the OS time epoch is 49.7 days.\n\n\nIf two times are more than 1/2 the OS time epoch apart, any time comparison will be incorrect. Ensure at design time that comparisons will not occur between times that are more than half the OS time epoch.",
"title": "Overview"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/context_switch/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/context_switch/index.html b/os/core_os/context_switch/context_switch/index.html
index 49068a1..7a823e9 100644
--- a/os/core_os/context_switch/context_switch/index.html
+++ b/os/core_os/context_switch/context_switch/index.html
@@ -469,15 +469,23 @@
</div>
<h1 id="schedulercontext-switching">Scheduler/Context Switching<a class="headerlink" href="#schedulercontext-switching" title="Permanent link">¶</a></h1>
-<p>Insert synopsis here</p>
+<p>Scheduler's job is to maintain the list of tasks and decide which one should be running next.</p>
<h2 id="description">Description<a class="headerlink" href="#description" title="Permanent link">¶</a></h2>
-<p>Describe scheduler here</p>
+<p>Task states can be <em>running</em>, <em>ready to run</em> or <em>sleeping</em>.</p>
+<p>When task is <em>running</em>, CPU is executing in that task's context. The program counter (PC) is pointing to instructions task wants to execute and stack pointer (SP) is pointing to task's stack.</p>
+<p>Task which is <em>ready to run</em> wants to get on the CPU to do its work.</p>
+<p>Task which is <em>sleeping</em> has no more work to do. It's waiting for someone else to wake it up.</p>
+<p>Scheduler algorithm is simple: from among the tasks which are ready to run, pick the the one with highest priority (lowest numeric value in task's t_prio field), and make its state <em>running</em>.</p>
+<p>Tasks which are either <em>running</em> or <em>ready to run</em> are kept in linked list <code>g_os_run_list</code>. This list is ordered by priority.</p>
+<p>Tasks which are <em>sleeping</em> are kept in linked list <code>g_os_sleep_list</code>.</p>
+<p>Scheduler has a CPU architecture specific component; this code is responsible for swapping in the task which should be <em>running</em>. This process is called context switch. During context switching the state of the CPU (e.g. registers) for the currently <em>running</em> task is stored and the new task is swapped in.</p>
<h2 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">¶</a></h2>
-<p>Replace this with the list of data structures used, why, any neat features</p>
<h2 id="list-of-functions">List of Functions<a class="headerlink" href="#list-of-functions" title="Permanent link">¶</a></h2>
<p>The functions available in context_switch are:</p>
<ul>
<li><a href="../os_sched/">os_sched</a></li>
+<li><a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a></li>
+<li><a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a></li>
<li><a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a></li>
<li><a href="../os_sched_get_current_task/">os_sched_get_current_task</a></li>
<li><a href="../os_sched_insert/">os_sched_insert</a></li>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_arch_ctx_sw/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_arch_ctx_sw/index.html b/os/core_os/context_switch/os_arch_ctx_sw/index.html
new file mode 100644
index 0000000..caf1b23
--- /dev/null
+++ b/os/core_os/context_switch/os_arch_ctx_sw/index.html
@@ -0,0 +1,664 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/core_os/context_switch/os_arch_ctx_sw/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>os_arch_ctx_sw - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.css" rel="stylesheet">
+ <link rel="stylesheet" href="../../../../css/highlight.css">
+ <link href="../../../../css/base.css" rel="stylesheet">
+ <link href="../../../../css/custom.css" rel="stylesheet">
+ <link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+
+
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-72162311-1', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="os_arch_ctx_sw">
+
+
+ <div class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- Collapsed navigation -->
+ <div class="navbar-header">
+ <!-- Expander button -->
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+
+ </div>
+
+ <!-- Expanded navigation -->
+ <div class="navbar-collapse collapse">
+ <!-- Main navigation -->
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/documentation/">Docs</a>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../get_started/introduction/
+">Apache Mynewt Manual</a>
+
+ <ul class="current-toc">
+
+
+
+ <li>
+ <a href="../../../get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+ <li><a href="
+ ../../../get_started/project1/
+">Get Started</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../get_acclimated/project2/
+">Tutorials</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+
+
+
+
+ ../../mynewt_os/
+
+
+">Manual</a>
+
+ <ul class="current-toc">
+
+
+
+ <li><a href="
+
+
+ ../../mynewt_os/
+
+">OS Core</a>
+
+ <ul class="current-toc">
+
+
+
+ <li><a href="
+ ../../mynewt_os/
+">OS Fundamentals</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../context_switch/
+">Scheduler</a>
+
+ <ul class="current-toc">
+
+
+
+ <li>
+ <a href="../context_switch/">Overview</a>
+ </li>
+
+
+
+
+
+ <li><a href="
+ ../os_sched/
+">Functions</a>
+
+ <ul class="current-toc">
+
+
+
+ <li>
+ <a href="../os_sched/">os_sched</a>
+ </li>
+
+
+
+
+
+ <li class="active">
+ os_arch_ctx_sw
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_get_current_task/">os_sched_get_current_task</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_insert/">os_sched_insert</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_next_task/">os_sched_next_task</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_os_timer_exp/">os_sched_os_timer_exp</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_resort/">os_sched_resort</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_set_current_task/">os_sched_set_current_task</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_sleep/">os_sched_sleep</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_wakeup/">os_sched_wakeup</a>
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+ </ul>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../time/os_time/
+">Time</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../task/task/
+">Tasks</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../event_queue/event_queue/
+">Event Queues</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../semaphore/semaphore/
+">Semaphores</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../mutex/mutex/
+">Mutexes</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../memory_pool/memory_pool/
+">Memory Pools</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../heap/heap/
+">Heap</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../mbuf/mbuf/
+">Mbufs</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../sanity/sanity/
+">Sanity</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../callout/callout/
+">Callouts</a>
+
+ </li>
+
+
+
+
+ <li>
+ <a href="../../port_os/">Porting to other Platforms</a>
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/console/console/
+">Console</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/shell/shell/
+">Shell</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/bootloader/bootloader/
+">Bootloader</a>
+
+ </li>
+
+
+
+
+ <li>
+ <a href="../../../modules/filesystem/">File System Abstraction</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../../../modules/nffs/">Newtron Flash File System</a>
+ </li>
+
+
+
+
+
+ <li><a href="
+ ../../../modules/testutil/testutil/
+">Test Utilities</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/imgmgr/imgmgr/
+">Image Manager</a>
+
+ </li>
+
+
+
+
+ <li>
+ <a href="../../../modules/baselibc/">Baselibc library</a>
+ </li>
+
+
+
+
+
+ <li><a href="
+ ../../../modules/elua/elua/
+">Embedded Lua</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/json/json/
+">JSON</a>
+
+ </li>
+
+
+ </ul>
+
+ </li>
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+ </li>
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-9 documentation-viewer" role="main">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="../../../..">Docs</a> »</li>
+
+
+
+ <li>Scheduler »</li>
+
+
+
+ <li>Functions »</li>
+
+
+
+ <li>os_arch_ctx_sw</li>
+ <li class="wy-breadcrumbs-aside">
+
+ </li>
+ </ul>
+ <hr/>
+</div>
+
+ <h2 id="os_arch_ctx_sw"><font color="#F2853F" style="font-size:24pt"> os_arch_ctx_sw </font><a class="headerlink" href="#os_arch_ctx_sw" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">void os_arch_ctx_sw(struct os_task *next_t)
+</code></pre>
+
+<p>Change the state of task pointed by <em>next_t</em> to be <em>running</em>.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<table>
+<thead>
+<tr>
+<th>Arguments</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>next_t</td>
+<td>Pointer to task which must run next</td>
+</tr>
+</tbody>
+</table>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<p>This would get called from another task's context.</p>
+<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h4>
+<p><Add text to set up the context for the example here></p>
+<pre><code class="no-highlight">void
+os_sched(struct os_task *next_t, int isr)
+{
+ os_sr_t sr;
+
+ OS_ENTER_CRITICAL(sr);
+
+ if (!next_t) {
+ next_t = os_sched_next_task();
+ }
+
+ if (next_t != g_current_task) {
+ OS_EXIT_CRITICAL(sr);
+ if (isr) {
+ os_arch_ctx_sw_isr(next_t);
+ } else {
+ os_arch_ctx_sw(next_t);
+ }
+
+ } else {
+ OS_EXIT_CRITICAL(sr);
+ }
+}
+</code></pre>
+
+<hr />
+
+ </div>
+ </div>
+
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </div>
+
+ <script src="../../../../js/jquery-1.10.2.min.js"></script>
+ <script src="../../../../js/bootstrap-3.0.3.min.js"></script>
+ <script src="../../../../js/highlight.pack.js"></script>
+ <script src="../../../../js/base.js"></script>
+ <script src="../../../../js/custom.js"></script>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_arch_ctx_sw_isr/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_arch_ctx_sw_isr/index.html b/os/core_os/context_switch/os_arch_ctx_sw_isr/index.html
new file mode 100644
index 0000000..f60fdf7
--- /dev/null
+++ b/os/core_os/context_switch/os_arch_ctx_sw_isr/index.html
@@ -0,0 +1,664 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/core_os/context_switch/os_arch_ctx_sw_isr/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>os_arch_ctx_sw_isr - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.css" rel="stylesheet">
+ <link rel="stylesheet" href="../../../../css/highlight.css">
+ <link href="../../../../css/base.css" rel="stylesheet">
+ <link href="../../../../css/custom.css" rel="stylesheet">
+ <link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+
+
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-72162311-1', 'mynewt.incubator.apache.org');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="os_arch_ctx_sw_isr">
+
+
+ <div class="navbar navbar-default navbar-fixed-top" role="navigation">
+ <div class="logo-container">
+ <img src="/img/logo.svg">
+ </div>
+ <div class="container-fluid">
+ <!-- Collapsed navigation -->
+ <div class="navbar-header">
+ <!-- Expander button -->
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+
+ </div>
+
+ <!-- Expanded navigation -->
+ <div class="navbar-collapse collapse">
+ <!-- Main navigation -->
+ <ul class="nav navbar-nav navbar-right">
+ <li>
+ <a href="/">Home</a>
+ </li>
+ <li>
+ <a href="/documentation/">Docs</a>
+ </li>
+ <li>
+ <a href="/download/">Download</a>
+ </li>
+ <li>
+ <a href="/community/">Community</a>
+ </li>
+ <li>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</div>
+
+ <div class="container-fluid">
+
+ <div class="row sm-extra-padding">
+ <div class="col-md-3 bg-grey sidebar-container"><div class="bs-sidebar hidden-print" role="complementary">
+ <div class="sidebar-top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div class="small" role="search">
+ <form id ="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" placeholder="Search documentation" />
+ <button class="search-button" type="submit"><i class="fa fa-search"></i></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="nav bs-sidenav">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../get_started/introduction/
+">Apache Mynewt Manual</a>
+
+ <ul class="current-toc">
+
+
+
+ <li>
+ <a href="../../../get_started/introduction/">Introduction</a>
+ </li>
+
+
+
+
+
+ <li><a href="
+ ../../../get_started/project1/
+">Get Started</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../get_acclimated/project2/
+">Tutorials</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+
+
+
+
+ ../../mynewt_os/
+
+
+">Manual</a>
+
+ <ul class="current-toc">
+
+
+
+ <li><a href="
+
+
+ ../../mynewt_os/
+
+">OS Core</a>
+
+ <ul class="current-toc">
+
+
+
+ <li><a href="
+ ../../mynewt_os/
+">OS Fundamentals</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../context_switch/
+">Scheduler</a>
+
+ <ul class="current-toc">
+
+
+
+ <li>
+ <a href="../context_switch/">Overview</a>
+ </li>
+
+
+
+
+
+ <li><a href="
+ ../os_sched/
+">Functions</a>
+
+ <ul class="current-toc">
+
+
+
+ <li>
+ <a href="../os_sched/">os_sched</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li class="active">
+ os_arch_ctx_sw_isr
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_get_current_task/">os_sched_get_current_task</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_insert/">os_sched_insert</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_next_task/">os_sched_next_task</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_os_timer_exp/">os_sched_os_timer_exp</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_resort/">os_sched_resort</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_set_current_task/">os_sched_set_current_task</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_sleep/">os_sched_sleep</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_sched_wakeup/">os_sched_wakeup</a>
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+ </ul>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../time/os_time/
+">Time</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../task/task/
+">Tasks</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../event_queue/event_queue/
+">Event Queues</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../semaphore/semaphore/
+">Semaphores</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../mutex/mutex/
+">Mutexes</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../memory_pool/memory_pool/
+">Memory Pools</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../heap/heap/
+">Heap</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../mbuf/mbuf/
+">Mbufs</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../sanity/sanity/
+">Sanity</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../callout/callout/
+">Callouts</a>
+
+ </li>
+
+
+
+
+ <li>
+ <a href="../../port_os/">Porting to other Platforms</a>
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/console/console/
+">Console</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/shell/shell/
+">Shell</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/bootloader/bootloader/
+">Bootloader</a>
+
+ </li>
+
+
+
+
+ <li>
+ <a href="../../../modules/filesystem/">File System Abstraction</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../../../modules/nffs/">Newtron Flash File System</a>
+ </li>
+
+
+
+
+
+ <li><a href="
+ ../../../modules/testutil/testutil/
+">Test Utilities</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/imgmgr/imgmgr/
+">Image Manager</a>
+
+ </li>
+
+
+
+
+ <li>
+ <a href="../../../modules/baselibc/">Baselibc library</a>
+ </li>
+
+
+
+
+
+ <li><a href="
+ ../../../modules/elua/elua/
+">Embedded Lua</a>
+
+ </li>
+
+
+
+
+ <li><a href="
+ ../../../modules/json/json/
+">JSON</a>
+
+ </li>
+
+
+ </ul>
+
+ </li>
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newt/newt_intro/
+">Newt Tool Manual</a>
+
+ </li>
+
+
+
+
+
+
+ <li><a href="
+ ../../../../newtmgr/overview/
+">Newt Manager Manual</a>
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-9 documentation-viewer" role="main">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="../../../..">Docs</a> »</li>
+
+
+
+ <li>Scheduler »</li>
+
+
+
+ <li>Functions »</li>
+
+
+
+ <li>os_arch_ctx_sw_isr</li>
+ <li class="wy-breadcrumbs-aside">
+
+ </li>
+ </ul>
+ <hr/>
+</div>
+
+ <h2 id="os_arch_ctx_sw_isr"><font color="#F2853F" style="font-size:24pt"> os_arch_ctx_sw_isr </font><a class="headerlink" href="#os_arch_ctx_sw_isr" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">void os_arch_ctx_sw_isr(struct os_task *next_t)
+</code></pre>
+
+<p>Change the state of task pointed by <em>next_t</em> to be <em>running</em>.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<table>
+<thead>
+<tr>
+<th>Arguments</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>next_t</td>
+<td>Pointer to task which must run next</td>
+</tr>
+</tbody>
+</table>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<p>This would get called from interrupt context.</p>
+<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h4>
+<p><Add text to set up the context for the example here></p>
+<pre><code class="no-highlight">void
+os_sched(struct os_task *next_t, int isr)
+{
+ os_sr_t sr;
+
+ OS_ENTER_CRITICAL(sr);
+
+ if (!next_t) {
+ next_t = os_sched_next_task();
+ }
+
+ if (next_t != g_current_task) {
+ OS_EXIT_CRITICAL(sr);
+ if (isr) {
+ os_arch_ctx_sw_isr(next_t);
+ } else {
+ os_arch_ctx_sw(next_t);
+ }
+
+ } else {
+ OS_EXIT_CRITICAL(sr);
+ }
+}
+</code></pre>
+
+<hr />
+
+ </div>
+ </div>
+
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </div>
+
+ <script src="../../../../js/jquery-1.10.2.min.js"></script>
+ <script src="../../../../js/bootstrap-3.0.3.min.js"></script>
+ <script src="../../../../js/highlight.pack.js"></script>
+ <script src="../../../../js/base.js"></script>
+ <script src="../../../../js/custom.js"></script>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_sched/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched/index.html b/os/core_os/context_switch/os_sched/index.html
index 6d95971..a936e67 100644
--- a/os/core_os/context_switch/os_sched/index.html
+++ b/os/core_os/context_switch/os_sched/index.html
@@ -220,6 +220,22 @@
<li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
+ <li>
<a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
</li>
@@ -552,7 +568,54 @@
<hr/>
</div>
-
+ <h2 id="os_sched"><font color="#F2853F" style="font-size:24pt"> os_sched </font><a class="headerlink" href="#os_sched" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">void os_sched(struct os_task *next_t, int isr)
+</code></pre>
+
+<p>Performs context switch if needed. If <em>next_t</em> is set, that task will be made <em>running</em>. If <em>next_t</em> is NULL, highest priority <em>ready to run</em> is swapped in. This function can be called when new tasks were made <em>ready to run</em> or if the current task is moved to <em>sleeping</em> state.</p>
+<p>This function will call the architecture specific routine to swap in the new task.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<table>
+<thead>
+<tr>
+<th>Arguments</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>next_t</td>
+<td>Pointer to task which must run next (optional)</td>
+</tr>
+<tr>
+<td>isr</td>
+<td>Flag indicating whether function is called from interrupt handler or not</td>
+</tr>
+</tbody>
+</table>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<p>Interrupts must be disabled when calling this.</p>
+<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h4>
+<p><Add text to set up the context for the example here></p>
+<pre><code class="no-highlight">os_error_t
+os_mutex_release(struct os_mutex *mu)
+{
+ ...
+ OS_EXIT_CRITICAL(sr);
+
+ /* Re-schedule if needed */
+ if (resched) {
+ os_sched(rdy, 0);
+ }
+
+ return OS_OK;
+
+}
+</code></pre>
+
+<hr />
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html b/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html
index 0132864..4935d02 100644
--- a/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html
+++ b/os/core_os/context_switch/os_sched_ctx_sw_hook/index.html
@@ -219,6 +219,22 @@
+ <li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
<li class="active">
os_sched_ctx_sw_hook
</li>
@@ -552,7 +568,30 @@
<hr/>
</div>
-
+ <h2 id="os_sched_ctx_sw_hook"><font color="#F2853F" style="font-size:24pt"> os_sched_ctx_sw_hook </font><a class="headerlink" href="#os_sched_ctx_sw_hook" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">void os_sched_ctx_sw_hook(struct os_task *next_t)
+</code></pre>
+
+<p>Performs task accounting when context switching.</p>
+<p>This function must be called from the architecture specific context switching routines <em>os_arch_ctx_sw_isr()</em> and <em>os_arch_ctx_sw()</em> before they resume execution of the <em>running</em> task.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h4>
+<p><Add text to set up the context for the example here></p>
+<pre><code class="no-highlight">void
+os_arch_ctx_sw(struct os_task *t)
+{
+ os_sched_ctx_sw_hook(t);
+
+ /* Set PendSV interrupt pending bit to force context switch */
+ SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
+}
+</code></pre>
+
+<hr />
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_sched_get_current_task/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_get_current_task/index.html b/os/core_os/context_switch/os_sched_get_current_task/index.html
index 296dd3a..cd84f2d 100644
--- a/os/core_os/context_switch/os_sched_get_current_task/index.html
+++ b/os/core_os/context_switch/os_sched_get_current_task/index.html
@@ -220,6 +220,22 @@
<li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
+ <li>
<a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
</li>
@@ -552,7 +568,33 @@
<hr/>
</div>
-
+ <h2 id="os_sched_get_current_task"><font color="#F2853F" style="font-size:24pt"> os_sched_get_current_task </font><a class="headerlink" href="#os_sched_get_current_task" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">struct os_task *os_sched_get_current_task(void)
+</code></pre>
+
+<p>Returns the pointer to task which is currently <em>running</em>.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>See description.</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h4>
+<p><Add text to set up the context for the example here></p>
+<pre><code class="no-highlight">void
+os_time_delay(int32_t osticks)
+{
+ os_sr_t sr;
+
+ if (osticks > 0) {
+ OS_ENTER_CRITICAL(sr);
+ os_sched_sleep(os_sched_get_current_task(), (os_time_t)osticks);
+ OS_EXIT_CRITICAL(sr);
+ os_sched(NULL, 0);
+ }
+}
+</code></pre>
+
+<hr />
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_sched_insert/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_insert/index.html b/os/core_os/context_switch/os_sched_insert/index.html
index 7b75685..938639d 100644
--- a/os/core_os/context_switch/os_sched_insert/index.html
+++ b/os/core_os/context_switch/os_sched_insert/index.html
@@ -220,6 +220,22 @@
<li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
+ <li>
<a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
</li>
@@ -552,7 +568,33 @@
<hr/>
</div>
-
+ <h2 id="os_sched_insert"><font color="#F2853F" style="font-size:24pt"> os_sched_insert </font><a class="headerlink" href="#os_sched_insert" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">os_error_t
+os_sched_insert(struct os_task *t)
+</code></pre>
+
+<p>Insert task into scheduler's <em>ready to run</em> list.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<table>
+<thead>
+<tr>
+<th>Arguments</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>t</td>
+<td>Pointer to task</td>
+</tr>
+</tbody>
+</table>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>Returns OS_EINVAL if task state is not <em>READY</em>.
+Returns 0 on success.</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<p>You probably don't need to call this.</p>
+<hr />
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_sched_next_task/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_next_task/index.html b/os/core_os/context_switch/os_sched_next_task/index.html
index 1b34440..031ee5b 100644
--- a/os/core_os/context_switch/os_sched_next_task/index.html
+++ b/os/core_os/context_switch/os_sched_next_task/index.html
@@ -220,6 +220,22 @@
<li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
+ <li>
<a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
</li>
@@ -552,7 +568,18 @@
<hr/>
</div>
-
+ <h2 id="os_sched_next_task"><font color="#F2853F" style="font-size:24pt"> os_sched_next_task </font><a class="headerlink" href="#os_sched_next_task" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">struct os_task *os_sched_next_task(void)
+</code></pre>
+
+<p>Returns the pointer to highest priority task from the list which are <em>ready to run</em>.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>See description.</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<p>Should be called with interrupts disabled.</p>
+<hr />
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_sched_os_timer_exp/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_os_timer_exp/index.html b/os/core_os/context_switch/os_sched_os_timer_exp/index.html
index 1e642cb..40e1a8c 100644
--- a/os/core_os/context_switch/os_sched_os_timer_exp/index.html
+++ b/os/core_os/context_switch/os_sched_os_timer_exp/index.html
@@ -220,6 +220,22 @@
<li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
+ <li>
<a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
</li>
@@ -552,7 +568,30 @@
<hr/>
</div>
-
+ <h2 id="os_sched_os_timer_exp"><font color="#F2853F" style="font-size:24pt"> os_sched_os_timer_exp </font><a class="headerlink" href="#os_sched_os_timer_exp" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">void os_sched_os_timer_exp(void)
+</code></pre>
+
+<p>Inform scheduler that OS time has moved forward, and it should inspect tasks which are <em>sleeping</em> to check whether they should be moved to <em>g_run_list</em> or not.</p>
+<p>This function should be called from code which handles moving OS time forward. After calling it, the highest priority task which is <em>ready to run</em> might've changed, so call to <em>os_sched()</em> should be done.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h4>
+<p><Add text to set up the context for the example here></p>
+<pre><code class="no-highlight">void
+timer_handler(void)
+{
+ os_time_tick();
+ os_callout_tick();
+ os_sched_os_timer_exp();
+ os_sched(NULL, 1);
+}
+</code></pre>
+
+<hr />
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_sched_resort/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_resort/index.html b/os/core_os/context_switch/os_sched_resort/index.html
index 50a5ae2..d0bf3f8 100644
--- a/os/core_os/context_switch/os_sched_resort/index.html
+++ b/os/core_os/context_switch/os_sched_resort/index.html
@@ -220,6 +220,22 @@
<li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
+ <li>
<a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
</li>
@@ -552,7 +568,46 @@
<hr/>
</div>
-
+ <h2 id="os_sched_resort"><font color="#F2853F" style="font-size:24pt"> os_sched_resort </font><a class="headerlink" href="#os_sched_resort" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">void os_sched_resort(struct os_task *t)
+</code></pre>
+
+<p>Inform scheduler that the priority of the task <em>t</em> has changed (e.g. in order to avoid priority inversion), and the <em>ready to run</em> list should be re-sorted.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<table>
+<thead>
+<tr>
+<th>Arguments</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>t</td>
+<td>Pointer to a task whose priority has changed</td>
+</tr>
+</tbody>
+</table>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<p><em>t</em> must be <em>ready to run</em> before calling this.</p>
+<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">¶</a></h4>
+<p><Add text to set up the context for the example here></p>
+<pre><code class="no-highlight">os_error_t
+os_mutex_pend(struct os_mutex *mu, uint32_t timeout)
+{
+ ....
+ /* Change priority of owner if needed */
+ if (mu->mu_owner->t_prio > current->t_prio) {
+ mu->mu_owner->t_prio = current->t_prio;
+ os_sched_resort(mu->mu_owner);
+ }
+ ....
+}
+</code></pre>
+
+<hr />
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/284e6030/os/core_os/context_switch/os_sched_set_current_task/index.html
----------------------------------------------------------------------
diff --git a/os/core_os/context_switch/os_sched_set_current_task/index.html b/os/core_os/context_switch/os_sched_set_current_task/index.html
index 2a36e15..0fb77dc 100644
--- a/os/core_os/context_switch/os_sched_set_current_task/index.html
+++ b/os/core_os/context_switch/os_sched_set_current_task/index.html
@@ -220,6 +220,22 @@
<li>
+ <a href="../os_arch_ctx_sw/">os_arch_ctx_sw</a>
+ </li>
+
+
+
+
+
+ <li>
+ <a href="../os_arch_ctx_sw_isr/">os_arch_ctx_sw_isr</a>
+ </li>
+
+
+
+
+
+ <li>
<a href="../os_sched_ctx_sw_hook/">os_sched_ctx_sw_hook</a>
</li>
@@ -552,7 +568,33 @@
<hr/>
</div>
-
+ <h2 id="os_sched_set_current_task"><font color="#F2853F" style="font-size:24pt"> os_sched_set_current_task </font><a class="headerlink" href="#os_sched_set_current_task" title="Permanent link">¶</a></h2>
+<pre><code class="no-highlight">void
+os_sched_set_current_task(struct os_task *t)
+</code></pre>
+
+<p>Sets the currently running task to 't'.</p>
+<p>This is called from architecture specific context switching code to update scheduler state. Call is made when state of the task 't' is made <em>running</em>.</p>
+<h4 id="arguments">Arguments<a class="headerlink" href="#arguments" title="Permanent link">¶</a></h4>
+<table>
+<thead>
+<tr>
+<th>Arguments</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>t</td>
+<td>Pointer to a task</td>
+</tr>
+</tbody>
+</table>
+<h4 id="returned-values">Returned values<a class="headerlink" href="#returned-values" title="Permanent link">¶</a></h4>
+<p>N/A</p>
+<h4 id="notes">Notes<a class="headerlink" href="#notes" title="Permanent link">¶</a></h4>
+<p>This function simply sets the global variable holding the currently running task. It does not perform a context switch or change the os run or sleep list.</p>
+<hr />
</div>
</div>