aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-12-30 18:08:30 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-12-30 18:08:30 +0000
commit3c101f29013c71f6a786f9ac7bdbf29499c47cbb (patch)
tree9264123e325ad43f6e89e8a8847198b061372d66
parente04e6ada046db4f8a8de0b9895af4dca51a36f8d (diff)
downloadChibiOS-3c101f29013c71f6a786f9ac7bdbf29499c47cbb.tar.gz
ChibiOS-3c101f29013c71f6a786f9ac7bdbf29499c47cbb.tar.bz2
ChibiOS-3c101f29013c71f6a786f9ac7bdbf29499c47cbb.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@566 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--docs/ch.txt23
-rw-r--r--docs/img/readylist.pngbin7883 -> 11862 bytes
-rw-r--r--docs/img/readylist.svg65
-rw-r--r--docs/img/workspace.pngbin14430 -> 20285 bytes
-rw-r--r--docs/img/workspace.svg84
-rw-r--r--src/templates/chcore.c9
-rw-r--r--src/templates/chcore.h18
7 files changed, 137 insertions, 62 deletions
diff --git a/docs/ch.txt b/docs/ch.txt
index 71ef8140e..c39153807 100644
--- a/docs/ch.txt
+++ b/docs/ch.txt
@@ -79,7 +79,7 @@
* priority is executed. If more than one thread with equal priority are
* eligible for execution then they are executed in a round-robin way, the
* CPU time slice constant is configurable. The ready list is a double linked
- * list of threads ordered by priority.
+ * list of threads ordered by priority.<br><br>
* @image html readylist.png
* Note that the currently running thread is not in the ready list, the list
* only contains the threads ready to be executed but still actually waiting.
@@ -89,19 +89,26 @@
* @image html states.png
*
* @section warea Thread Working Area
- * Each thread has its own stack, a Thread structure and a registers dump
- * structure. All the structures are allocated into a "Thread working area",
+ * Each thread has its own stack, a Thread structure and some preemption
+ * areas. All the structures are allocated into a "Thread working area",
* a thread private heap, usually allocated in a char array declared in your
* code, there is not a central threads table or list, this means you can
* have as many threads you want as long you have enough available RAM
* memory. The threads do not use any memory outside the allocated working
- * area.<br>
+ * area.<br><br>
* @image html workspace.png
* <br>
- * Note that the registers dump is only present when the Thread is not
- * running, the context switching is done by pushing the registers on the
- * stack of the switched-out thread and popping the registers of the
- * switched-in thread from its stack.
+ * Note that the preemption areas only present when the Thread is not
+ * running (switched out), the context switching is done by pushing the
+ * registers on the stack of the switched-out thread and popping the registers
+ * of the switched-in thread from its stack.
+ * The preemption areas can be divided in up to three structures:
+ * - External Context.
+ * - Interrupt Stack.
+ * - Internal Context.
+ *
+ * See the @ref Core documentation for details, the areas may change on
+ * the various ports and some structures may not be present (or be zero-sized).
*
* @section sysmutex System Mutex Zone
* It is the code within the OS that cannot be preempted, this code is
diff --git a/docs/img/readylist.png b/docs/img/readylist.png
index 4d852388f..a7a8adb57 100644
--- a/docs/img/readylist.png
+++ b/docs/img/readylist.png
Binary files differ
diff --git a/docs/img/readylist.svg b/docs/img/readylist.svg
index a82bdbc79..d1b41741a 100644
--- a/docs/img/readylist.svg
+++ b/docs/img/readylist.svg
@@ -15,10 +15,10 @@
sodipodi:version="0.32"
inkscape:version="0.45.1"
version="1.0"
- sodipodi:docbase="C:\Progetti\ChibiOS\homepage"
+ sodipodi:docbase="D:\Progetti\ChibiOS-RT\docs\img"
sodipodi:docname="readylist.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
- inkscape:export-filename="C:\Progetti\ChibiOS\homepage\readylist.png"
+ inkscape:export-filename="D:\Progetti\ChibiOS-RT\docs\img\readylist.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
@@ -92,7 +92,7 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.515"
- inkscape:cx="300"
+ inkscape:cx="306.4941"
inkscape:cy="100"
inkscape:document-units="px"
inkscape:current-layer="layer1"
@@ -128,7 +128,7 @@
id="layer1">
<g
id="g3209"
- transform="translate(-49.968987,0.5)">
+ transform="translate(-46.668657,15)">
<rect
y="75.531006"
x="180.5"
@@ -154,11 +154,11 @@
height="17.601761"
width="37.953796"
id="rect3221" /></flowRegion><flowPara
- id="flowPara3223">127</flowPara></flowRoot> </g>
+ id="flowPara3223">63</flowPara></flowRoot> </g>
<flowRoot
xml:space="preserve"
id="flowRoot3188"
- transform="translate(2.3476563,-323.87454)"><flowRegion
+ transform="translate(10.05033,-293.30812)"><flowRegion
id="flowRegion3190"><rect
id="rect3192"
width="207.01047"
@@ -181,7 +181,7 @@
id="flowPara3214"
style="fill:url(#linearGradient3230);fill-opacity:1">Thread Structure</flowPara></flowRoot> <g
id="g5453"
- transform="translate(-169.96899,0.5)">
+ transform="translate(-166.66866,15)">
<rect
y="75.531006"
x="180.5"
@@ -207,10 +207,10 @@
height="17.601761"
width="37.953796"
id="rect5449" /></flowRegion><flowPara
- id="flowPara5451">126</flowPara></flowRoot> </g>
+ id="flowPara5451">62</flowPara></flowRoot> </g>
<g
id="g5478"
- transform="translate(70.031013,0.5)">
+ transform="translate(73.331343,15)">
<rect
y="75.531006"
x="180.5"
@@ -236,10 +236,10 @@
height="17.601761"
width="37.953796"
id="rect5490" /></flowRegion><flowPara
- id="flowPara5492">128</flowPara></flowRoot> </g>
+ id="flowPara5492">64</flowPara></flowRoot> </g>
<g
id="g5494"
- transform="translate(190.03101,0.5)">
+ transform="translate(193.33134,15)">
<rect
y="75.531006"
x="180.5"
@@ -265,9 +265,10 @@
height="17.601761"
width="37.953796"
id="rect5506" /></flowRegion><flowPara
- id="flowPara5508">128</flowPara></flowRoot> </g>
+ id="flowPara5508">64</flowPara></flowRoot> </g>
<g
- id="g5533">
+ id="g5533"
+ transform="translate(3.30033,14.5)">
<rect
y="76.031006"
x="490.53101"
@@ -295,44 +296,44 @@
id="rect5522" /></flowRegion><flowPara
id="flowPara5524">Header</flowPara></flowRoot> </g>
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1,1;stroke-opacity:1;stroke-dashoffset:0"
- d="M 39.5,100.42 C 39.5,60.339108 39.5,60.339108 39.5,60.339108 C 130.57824,60.339108 130.57824,60.339108 130.57824,60.339108 C 130.57824,75.369443 130.57824,75.369443 130.57824,75.369443"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 42.80033,114.92 C 42.80033,74.839108 42.80033,74.839108 42.80033,74.839108 C 133.87857,74.839108 133.87857,74.839108 133.87857,74.839108 C 133.87857,89.869443 133.87857,89.869443 133.87857,89.869443"
id="path6523" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1,1;stroke-opacity:1;stroke-dashoffset:0"
- d="M 520.5,100.48159 L 520.5,45.5 L 10.751521,45.5 L 10.751521,45.5 L 10.751521,75.489955"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 523.80033,114.98159 L 523.80033,60 L 14.051851,60 L 14.051851,60 L 14.051851,89.989955"
id="path6535" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1,1;stroke-opacity:1;stroke-dashoffset:0"
- d="M 159.5,100.42 C 159.5,60.3391 159.5,60.3391 159.5,60.3391 C 250.57824,60.3391 250.57824,60.3391 250.57824,60.3391 C 250.57824,75.36944 250.57824,75.36944 250.57824,75.36944"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 162.80033,114.92 C 162.80033,74.8391 162.80033,74.8391 162.80033,74.8391 C 253.87857,74.8391 253.87857,74.8391 253.87857,74.8391 C 253.87857,89.86944 253.87857,89.86944 253.87857,89.86944"
id="path3195" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1,1;stroke-opacity:1;stroke-dashoffset:0"
- d="M 279.5,100.42 C 279.5,60.33911 279.5,60.33911 279.5,60.33911 C 370.57824,60.33911 370.57824,60.33911 370.57824,60.33911 C 370.57824,75.36944 370.57824,75.36944 370.57824,75.36944"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 282.80033,114.92 C 282.80033,74.83911 282.80033,74.83911 282.80033,74.83911 C 373.87857,74.83911 373.87857,74.83911 373.87857,74.83911 C 373.87857,89.86944 373.87857,89.86944 373.87857,89.86944"
id="path3197" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1,1;stroke-opacity:1;stroke-dashoffset:0"
- d="M 399.5,100.42 C 399.5,60.33911 399.5,60.33911 399.5,60.33911 C 490.57824,60.33911 490.57824,60.33911 490.57824,60.33911 C 490.57824,75.36944 490.57824,75.36944 490.57824,75.36944"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 402.80033,114.92 C 402.80033,74.83911 402.80033,74.83911 402.80033,74.83911 C 493.87857,74.83911 493.87857,74.83911 493.87857,74.83911 C 493.87857,89.86944 493.87857,89.86944 493.87857,89.86944"
id="path3199" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1,1;stroke-opacity:1;stroke-dashoffset:0"
- d="M 140.5,99.58 C 140.5,139.48422 140.5,139.48422 140.5,139.48422 C 9.9374,139.48422 9.9374,139.48422 9.9374,139.48422 C 9.9374,124.52014 9.9374,124.52014 9.9374,124.52014"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 143.80033,114.08 C 143.80033,153.98422 143.80033,153.98422 143.80033,153.98422 C 13.23773,153.98422 13.23773,153.98422 13.23773,153.98422 C 13.23773,139.02014 13.23773,139.02014 13.23773,139.02014"
id="path3201" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1,1;stroke-opacity:1;stroke-dashoffset:0"
- d="M 380.5,99.58 C 380.5,139.48422 380.5,139.48422 380.5,139.48422 C 249.9374,139.48422 249.9374,139.48422 249.9374,139.48422 C 249.9374,124.52014 249.9374,124.52014 249.9374,124.52014"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 383.80033,114.08 C 383.80033,153.98422 383.80033,153.98422 383.80033,153.98422 C 253.23773,153.98422 253.23773,153.98422 253.23773,153.98422 C 253.23773,139.02014 253.23773,139.02014 253.23773,139.02014"
id="path3205" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-end:url(#Arrow2Mend);stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1,1;stroke-dashoffset:0"
- d="M 260.5,99.58 L 260.5,149.58 L 130.5,149.58 L 130.5,124.58"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 263.80033,114.08 L 263.80033,164.08 L 133.80033,164.08 L 133.80033,139.08"
id="path3225" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
- d="M 500.5,99.58 L 500.5,149.58 L 370.5,149.58 L 370.5,124.58"
+ d="M 503.80033,114.08 L 503.80033,164.08 L 373.80033,164.08 L 373.80033,139.08"
id="path3425" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Dot_l);marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:1,1;stroke-dashoffset:0"
- d="M 20,100 L 20,160 L 490,160 L 490,125"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Dot_l);marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 23.30033,114.5 L 23.30033,174.5 L 493.30033,174.5 L 493.30033,139.5"
id="path3427" />
</g>
</svg>
diff --git a/docs/img/workspace.png b/docs/img/workspace.png
index 03149b7bd..e7e20b60b 100644
--- a/docs/img/workspace.png
+++ b/docs/img/workspace.png
Binary files differ
diff --git a/docs/img/workspace.svg b/docs/img/workspace.svg
index afdc5492e..721be190c 100644
--- a/docs/img/workspace.svg
+++ b/docs/img/workspace.svg
@@ -15,10 +15,10 @@
sodipodi:version="0.32"
inkscape:version="0.45.1"
version="1.0"
- sodipodi:docbase="C:\Progetti\ChibiOS\homepage"
+ sodipodi:docbase="D:\Progetti\ChibiOS-RT\docs\img"
sodipodi:docname="workspace.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
- inkscape:export-filename="C:\Progetti\ChibiOS\homepage\workspace.png"
+ inkscape:export-filename="D:\Progetti\ChibiOS-RT\docs\img\workspace.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
@@ -82,9 +82,9 @@
objecttolerance="1"
guidetolerance="1"
inkscape:window-width="993"
- inkscape:window-height="870"
- inkscape:window-x="139"
- inkscape:window-y="66" />
+ inkscape:window-height="871"
+ inkscape:window-x="352"
+ inkscape:window-y="69" />
<metadata
id="metadata2165">
<rdf:RDF>
@@ -149,37 +149,37 @@
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;stroke-miterlimit:4;stroke-dasharray:1,1;stroke-dashoffset:0;stroke-opacity:1"
- d="M 110.44572,50.481444 C 249.51856,50.481444 249.51856,50.481444 249.51856,50.481444"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 110.5,74.5 C 249.57284,74.5 249.57284,74.5 249.57284,74.5"
id="path3245" />
<path
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1,1;stroke-dashoffset:0;stroke-opacity:1"
- d="M 110.44572,80.481444 C 249.51856,80.481444 249.51856,80.481444 249.51856,80.481444"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 110.5,149.5 C 249.57284,149.5 249.57284,149.5 249.57284,149.5"
id="path3247" />
<flowRoot
xml:space="preserve"
id="flowRoot3249"
- transform="translate(131.71875,-62.610866)"><flowRegion
+ transform="translate(125.4043,-62.808117)"><flowRegion
id="flowRegion3251"><rect
id="rect3253"
- width="97.01046"
- height="17.563538"
+ width="107.01046"
+ height="12.563538"
x="2.9895365"
y="332.43646" /></flowRegion><flowPara
id="flowPara3255">Thread Structure</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3257"
- transform="translate(136.05664,-274.98977)"><flowRegion
+ transform="translate(133.58398,-197.80812)"><flowRegion
id="flowRegion3259"><rect
id="rect3261"
- width="97.01046"
+ width="102.01046"
height="17.563538"
x="2.9895365"
y="332.43646" /></flowRegion><flowPara
- id="flowPara3263">Registers Dump</flowPara></flowRoot> <flowRoot
+ id="flowPara3263">intctx Structure</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3265"
- transform="translate(141.71875,-307.61087)"><flowRegion
+ transform="translate(137.71094,-292.80812)"><flowRegion
id="flowRegion3267"><rect
id="rect3269"
width="97.01046"
@@ -189,7 +189,7 @@
id="flowPara3273">Thread Stack</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3277"
- transform="translate(0.4335938,-258.72805)"><flowRegion
+ transform="translate(1.2089844,-187.09523)"><flowRegion
id="flowRegion3279"><rect
id="rect3281"
width="97.01046"
@@ -202,7 +202,7 @@
id="path3487" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.6978516px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Mend);stroke-opacity:1"
- d="M 100.16177,81.570166 C 109.12769,81.570166 109.12769,81.570166 109.12769,81.570166"
+ d="M 100.34893,148.42983 C 109.31485,148.42983 109.31485,148.42983 109.31485,148.42983"
id="path3489" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.6978516px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Mend);stroke-opacity:1"
@@ -218,10 +218,10 @@
<flowRoot
xml:space="preserve"
id="flowRoot2208"
- transform="translate(122.00391,-93.728054)"><flowRegion
+ transform="translate(112.03516,-92.095227)"><flowRegion
id="flowRegion2210"><rect
id="rect2212"
- width="117.01046"
+ width="132.01047"
height="17.563538"
x="2.9895365"
y="332.43646" /></flowRegion><flowPara
@@ -239,5 +239,47 @@
height="17.563538"
x="2.9895365"
y="332.43646" /></flowRegion><flowPara
- id="flowPara2224">chThdLS()</flowPara></flowRoot> </g>
+ id="flowPara2224">chThdLS()</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2209"
+ transform="translate(2.3710937,-107.80812)"><flowRegion
+ id="flowRegion2211"><rect
+ id="rect2213"
+ width="97.01046"
+ height="17.563538"
+ x="2.9895365"
+ y="332.43646" /></flowRegion><flowPara
+ id="flowPara2215">Stack Limit</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.6978516px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Mend);stroke-opacity:1"
+ d="M 100.16177,231.57017 C 109.12769,231.57017 109.12769,231.57017 109.12769,231.57017"
+ id="path2217" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 110.42716,125.5 C 249.5,125.5 249.5,125.5 249.5,125.5"
+ id="path2221" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 110.42716,100.5 C 249.5,100.5 249.5,100.5 249.5,100.5"
+ id="path2223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2225"
+ transform="translate(130.04492,-248.01905)"><flowRegion
+ id="flowRegion2227"><rect
+ id="rect2229"
+ width="102.01046"
+ height="17.563538"
+ x="2.9895365"
+ y="332.43646" /></flowRegion><flowPara
+ id="flowPara2231">extctx Structure</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2235"
+ transform="translate(110.82227,-224.75538)"><flowRegion
+ id="flowRegion2237"><rect
+ id="rect2239"
+ width="137.01047"
+ height="17.563538"
+ x="2.9895365"
+ y="332.43646" /></flowRegion><flowPara
+ id="flowPara2241">INT_REQUIRED_STACK</flowPara></flowRoot> </g>
</svg>
diff --git a/src/templates/chcore.c b/src/templates/chcore.c
index c15f1c490..5a887d6ed 100644
--- a/src/templates/chcore.c
+++ b/src/templates/chcore.c
@@ -88,12 +88,19 @@ void chSysUnlock(void) {
}
/**
- * Context switch.
+ * Performs a context switch.
+ * This is the most critical code in any port, this function is responsible
+ * for the context switch between 2 threads.
+ * @param otp the thread to be switched out
+ * @param ntp the thread to be switched in
+ * @note The implementation of this code affects <b>directly</b> the context
+ * switch performance so optimize here as much as you can.
*/
void chSysSwitchI(Thread *otp, Thread *ntp) {}
/**
* Prints a message on the system console (if any).
+ * @param msg the message to be printed on the system console
*/
void chSysPuts(char *msg) {
}
diff --git a/src/templates/chcore.h b/src/templates/chcore.h
index 7690b7ce7..e551f3a61 100644
--- a/src/templates/chcore.h
+++ b/src/templates/chcore.h
@@ -32,27 +32,39 @@
/**
* Base type for stack alignment.
+ * This type is used only for stack alignment reasons thus can be anything from
+ * a char to a double.
*/
typedef uint8_t stkalign_t;
/**
* Interrupt saved context.
+ * This structure represents the stack frame saved during a preemption-capable
+ * interrupt handler.
*/
struct extctx {
};
/**
* System saved context.
+ * This structure represents the inner stack frame during a context switching.
*/
struct intctx {
};
+/**
+ * Platform dependent part of the @p Thread structure.
+ * This structure usually contains just the saved stack pointer defined as a
+ * pointer to a @p intctx structure.
+ */
typedef struct {
struct intctx *sp;
} Context;
/**
* Platform dependent part of the \p chThdCreate() API.
+ * This code usually setup the context switching frame represented by a
+ * @p intctx structure.
*/
#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
{ \
@@ -60,12 +72,18 @@ typedef struct {
/**
* Stack size for the system idle thread.
+ * This size depends on the idle thread implementation, usually the idle
+ * thread should take no more space than those reserved
+ * by @p INT_REQUIRED_STACK.
*/
#define IDLE_THREAD_STACK_SIZE 0
/**
* Per-thread stack overhead for interrupts servicing, it is used in the
* calculation of the correct working area size.
+ * This value can be zero on those architecture where there is a separate
+ * interrupt stack and the stack space between @p intctx and @p extctx is
+ * known to be zero.
*/
#define INT_REQUIRED_STACK 0