You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gi...@apache.org on 2023/05/20 00:16:19 UTC
[nuttx-website] branch asf-site updated: Publishing web: b5385572da9781727954ec9d98f5329c0d33acf2 docs: e299af410a2c378788cd9273c83f96f277d22d42
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/nuttx-website.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 8a240d5d Publishing web: b5385572da9781727954ec9d98f5329c0d33acf2 docs: e299af410a2c378788cd9273c83f96f277d22d42
8a240d5d is described below
commit 8a240d5d6d63f55cfc448799889f3e364b751f73
Author: Brennan Ashton <ba...@brennanashton.com>
AuthorDate: Sat May 20 00:12:06 2023 +0000
Publishing web: b5385572da9781727954ec9d98f5329c0d33acf2 docs: e299af410a2c378788cd9273c83f96f277d22d42
---
content/docs/10.0.0/index.html | 2 +-
content/docs/10.0.0/searchindex.js | 2 +-
content/docs/10.0.1/index.html | 2 +-
content/docs/10.0.1/searchindex.js | 2 +-
content/docs/10.1.0/index.html | 2 +-
content/docs/10.1.0/searchindex.js | 2 +-
content/docs/10.2.0/index.html | 2 +-
content/docs/10.2.0/searchindex.js | 2 +-
content/docs/10.3.0/index.html | 2 +-
content/docs/10.3.0/searchindex.js | 2 +-
content/docs/11.0.0/index.html | 2 +-
content/docs/11.0.0/searchindex.js | 2 +-
content/docs/12.0.0/index.html | 2 +-
content/docs/12.0.0/searchindex.js | 2 +-
content/docs/12.1.0/index.html | 2 +-
content/docs/12.1.0/searchindex.js | 2 +-
content/docs/latest/_sources/guides/index.rst.txt | 2 +
.../_sources/guides/nestedinterrupts.rst.txt | 247 ++++++++++++
.../_sources/guides/zerolatencyinterrupts.rst.txt | 141 +++----
content/docs/latest/glossary.html | 4 +-
content/docs/latest/guides/cpp_cmake.html | 2 +
content/docs/latest/guides/customapps.html | 6 +-
content/docs/latest/guides/customboards.html | 2 +
content/docs/latest/guides/drivers.html | 2 +
content/docs/latest/guides/index.html | 25 ++
content/docs/latest/guides/nestedinterrupts.html | 415 +++++++++++++++++++++
content/docs/latest/guides/nfs.html | 2 +
content/docs/latest/guides/pysimcoder.html | 2 +
content/docs/latest/guides/qemugdb.html | 2 +
content/docs/latest/guides/rndis.html | 2 +
content/docs/latest/guides/simulator.html | 2 +
content/docs/latest/guides/tasktrace.html | 2 +
content/docs/latest/guides/tasktraceinternal.html | 2 +
content/docs/latest/guides/tasktraceuser.html | 2 +
content/docs/latest/guides/usbtrace.html | 2 +
.../docs/latest/guides/zerolatencyinterrupts.html | 185 +++++----
content/docs/latest/index.html | 4 +-
content/docs/latest/objects.inv | Bin 46321 -> 46535 bytes
content/docs/latest/reference/user/07_signals.html | 2 +-
content/docs/latest/searchindex.js | 2 +-
content/feed.xml | 4 +-
41 files changed, 917 insertions(+), 176 deletions(-)
diff --git a/content/docs/10.0.0/index.html b/content/docs/10.0.0/index.html
index dc37fec9..23ef0c9b 100644
--- a/content/docs/10.0.0/index.html
+++ b/content/docs/10.0.0/index.html
@@ -133,7 +133,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller environments, the primary governing standards in NuttX are Posix and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:09</p>
+<p>Last Updated: 20 May 23 at 00:09</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
diff --git a/content/docs/10.0.0/searchindex.js b/content/docs/10.0.0/searchindex.js
index 998e6ff6..17d41465 100644
--- a/content/docs/10.0.0/searchindex.js
+++ b/content/docs/10.0.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components/drivers/character/serial","components/drivers/character/timer","components/drivers/character/touchscreen [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components/drivers/character/serial","components/drivers/character/timer","components/drivers/character/touchscreen [...]
\ No newline at end of file
diff --git a/content/docs/10.0.1/index.html b/content/docs/10.0.1/index.html
index c783539a..e1e0d316 100644
--- a/content/docs/10.0.1/index.html
+++ b/content/docs/10.0.1/index.html
@@ -149,7 +149,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller environments, the primary governing standards in NuttX are Posix and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:10</p>
+<p>Last Updated: 20 May 23 at 00:09</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
diff --git a/content/docs/10.0.1/searchindex.js b/content/docs/10.0.1/searchindex.js
index cc03641b..17d41465 100644
--- a/content/docs/10.0.1/searchindex.js
+++ b/content/docs/10.0.1/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components/drivers/character/serial","components/drivers/character/timer","components/drivers/character/touchscreen [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components/drivers/character/serial","components/drivers/character/timer","components/drivers/character/touchscreen [...]
\ No newline at end of file
diff --git a/content/docs/10.1.0/index.html b/content/docs/10.1.0/index.html
index cddbbffc..7419cc8a 100644
--- a/content/docs/10.1.0/index.html
+++ b/content/docs/10.1.0/index.html
@@ -148,7 +148,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:10</p>
+<p>Last Updated: 20 May 23 at 00:09</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
diff --git a/content/docs/10.1.0/searchindex.js b/content/docs/10.1.0/searchindex.js
index 5396d630..efe748aa 100644
--- a/content/docs/10.1.0/searchindex.js
+++ b/content/docs/10.1.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
diff --git a/content/docs/10.2.0/index.html b/content/docs/10.2.0/index.html
index 1dd3f884..7e168711 100644
--- a/content/docs/10.2.0/index.html
+++ b/content/docs/10.2.0/index.html
@@ -149,7 +149,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:10</p>
+<p>Last Updated: 20 May 23 at 00:10</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
diff --git a/content/docs/10.2.0/searchindex.js b/content/docs/10.2.0/searchindex.js
index dc675b0c..d3429d42 100644
--- a/content/docs/10.2.0/searchindex.js
+++ b/content/docs/10.2.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
diff --git a/content/docs/10.3.0/index.html b/content/docs/10.3.0/index.html
index 1dd3f884..7e168711 100644
--- a/content/docs/10.3.0/index.html
+++ b/content/docs/10.3.0/index.html
@@ -149,7 +149,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:10</p>
+<p>Last Updated: 20 May 23 at 00:10</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
diff --git a/content/docs/10.3.0/searchindex.js b/content/docs/10.3.0/searchindex.js
index 942c13b8..a9fb8335 100644
--- a/content/docs/10.3.0/searchindex.js
+++ b/content/docs/10.3.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
diff --git a/content/docs/11.0.0/index.html b/content/docs/11.0.0/index.html
index 1dd3f884..7e168711 100644
--- a/content/docs/11.0.0/index.html
+++ b/content/docs/11.0.0/index.html
@@ -149,7 +149,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:10</p>
+<p>Last Updated: 20 May 23 at 00:10</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
diff --git a/content/docs/11.0.0/searchindex.js b/content/docs/11.0.0/searchindex.js
index e62b6af4..70badcb9 100644
--- a/content/docs/11.0.0/searchindex.js
+++ b/content/docs/11.0.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
diff --git a/content/docs/12.0.0/index.html b/content/docs/12.0.0/index.html
index 2c432196..7e71736b 100644
--- a/content/docs/12.0.0/index.html
+++ b/content/docs/12.0.0/index.html
@@ -149,7 +149,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:11</p>
+<p>Last Updated: 20 May 23 at 00:10</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
diff --git a/content/docs/12.0.0/searchindex.js b/content/docs/12.0.0/searchindex.js
index a564f9a2..e17d062d 100644
--- a/content/docs/12.0.0/searchindex.js
+++ b/content/docs/12.0.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
diff --git a/content/docs/12.1.0/index.html b/content/docs/12.1.0/index.html
index 505c0a4f..2e28d6fb 100644
--- a/content/docs/12.1.0/index.html
+++ b/content/docs/12.1.0/index.html
@@ -149,7 +149,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:11</p>
+<p>Last Updated: 20 May 23 at 00:11</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
diff --git a/content/docs/12.1.0/searchindex.js b/content/docs/12.1.0/searchindex.js
index cf1f36fd..72be4f7b 100644
--- a/content/docs/12.1.0/searchindex.js
+++ b/content/docs/12.1.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/foc","components/drivers/character/index","components/drivers/character [...]
\ No newline at end of file
diff --git a/content/docs/latest/_sources/guides/index.rst.txt b/content/docs/latest/_sources/guides/index.rst.txt
index 5e008f34..0539a05b 100644
--- a/content/docs/latest/_sources/guides/index.rst.txt
+++ b/content/docs/latest/_sources/guides/index.rst.txt
@@ -16,3 +16,5 @@ Guides
pysimcoder.rst
customboards.rst
customapps.rst
+ zerolatencyinterrupts.rst
+ nestedinterrupts.rst
diff --git a/content/docs/latest/_sources/guides/nestedinterrupts.rst.txt b/content/docs/latest/_sources/guides/nestedinterrupts.rst.txt
new file mode 100644
index 00000000..74134272
--- /dev/null
+++ b/content/docs/latest/_sources/guides/nestedinterrupts.rst.txt
@@ -0,0 +1,247 @@
+=================
+Nested Interrupts
+=================
+
+Are Nested Interrupts Needed?
+=============================
+
+Most NuttX architectures do not support nested interrupts: Interrupts
+are disabled when the interrupt is entered and restored when the
+interrupt returns. Being able to handle nested interrupt is critical in
+simple architectures where a lot of interrupt level processing is
+performed: In this case, you can prioritize interrupts and assure that
+the highest priority interrupt processing is not delayed by lower level
+interrupt processing.
+
+In an RTOS model, however, all interrupt processing should be as brief
+as possible; any extended processing should be deferred to a user task
+and not performed in the interrupt handler. However, you may find a need
+to have nested interrupt handling in NuttX too. The lack of support of
+nested interrupts is not inherently an issue with NuttX and need not be
+the case; it should be a simple matter to modify the interrupt handling
+so that interrupts are nested.
+
+Layered Interrupt Handling Architecture
+=======================================
+
+Interrupt handling occurs in several files. In most implementations,
+there are several layers of interrupt handling logic:
+
+#. Some low-level logic, usually in assembly language, that catches the
+ interrupt and determines the IRQ number. Consider
+ ``arch/arm/src/armv7-m/up_exception.S`` as an example for the
+ Cortex-M family.
+
+#. That low-level logic than calls some MCU-specific, intermediate level
+ function usually called ``up_doirq()``. An example is
+ ``arch/arm/src/armv7-m/up_doirq.c``.
+
+#. That MCU-specific function then calls the NuttX common interrupt
+ dispatching logic ``irq_dispatch()`` that can be found at
+ ``sched/irq_dispatch.c``.
+
+How to Implement Nested Interrupts in the Layered Interrupt Handling Architecture
+=================================================================================
+
+The logic in these first two levels that would have to change to support
+nested interrupt handling. Here is one technical approach to do that:
+
+#. Add a global variable, say ``g_nestlevel``, that counts the interrupt
+ nesting level. It would have an initial value of zero; it would be
+ incremented on each interrupt entry and decremented on interrupt exit
+ (making sure that interrupts are disabled in each case because
+ incrementing and decrementing are not usually atomic operations).
+
+#. At the lowest level, there is usually some assembly language logic
+ that will switch from the user's stack to a special interrupt level
+ stack. This behavior is controlled ``CONFIG_ARCH_INTERRUPTSTACK``.
+ The logic here would have to change in the following way: If
+ ``g_nestlevel`` is zero then behave as normal, switching from the
+ user to the interrupt stack; if ``g_nestlevel`` is greater than zero,
+ then do not switch stacks. In this latter case, we are already using
+ the interrupt stack.
+
+#. In the middle-level, MCU-specific is where the ``g_nestlevel`` would
+ be increment. And here some additional decision must be made based on
+ the state of ``g_nestlevel``. If ``g_nestlevel`` is zero, then we
+ have interrupted user code and we need to handle the context
+ information specially and handle interrupt level context switches. If
+ ``g_nestlevel`` is greater than zero, then the interrupt handler was
+ interrupt by an interrupt. In this case, the interrupt handling must
+ always return to the interrupt handler. No context switch can occur
+ here. No context switch can occur until the outermost, nested
+ interrupt handler returns to the user task.
+
+#. You would also need to support some kind of critical section within
+ interrupt handlers to prevent nested interrupts. For example, within
+ the logic of functions like ``up_block_task()``. Such logic must be
+ atomic in any case.
+
+**NOTE 1**: The ARMv7-M could also be configured to use separate MSP and
+PSP stacks with the interupt processing using the MSP stack and the
+tasks all using the PSP stacks. This is not compatible with certain
+parts of the existing design and would be more effort, but could result
+in a better solution.
+
+**NOTE 2**: SMP has this same issue as 2 but it is addressed
+differently: With SMP there is an array of stacks indexed by the CPU
+number so that all CPUs get to have an interrupt stack. See for
+example,
+`LC823450 <https://bitbucket.org/nuttx/nuttx/src/ca4ef377fb789ddc3e70979b28acb6730ff6a98c/arch/arm/src/lc823450/chip.h>`_
+or
+`i.MX6 <https://bitbucket.org/nuttx/nuttx/src/ca4ef377fb789ddc3e70979b28acb6730ff6a98c/arch/arm/src/imx6/chip.h>`_
+SMP logic.
+
+A generic ``up_doirq()`` might look like the following. It can be very
+simple because interrupts are disabled:
+
+.. code-block:: c
+
+ uint32_t *up_doirq(int irq, uint32_t *regs)
+ {
+ /* Current regs non-zero indicates that we are processing an interrupt;
+ * current_regs is also used to manage interrupt level context switches.
+ */
+
+ current_regs = regs;
+
+ /* Deliver the IRQ */
+
+ irq_dispatch(irq, regs);
+
+ /* If a context switch occurred while processing the interrupt then
+ * current_regs may have change value. If we return any value different
+ * from the input regs, then the lower level will know that a context
+ * switch occurred during interrupt processing.
+ */
+
+ regs = (uint32_t*)current_regs;
+ current_regs = NULL;
+ return regs;
+ }
+
+What has to change to support nested interrupts is:
+
+#. If we are nested, then we must retain the original value of
+ ``current_regs``. This will be need when the outermost interrupt
+ handler returns in order to handle interrupt level context switches.
+
+#. If we are nested, then we need to always return the same value of
+ ``regs`` that was received.
+
+So the modified version of ``up_doirq()`` would be as follows. Here we
+assume that interrupts are enabled.
+
+.. code-block:: c
+
+ uint32_t *up_doirq(int irq, uint32_t *regs)
+ {
+ irqstate_t flags;
+
+ /* Current regs non-zero indicates that we are processing an interrupt;
+ * regs holds the state of the interrupted logic; current_regs holds the
+ * state of the interrupted user task. current_regs should, therefor,
+ * only be modified for outermost interrupt handler (when g_nestlevel == 0)
+ */
+
+ flags = irqsave();
+ if (g_nestlevel == 0)
+ {
+ current_regs = regs;
+ }
+ g_nestlevel++
+ irqrestore(flags);
+
+ /* Deliver the IRQ */
+
+ irq_dispatch(irq, regs);
+
+ /* Context switches are indicated by the returned value of this function.
+ * If a context switch occurred while processing the interrupt then
+ * current_regs may have change value. If we return any value different
+ * from the input regs, then the lower level will know that a context
+ * switch occurred during interrupt processing. Context switching should
+ * only be performed when the outermost interrupt handler returns.
+ */
+
+ flags = irqsave();
+ g_nestlevel--;
+ if (g_nestlevel == 0)
+ {
+ regs = (uint32_t*)current_regs;
+ current_regs = NULL;
+ }
+
+ /* Note that interrupts are left disabled. This needed if context switch
+ * will be performed. But, any case, the correct interrupt state should
+ * be restored when returning from the interrupt.
+ */
+
+ return regs;
+ }
+
+**NOTE:** An alternative, cleaner design might also be possible. If one
+were to defer all context switching to a *PendSV* handler, then the
+interrupts could vector to the ``do_irq()`` logic and then all
+interrupts would be naturally nestable.
+
+SVCall vs PendSV
+================
+
+An issue that may be related to nested interrupt handling is the use of
+the ``SVCall`` exceptions in NuttX. The ``SVCall`` exception is used as
+a classic software interrupt in NuttX for performing context switches,
+user- to kernel-mode changes (and vice versa), and also for system calls
+when NuttX is built as a kernel.
+
+``SVCall`` exceptions are never performed from interrupt level, handler
+mode processing; only from thread mode logic. The ``SVCall`` exception
+is used as follows to perform the system call:
+
+* All interrupts are disabled: There are a few steps the must be
+ performed in a critical section. Those setups and the ``SVCall`` must
+ work as a single, uninterrupted atomic action.
+
+* A special register setup is put in place: Parameters are passed to the
+ ``SVCall`` in registers just as with a normal function call.
+
+* The Cortex SVC instruction is executed. This causes the ``SVCall``
+ exception which is dispatched to the ``SVCall`` exception handler.
+ This exception must occur while the input register setup is in place;
+ it cannot be deferred and perform at some later time. The ``SVCall``
+ exception handler decodes the registers and performs the requested
+ operation. If no context switch occurs, the ``SVCall`` will return to
+ the caller immediately.
+
+* Upon return interrupts will be re-enabled.
+
+So what does this have to do with nested interrupt handling? Since
+interrupts are disabled throughout the ``SVCall`` sequence, nothing
+really. However, there are some concerns because if the ``BASEPRI`` is
+used to disable interrupts then the ``SVCall`` exception must have the
+highest priority: The ``BASEPRI`` register is set to disable all
+interrupt except for the ``SVCall``.
+
+The motivation for supporting nested interrupts is, presumably, to make
+sure that certain high priority interrupts are not delayed by lower
+processing interrupt handling. Since the ``SVCall`` exception has
+highest priority, it will delay all other interrupts (but, of course,
+disabling interrupt also delays all other interrupts).
+
+The PendSV exception is another mechanism offered by the Cortex
+architecture. It has been suggested that some of these issues with the
+``SVCall`` exception could be avoided by using the PendSV interrupt. The
+architecture that would use the PendSV exception instead of the
+``SVCall`` interrupt is not clear in my mind. But I will keep this note
+here for future reference if this were to become as issue.
+
+What Could Go Wrong?
+====================
+
+Whenever you deal with logic at software hardware interface, lots of
+things can go wrong. But, aside from that general risk, the only
+specific NuttX risk issue is that you may uncover some subtle interrupt
+level logic that assumes that interrupts are already disabled. In those
+cases, additional critical sections may be needed inside of the
+interrupt level processing. The likelihood of such a thing is probably
+pretty low, but cannot be fully discounted.
diff --git a/content/docs/latest/_sources/guides/zerolatencyinterrupts.rst.txt b/content/docs/latest/_sources/guides/zerolatencyinterrupts.rst.txt
index f51eac70..868058e9 100644
--- a/content/docs/latest/_sources/guides/zerolatencyinterrupts.rst.txt
+++ b/content/docs/latest/_sources/guides/zerolatencyinterrupts.rst.txt
@@ -8,19 +8,27 @@ Generic Interrupt Handling
NuttX includes a generic interrupt handling subsystem that makes it
convenient to deal with interrupts using only IRQ numbers. In order to
integrate with this generic interrupt handling system, the platform
-specific code is expected to collect all thread state into an container,
+specific code is expected to collect all thread state into a container,
``struct xcptcontext``. This container represents the full state of the
thread and can be saved, restored, and exchanged as a *unit of thread*.
While this state saving has many useful benefits, it does require
processing time. It was reported to me that this state saving required
about two microseconds on an STM32F4Discovery board. That added
-interrupt latency might be an issue in some circumstance.
-
-**Terminology:** The concepts discussed in this Wiki are not unique to
-NuttX. Other RTOS have similar concepts but will use different
+interrupt latency might be an issue in some circumstances.
+
+In addition, critical sections that are required in various places
+throughout the RTOS can pause interrupt handling momentarily. This
+increases the latency for those interrupts which become pending during a
+critical section. As this is likely to occur for some instances of an
+interrupt and not others, the interrupt latency varies from time to time
+(experiences *jitter*). Like the added latency discussed above, that
+jitter might be an issue in some circumstances.
+
+**Terminology:** The concepts discussed in this guide are not unique to
+NuttX. Other RTOSes have similar concepts but will use different
terminology. The `Nucleus <https://www.embedded.com/design/operating-systems/4461604/Interrupts-in-the-Nucleus-SE-RTOS>`_
-RTOS, for example use the terms *Native* and *Managed* interrupts.
+RTOS, for example, uses the terms *Native* and *Managed* interrupts.
Bypassing the Generic Interrupt Handling
========================================
@@ -53,24 +61,23 @@ when the ``CONFIG_ARCH_RAMVECTORS`` option is enabled.
So what is the downside? There are two:
- - Your custom interrupt handler will not have collected its state
- into the ``struct xcptcontext`` container. Therefore, it cannot
- communicate with operating system. Your custom interrupt handler
- has been taken "out of the game" and can no longer work with the
- system.
+* Your custom interrupt handler will not have collected its state into
+ the ``struct xcptcontext`` container. Therefore, it cannot communicate
+ with operating system. Your custom interrupt handler has been taken
+ "out of the game" and can no longer work with the system.
- - If your custom interrupt is truly going to be *high performance*
- then you will also have to support nested interrupts! The custom
- interrupt must have a high priority and must be able interrupt the
- generic interrupt handling logic. Otherwise, it will be
- occasionally delayed when there is a collision between your custom
- interrupt and other, lower priority interrupts.
+* If your custom interrupt is truly going to be *high performance* then
+ you will also have to support nested interrupts! The custom interrupt
+ must have a high priority and must be able interrupt the generic
+ interrupt handling logic. Otherwise, it will be occasionally delayed
+ when there is a collision between your custom interrupt and other,
+ lower priority interrupts.
Getting Back into the Game
==========================
-As mentioned, the custom interrupt handler can not use most of the
-service of the OS since it has not created a ``struct xcptcontext``
+As mentioned, the custom interrupt handler cannot use most of the
+services of the OS since it has not created a ``struct xcptcontext``
container. So it needs a mechanism to "get back into the game" when it
needs to interact with the operating system to, for example, post a
semaphore, signal a thread, or send a message.
@@ -78,16 +85,15 @@ semaphore, signal a thread, or send a message.
The ARM Cortex-M family supports a special way to do this using the
*PendSV* interrupt:
- - The custom logic would connect with the *PendSV* interrupt using
- the standard ``irq_attach()`` interface.
+* The custom logic would connect with the *PendSV* interrupt using the
+ standard ``irq_attach()`` interface.
- - In the custom interrupt handler, it would schedule the *PendSV*
- interrupt when it needs to communicate with the OS.
+* In the custom interrupt handler, it would schedule the *PendSV*
+ interrupt when it needs to communicate with the OS.
- - The *PendSV* interrupt is dispatched through generic interrupt
- system so when the attached *PendSV* interrupt is handled, it
- will be in a context where it can perform any necessary OS
- interactions.
+* The *PendSV* interrupt is dispatched through the generic interrupt
+ system so when the attached *PendSV* interrupt is handled, it will be
+ in a context where it can perform any necessary OS interactions.
With the ARMv7_M architecture, the *PendSV* interrupt can be generated
with:
@@ -109,36 +115,34 @@ Nested Interrupt Handling
=========================
Some general notes about nested interrupt handling are provided in
-another `Wiki page <https://cwiki.apache.org/confluence/display/NUTTX/Nested+Interrupts>`_.
-In this case, handling the nested custom interrupt is simpler because
-the generic interrupt handler is not re-entered. Rather, the generic
-interrupt handler must simply be made to co-exist with the custom
-interrupt interrupt handler.
+:doc:`<nestedinterrupts.rst>`. In this case, handling the nested custom
+interrupt is simpler because the generic interrupt handler is not
+re-entered. Rather, the generic interrupt handler must simply be made to
+co-exist with the custom interrupt interrupt handler.
Modifications may be required to the generic interrupt handling logic
to accomplish. A few points need to be made here:
- - The MCU should support interrupt prioritization so that the custom
- interrupt can be scheduled with a higher priority.
+* The MCU should support interrupt prioritization so that the custom
+ interrupt can be scheduled with a higher priority.
- - The generic interrupt handlers currently disable interrupts during
- interrupts. Instead, they must be able to keep the custom
- interrupt enabled throughout interrupt process but still prevent
- re-entrancy by other standard interrupts (This can be done by
- setting an interrupt base priority level in the Cortex-M family).
+* The generic interrupt handlers currently disable interrupts during
+ interrupts. Instead, they must be able to keep the custom interrupt
+ enabled throughout interrupt process but still prevent re-entrancy by
+ other standard interrupts (This can be done by setting an interrupt
+ base priority level in the Cortex-M family).
- - The custom interrupt handler can now interrupt the generic
- interrupt handler at any place. Is the logic safe in all cases to
- be interrupted? Sometimes interrupt handlers place the MCU in
- momentarily perverse states while registers are being
- manipulated. Make sure that it is safe to take interrupts at any
- time (or else keep the interrupts disabled in the critical
- times).
+* The custom interrupt handler can now interrupt the generic interrupt
+ handler at any place. Is the logic safe in all cases to be
+ interrupted? Sometimes interrupt handlers place the MCU in momentarily
+ perverse states while registers are being manipulated. Make sure that
+ it is safe to take interrupts at any time (or else keep the interrupts
+ disabled in the critical times).
- - Will the custom interrupt handler have all of the resources it
- needs in place when it occurs? Will it have a valid stack
- pointer? (In the Cortex-M implementation, for example, the MSP
- may not be valid when the custom interrupt handler is entered).
+* Will the custom interrupt handler have all of the resources it needs
+ in place when it occurs? Will it have a valid stack pointer? (In the
+ Cortex-M implementation, for example, the MSP may not be valid when
+ the custom interrupt handler is entered).
Some of these issues are complex and so you should expect some
complexity in getting the nested interrupt handler to work.
@@ -201,14 +205,13 @@ priority interrupts.
Dependencies
------------
- - ``CONFIG_ARCH_HAVE_IRQPRIO``. Support for prioritized interrupt
- support must be enabled.
+* ``CONFIG_ARCH_HAVE_IRQPRIO``. Support for prioritized interrupt
+ support must be enabled.
- - Floating Point Registers. If used with a Cortex-M4 that supports
- hardware floating point, you cannot use hardware floating point
- in the high priority interrupt handler UNLESS you use the common
- vector logic that supports saving of floating point registers on
- all interrupts.
+* Floating Point Registers. If used with a Cortex-M4 that supports
+ hardware floating point, you cannot use hardware floating point in the
+ high priority interrupt handler UNLESS you use the common vector logic
+ that supports saving of floating point registers on all interrupts.
Configuring High Priority Interrupts
------------------------------------
@@ -220,14 +223,13 @@ First, You need to change the address in the vector table so that the
high priority interrupt vectors to your special C interrupt handler.
There are two ways to do this:
- - If you select ``CONFIG_ARCH_RAMVECTORS``, then vectors will be
- kept in RAM and the system will support the interface: ``int
- up_ramvec_attach(int irq, up_vector_t vector)``. That interface
- can be used to attach your C interrupt handler to the vector at
- run time.
+* If you select ``CONFIG_ARCH_RAMVECTORS``, then vectors will be kept in
+ RAM and the system will support the interface: ``int
+ up_ramvec_attach(int irq, up_vector_t vector)``. That interface can be
+ used to attach your C interrupt handler to the vector at run time.
- - Alternatively, you could keep your vectors in FLASH but in order
- to this, you would have to develop your own custom vector table.
+* Alternatively, you could keep your vectors in FLASH but in order to
+ this, you would have to develop your own custom vector table.
Second, you need to set the priority of your interrupt to *NVIC* to
``NVIC_SYSH_HIGH_PRIORITY`` using the standard interface:
@@ -238,12 +240,11 @@ Example Code
You can find an example that tests the high priority, nested interrupts in the NuttX source:
- - nuttx/boards/arm/stm32/viewtool-stm32f107/README.txt. Description
- of the configuration
+* nuttx/boards/arm/stm32/viewtool-stm32f107/README.txt. Description of
+ the configuration
- - nuttx/boards/arm/stm32/viewtool-stm32f107/highpri. Test
- configuration
+* nuttx/boards/arm/stm32/viewtool-stm32f107/highpri. Test configuration
- - nuttx/boards/arm/stm32/viewtool-stm32f107/src/stm32_highpri. Test
- driver.
+* nuttx/boards/arm/stm32/viewtool-stm32f107/src/stm32_highpri. Test
+ driver.
diff --git a/content/docs/latest/glossary.html b/content/docs/latest/glossary.html
index b806bb8d..4dace838 100644
--- a/content/docs/latest/glossary.html
+++ b/content/docs/latest/glossary.html
@@ -40,7 +40,7 @@
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
- <link rel="prev" title="Custom Apps How-to" href="guides/customapps.html" />
+ <link rel="prev" title="Nested Interrupts" href="guides/nestedinterrupts.html" />
</head>
<body class="wy-body-for-nav">
@@ -386,7 +386,7 @@
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
- <a href="guides/customapps.html" class="btn btn-neutral float-left" title="Custom Apps How-to" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
+ <a href="guides/nestedinterrupts.html" class="btn btn-neutral float-left" title="Nested Interrupts" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
diff --git a/content/docs/latest/guides/cpp_cmake.html b/content/docs/latest/guides/cpp_cmake.html
index 3a6c2cd2..8c91b315 100644
--- a/content/docs/latest/guides/cpp_cmake.html
+++ b/content/docs/latest/guides/cpp_cmake.html
@@ -125,6 +125,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/customapps.html b/content/docs/latest/guides/customapps.html
index c3d42d3b..b3e3668e 100644
--- a/content/docs/latest/guides/customapps.html
+++ b/content/docs/latest/guides/customapps.html
@@ -40,7 +40,7 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
- <link rel="next" title="Glossary" href="../glossary.html" />
+ <link rel="next" title="High Performance, Zero Latency Interrupts" href="zerolatencyinterrupts.html" />
<link rel="prev" title="Custom Boards How-To" href="customboards.html" />
</head>
@@ -144,6 +144,8 @@
</li>
</ul>
</li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
@@ -503,7 +505,7 @@ placing then in the new <code class="docutils literal notranslate"><span class="
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="customboards.html" class="btn btn-neutral float-left" title="Custom Boards How-To" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
- <a href="../glossary.html" class="btn btn-neutral float-right" title="Glossary" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
+ <a href="zerolatencyinterrupts.html" class="btn btn-neutral float-right" title="High Performance, Zero Latency Interrupts" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
diff --git a/content/docs/latest/guides/customboards.html b/content/docs/latest/guides/customboards.html
index 98388a0a..f4d52eb9 100644
--- a/content/docs/latest/guides/customboards.html
+++ b/content/docs/latest/guides/customboards.html
@@ -126,6 +126,8 @@
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/drivers.html b/content/docs/latest/guides/drivers.html
index b4f9a3d8..f19977ae 100644
--- a/content/docs/latest/guides/drivers.html
+++ b/content/docs/latest/guides/drivers.html
@@ -127,6 +127,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/index.html b/content/docs/latest/guides/index.html
index 04afbeba..687b254f 100644
--- a/content/docs/latest/guides/index.html
+++ b/content/docs/latest/guides/index.html
@@ -120,6 +120,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
@@ -283,6 +285,29 @@
</li>
</ul>
</li>
+<li class="toctree-l1"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html#generic-interrupt-handling">Generic Interrupt Handling</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html#bypassing-the-generic-interrupt-handling">Bypassing the Generic Interrupt Handling</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html#getting-back-into-the-game">Getting Back into the Game</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html#nested-interrupt-handling">Nested Interrupt Handling</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html#cortex-m3-4-implementation">Cortex-M3/4 Implementation</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="zerolatencyinterrupts.html#configuration-options">Configuration Options</a></li>
+<li class="toctree-l3"><a class="reference internal" href="zerolatencyinterrupts.html#disabling-the-high-priority-interrupt">Disabling the High Priority Interrupt</a></li>
+<li class="toctree-l3"><a class="reference internal" href="zerolatencyinterrupts.html#dependencies">Dependencies</a></li>
+<li class="toctree-l3"><a class="reference internal" href="zerolatencyinterrupts.html#configuring-high-priority-interrupts">Configuring High Priority Interrupts</a></li>
+<li class="toctree-l3"><a class="reference internal" href="zerolatencyinterrupts.html#example-code">Example Code</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html#are-nested-interrupts-needed">Are Nested Interrupts Needed?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html#layered-interrupt-handling-architecture">Layered Interrupt Handling Architecture</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html#how-to-implement-nested-interrupts-in-the-layered-interrupt-handling-architecture">How to Implement Nested Interrupts in the Layered Interrupt Handling Architecture</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html#svcall-vs-pendsv">SVCall vs PendSV</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html#what-could-go-wrong">What Could Go Wrong?</a></li>
+</ul>
+</li>
</ul>
</div>
</section>
diff --git a/content/docs/latest/guides/nestedinterrupts.html b/content/docs/latest/guides/nestedinterrupts.html
new file mode 100644
index 00000000..63142ea0
--- /dev/null
+++ b/content/docs/latest/guides/nestedinterrupts.html
@@ -0,0 +1,415 @@
+<!--
+ Documentation/_templates/layout.html
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership. The
+ ASF licenses this file to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ License for the specific language governing permissions and limitations
+ under the License.
+-->
+
+<!DOCTYPE html>
+<html class="writer-html5" lang="en" >
+<head>
+ <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Nested Interrupts — NuttX latest documentation</title>
+ <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
+ <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
+ <link rel="stylesheet" href="../_static/tabs.css" type="text/css" />
+ <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
+ <link rel="shortcut icon" href="../_static/favicon.ico"/>
+ <!--[if lt IE 9]>
+ <script src="../_static/js/html5shiv.min.js"></script>
+ <![endif]-->
+
+ <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
+ <script src="../_static/jquery.js"></script>
+ <script src="../_static/underscore.js"></script>
+ <script src="../_static/doctools.js"></script>
+ <script src="../_static/js/theme.js"></script>
+ <link rel="index" title="Index" href="../genindex.html" />
+ <link rel="search" title="Search" href="../search.html" />
+ <link rel="next" title="Glossary" href="../glossary.html" />
+ <link rel="prev" title="High Performance, Zero Latency Interrupts" href="zerolatencyinterrupts.html" />
+</head>
+
+<body class="wy-body-for-nav">
+ <div class="wy-grid-for-nav">
+ <nav data-toggle="wy-nav-shift" class="wy-nav-side">
+ <div class="wy-side-scroll">
+ <div class="wy-side-nav-search" >
+
+ <a href="../index.html" class="icon icon-home"> NuttX
+
+
+
+
+ <img src="../_static/NuttX.png" class="logo" alt="Logo"/>
+
+ </a>
+
+ <!-- this version selector is quite ugly, should be probably replaced by something
+ more modern -->
+
+ <div class="version-selector">
+ <select onchange="javascript:location.href = this.value;">
+
+ <option value="../../latest" selected="selected">latest</option>
+
+ <option value="../../10.0.0" >10.0.0</option>
+
+ <option value="../../10.0.1" >10.0.1</option>
+
+ <option value="../../10.1.0" >10.1.0</option>
+
+ <option value="../../10.2.0" >10.2.0</option>
+
+ <option value="../../10.3.0" >10.3.0</option>
+
+ <option value="../../11.0.0" >11.0.0</option>
+
+ <option value="../../12.0.0" >12.0.0</option>
+
+ <option value="../../12.1.0" >12.1.0</option>
+
+ </select>
+ </div>
+
+
+<div role="search">
+ <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
+ <input type="text" name="q" placeholder="Search docs" />
+ <input type="hidden" name="check_keywords" value="yes" />
+ <input type="hidden" name="area" value="default" />
+ </form>
+</div>
+
+ </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
+ <p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
+<ul class="current">
+<li class="toctree-l1"><a class="reference internal" href="../index.html">Home</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../introduction/index.html">Introduction</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../quickstart/index.html">Getting Started</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../platforms/index.html">Supported Platforms</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../components/index.html">OS Components</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../applications/index.html">Applications</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../reference/index.html">API Reference</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../faq/index.html">FAQ</a></li>
+<li class="toctree-l1 current"><a class="reference internal" href="index.html">Guides</a><ul class="current">
+<li class="toctree-l2"><a class="reference internal" href="nfs.html">NFS Client How-To</a></li>
+<li class="toctree-l2"><a class="reference internal" href="usbtrace.html">USB Device Trace</a></li>
+<li class="toctree-l2"><a class="reference internal" href="simulator.html">Simulator</a></li>
+<li class="toctree-l2"><a class="reference internal" href="qemugdb.html">How to debug NuttX using QEMU and GDB</a></li>
+<li class="toctree-l2"><a class="reference internal" href="rndis.html">How to use RNDIS</a></li>
+<li class="toctree-l2"><a class="reference internal" href="drivers.html">Drivers</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tasktrace.html">Task Trace</a></li>
+<li class="toctree-l2"><a class="reference internal" href="cpp_cmake.html">C++ Example using CMake</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
+<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
+<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2 current"><a class="current reference internal" href="#">Nested Interrupts</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#are-nested-interrupts-needed">Are Nested Interrupts Needed?</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#layered-interrupt-handling-architecture">Layered Interrupt Handling Architecture</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#how-to-implement-nested-interrupts-in-the-layered-interrupt-handling-architecture">How to Implement Nested Interrupts in the Layered Interrupt Handling Architecture</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#svcall-vs-pendsv">SVCall vs PendSV</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#what-could-go-wrong">What Could Go Wrong?</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
+</ul>
+
+ </div>
+ </div>
+ </nav>
+
+ <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
+ <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
+ <a href="../index.html">NuttX</a>
+ </nav>
+
+ <div class="wy-nav-content">
+ <div class="rst-content">
+ <div role="navigation" aria-label="Page navigation">
+ <ul class="wy-breadcrumbs">
+ <li><a href="../index.html" class="icon icon-home"></a> »</li>
+ <li><a href="index.html">Guides</a> »</li>
+ <li>Nested Interrupts</li>
+ <li class="wy-breadcrumbs-aside">
+ <a href="../_sources/guides/nestedinterrupts.rst.txt" rel="nofollow"> View page source</a>
+ </li>
+ </ul>
+ <hr/>
+</div>
+ <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
+ <div itemprop="articleBody">
+
+ <section id="nested-interrupts">
+<h1>Nested Interrupts<a class="headerlink" href="#nested-interrupts" title="Permalink to this headline"></a></h1>
+<section id="are-nested-interrupts-needed">
+<h2>Are Nested Interrupts Needed?<a class="headerlink" href="#are-nested-interrupts-needed" title="Permalink to this headline"></a></h2>
+<p>Most NuttX architectures do not support nested interrupts: Interrupts
+are disabled when the interrupt is entered and restored when the
+interrupt returns. Being able to handle nested interrupt is critical in
+simple architectures where a lot of interrupt level processing is
+performed: In this case, you can prioritize interrupts and assure that
+the highest priority interrupt processing is not delayed by lower level
+interrupt processing.</p>
+<p>In an RTOS model, however, all interrupt processing should be as brief
+as possible; any extended processing should be deferred to a user task
+and not performed in the interrupt handler. However, you may find a need
+to have nested interrupt handling in NuttX too. The lack of support of
+nested interrupts is not inherently an issue with NuttX and need not be
+the case; it should be a simple matter to modify the interrupt handling
+so that interrupts are nested.</p>
+</section>
+<section id="layered-interrupt-handling-architecture">
+<h2>Layered Interrupt Handling Architecture<a class="headerlink" href="#layered-interrupt-handling-architecture" title="Permalink to this headline"></a></h2>
+<p>Interrupt handling occurs in several files. In most implementations,
+there are several layers of interrupt handling logic:</p>
+<ol class="arabic simple">
+<li><p>Some low-level logic, usually in assembly language, that catches the
+interrupt and determines the IRQ number. Consider
+<code class="docutils literal notranslate"><span class="pre">arch/arm/src/armv7-m/up_exception.S</span></code> as an example for the
+Cortex-M family.</p></li>
+<li><p>That low-level logic than calls some MCU-specific, intermediate level
+function usually called <code class="docutils literal notranslate"><span class="pre">up_doirq()</span></code>. An example is
+<code class="docutils literal notranslate"><span class="pre">arch/arm/src/armv7-m/up_doirq.c</span></code>.</p></li>
+<li><p>That MCU-specific function then calls the NuttX common interrupt
+dispatching logic <code class="docutils literal notranslate"><span class="pre">irq_dispatch()</span></code> that can be found at
+<code class="docutils literal notranslate"><span class="pre">sched/irq_dispatch.c</span></code>.</p></li>
+</ol>
+</section>
+<section id="how-to-implement-nested-interrupts-in-the-layered-interrupt-handling-architecture">
+<h2>How to Implement Nested Interrupts in the Layered Interrupt Handling Architecture<a class="headerlink" href="#how-to-implement-nested-interrupts-in-the-layered-interrupt-handling-architecture" title="Permalink to this headline"></a></h2>
+<p>The logic in these first two levels that would have to change to support
+nested interrupt handling. Here is one technical approach to do that:</p>
+<ol class="arabic simple">
+<li><p>Add a global variable, say <code class="docutils literal notranslate"><span class="pre">g_nestlevel</span></code>, that counts the interrupt
+nesting level. It would have an initial value of zero; it would be
+incremented on each interrupt entry and decremented on interrupt exit
+(making sure that interrupts are disabled in each case because
+incrementing and decrementing are not usually atomic operations).</p></li>
+<li><p>At the lowest level, there is usually some assembly language logic
+that will switch from the user’s stack to a special interrupt level
+stack. This behavior is controlled <code class="docutils literal notranslate"><span class="pre">CONFIG_ARCH_INTERRUPTSTACK</span></code>.
+The logic here would have to change in the following way: If
+<code class="docutils literal notranslate"><span class="pre">g_nestlevel</span></code> is zero then behave as normal, switching from the
+user to the interrupt stack; if <code class="docutils literal notranslate"><span class="pre">g_nestlevel</span></code> is greater than zero,
+then do not switch stacks. In this latter case, we are already using
+the interrupt stack.</p></li>
+<li><p>In the middle-level, MCU-specific is where the <code class="docutils literal notranslate"><span class="pre">g_nestlevel</span></code> would
+be increment. And here some additional decision must be made based on
+the state of <code class="docutils literal notranslate"><span class="pre">g_nestlevel</span></code>. If <code class="docutils literal notranslate"><span class="pre">g_nestlevel</span></code> is zero, then we
+have interrupted user code and we need to handle the context
+information specially and handle interrupt level context switches. If
+<code class="docutils literal notranslate"><span class="pre">g_nestlevel</span></code> is greater than zero, then the interrupt handler was
+interrupt by an interrupt. In this case, the interrupt handling must
+always return to the interrupt handler. No context switch can occur
+here. No context switch can occur until the outermost, nested
+interrupt handler returns to the user task.</p></li>
+<li><p>You would also need to support some kind of critical section within
+interrupt handlers to prevent nested interrupts. For example, within
+the logic of functions like <code class="docutils literal notranslate"><span class="pre">up_block_task()</span></code>. Such logic must be
+atomic in any case.</p></li>
+</ol>
+<p><strong>NOTE 1</strong>: The ARMv7-M could also be configured to use separate MSP and
+PSP stacks with the interupt processing using the MSP stack and the
+tasks all using the PSP stacks. This is not compatible with certain
+parts of the existing design and would be more effort, but could result
+in a better solution.</p>
+<p><strong>NOTE 2</strong>: SMP has this same issue as 2 but it is addressed
+differently: With SMP there is an array of stacks indexed by the CPU
+number so that all CPUs get to have an interrupt stack. See for
+example,
+<a class="reference external" href="https://bitbucket.org/nuttx/nuttx/src/ca4ef377fb789ddc3e70979b28acb6730ff6a98c/arch/arm/src/lc823450/chip.h">LC823450</a>
+or
+<a class="reference external" href="https://bitbucket.org/nuttx/nuttx/src/ca4ef377fb789ddc3e70979b28acb6730ff6a98c/arch/arm/src/imx6/chip.h">i.MX6</a>
+SMP logic.</p>
+<p>A generic <code class="docutils literal notranslate"><span class="pre">up_doirq()</span></code> might look like the following. It can be very
+simple because interrupts are disabled:</p>
+<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">uint32_t</span><span class="w"> </span><span class="o">*</span><span class="nf">up_doirq</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">irq</span><span class="p">,</span><span class="w"> </span><span class="kt">uint32_t</span><span class="w"> </span><span class="o">*</span><span class="n">regs</span><span class="p">)</span><span class="w"></span>
+<span class="p">{</span><span class="w"></span>
+<span class="w"> </span><span class="cm">/* Current regs non-zero indicates that we are processing an interrupt;</span>
+<span class="cm"> * current_regs is also used to manage interrupt level context switches.</span>
+<span class="cm"> */</span><span class="w"></span>
+
+<span class="w"> </span><span class="n">current_regs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">regs</span><span class="p">;</span><span class="w"></span>
+
+<span class="w"> </span><span class="cm">/* Deliver the IRQ */</span><span class="w"></span>
+
+<span class="w"> </span><span class="n">irq_dispatch</span><span class="p">(</span><span class="n">irq</span><span class="p">,</span><span class="w"> </span><span class="n">regs</span><span class="p">);</span><span class="w"></span>
+
+<span class="w"> </span><span class="cm">/* If a context switch occurred while processing the interrupt then</span>
+<span class="cm"> * current_regs may have change value. If we return any value different</span>
+<span class="cm"> * from the input regs, then the lower level will know that a context</span>
+<span class="cm"> * switch occurred during interrupt processing.</span>
+<span class="cm"> */</span><span class="w"></span>
+
+<span class="w"> </span><span class="n">regs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kt">uint32_t</span><span class="o">*</span><span class="p">)</span><span class="n">current_regs</span><span class="p">;</span><span class="w"></span>
+<span class="w"> </span><span class="n">current_regs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span><span class="w"></span>
+<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">regs</span><span class="p">;</span><span class="w"></span>
+<span class="p">}</span><span class="w"></span>
+</pre></div>
+</div>
+<p>What has to change to support nested interrupts is:</p>
+<ol class="arabic simple">
+<li><p>If we are nested, then we must retain the original value of
+<code class="docutils literal notranslate"><span class="pre">current_regs</span></code>. This will be need when the outermost interrupt
+handler returns in order to handle interrupt level context switches.</p></li>
+<li><p>If we are nested, then we need to always return the same value of
+<code class="docutils literal notranslate"><span class="pre">regs</span></code> that was received.</p></li>
+</ol>
+<p>So the modified version of <code class="docutils literal notranslate"><span class="pre">up_doirq()</span></code> would be as follows. Here we
+assume that interrupts are enabled.</p>
+<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">uint32_t</span><span class="w"> </span><span class="o">*</span><span class="nf">up_doirq</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">irq</span><span class="p">,</span><span class="w"> </span><span class="kt">uint32_t</span><span class="w"> </span><span class="o">*</span><span class="n">regs</span><span class="p">)</span><span class="w"></span>
+<span class="p">{</span><span class="w"></span>
+<span class="w"> </span><span class="n">irqstate_t</span><span class="w"> </span><span class="n">flags</span><span class="p">;</span><span class="w"></span>
+
+<span class="w"> </span><span class="cm">/* Current regs non-zero indicates that we are processing an interrupt;</span>
+<span class="cm"> * regs holds the state of the interrupted logic; current_regs holds the</span>
+<span class="cm"> * state of the interrupted user task. current_regs should, therefor,</span>
+<span class="cm"> * only be modified for outermost interrupt handler (when g_nestlevel == 0)</span>
+<span class="cm"> */</span><span class="w"></span>
+
+<span class="w"> </span><span class="n">flags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">irqsave</span><span class="p">();</span><span class="w"></span>
+<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">g_nestlevel</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"></span>
+<span class="w"> </span><span class="p">{</span><span class="w"></span>
+<span class="w"> </span><span class="n">current_regs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">regs</span><span class="p">;</span><span class="w"></span>
+<span class="w"> </span><span class="p">}</span><span class="w"></span>
+<span class="w"> </span><span class="n">g_nestlevel</span><span class="o">++</span><span class="w"></span>
+<span class="w"> </span><span class="n">irqrestore</span><span class="p">(</span><span class="n">flags</span><span class="p">);</span><span class="w"></span>
+
+<span class="w"> </span><span class="cm">/* Deliver the IRQ */</span><span class="w"></span>
+
+<span class="w"> </span><span class="n">irq_dispatch</span><span class="p">(</span><span class="n">irq</span><span class="p">,</span><span class="w"> </span><span class="n">regs</span><span class="p">);</span><span class="w"></span>
+
+<span class="w"> </span><span class="cm">/* Context switches are indicated by the returned value of this function.</span>
+<span class="cm"> * If a context switch occurred while processing the interrupt then</span>
+<span class="cm"> * current_regs may have change value. If we return any value different</span>
+<span class="cm"> * from the input regs, then the lower level will know that a context</span>
+<span class="cm"> * switch occurred during interrupt processing. Context switching should</span>
+<span class="cm"> * only be performed when the outermost interrupt handler returns.</span>
+<span class="cm"> */</span><span class="w"></span>
+
+<span class="w"> </span><span class="n">flags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">irqsave</span><span class="p">();</span><span class="w"></span>
+<span class="w"> </span><span class="n">g_nestlevel</span><span class="o">--</span><span class="p">;</span><span class="w"></span>
+<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">g_nestlevel</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"></span>
+<span class="w"> </span><span class="p">{</span><span class="w"></span>
+<span class="w"> </span><span class="n">regs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kt">uint32_t</span><span class="o">*</span><span class="p">)</span><span class="n">current_regs</span><span class="p">;</span><span class="w"></span>
+<span class="w"> </span><span class="n">current_regs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span><span class="w"></span>
+<span class="w"> </span><span class="p">}</span><span class="w"></span>
+
+<span class="w"> </span><span class="cm">/* Note that interrupts are left disabled. This needed if context switch</span>
+<span class="cm"> * will be performed. But, any case, the correct interrupt state should</span>
+<span class="cm"> * be restored when returning from the interrupt.</span>
+<span class="cm"> */</span><span class="w"></span>
+
+<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">regs</span><span class="p">;</span><span class="w"></span>
+<span class="p">}</span><span class="w"></span>
+</pre></div>
+</div>
+<p><strong>NOTE:</strong> An alternative, cleaner design might also be possible. If one
+were to defer all context switching to a <em>PendSV</em> handler, then the
+interrupts could vector to the <code class="docutils literal notranslate"><span class="pre">do_irq()</span></code> logic and then all
+interrupts would be naturally nestable.</p>
+</section>
+<section id="svcall-vs-pendsv">
+<h2>SVCall vs PendSV<a class="headerlink" href="#svcall-vs-pendsv" title="Permalink to this headline"></a></h2>
+<p>An issue that may be related to nested interrupt handling is the use of
+the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> exceptions in NuttX. The <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> exception is used as
+a classic software interrupt in NuttX for performing context switches,
+user- to kernel-mode changes (and vice versa), and also for system calls
+when NuttX is built as a kernel.</p>
+<p><code class="docutils literal notranslate"><span class="pre">SVCall</span></code> exceptions are never performed from interrupt level, handler
+mode processing; only from thread mode logic. The <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> exception
+is used as follows to perform the system call:</p>
+<ul class="simple">
+<li><p>All interrupts are disabled: There are a few steps the must be
+performed in a critical section. Those setups and the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> must
+work as a single, uninterrupted atomic action.</p></li>
+<li><p>A special register setup is put in place: Parameters are passed to the
+<code class="docutils literal notranslate"><span class="pre">SVCall</span></code> in registers just as with a normal function call.</p></li>
+<li><p>The Cortex SVC instruction is executed. This causes the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code>
+exception which is dispatched to the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> exception handler.
+This exception must occur while the input register setup is in place;
+it cannot be deferred and perform at some later time. The <code class="docutils literal notranslate"><span class="pre">SVCall</span></code>
+exception handler decodes the registers and performs the requested
+operation. If no context switch occurs, the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> will return to
+the caller immediately.</p></li>
+<li><p>Upon return interrupts will be re-enabled.</p></li>
+</ul>
+<p>So what does this have to do with nested interrupt handling? Since
+interrupts are disabled throughout the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> sequence, nothing
+really. However, there are some concerns because if the <code class="docutils literal notranslate"><span class="pre">BASEPRI</span></code> is
+used to disable interrupts then the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> exception must have the
+highest priority: The <code class="docutils literal notranslate"><span class="pre">BASEPRI</span></code> register is set to disable all
+interrupt except for the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code>.</p>
+<p>The motivation for supporting nested interrupts is, presumably, to make
+sure that certain high priority interrupts are not delayed by lower
+processing interrupt handling. Since the <code class="docutils literal notranslate"><span class="pre">SVCall</span></code> exception has
+highest priority, it will delay all other interrupts (but, of course,
+disabling interrupt also delays all other interrupts).</p>
+<p>The PendSV exception is another mechanism offered by the Cortex
+architecture. It has been suggested that some of these issues with the
+<code class="docutils literal notranslate"><span class="pre">SVCall</span></code> exception could be avoided by using the PendSV interrupt. The
+architecture that would use the PendSV exception instead of the
+<code class="docutils literal notranslate"><span class="pre">SVCall</span></code> interrupt is not clear in my mind. But I will keep this note
+here for future reference if this were to become as issue.</p>
+</section>
+<section id="what-could-go-wrong">
+<h2>What Could Go Wrong?<a class="headerlink" href="#what-could-go-wrong" title="Permalink to this headline"></a></h2>
+<p>Whenever you deal with logic at software hardware interface, lots of
+things can go wrong. But, aside from that general risk, the only
+specific NuttX risk issue is that you may uncover some subtle interrupt
+level logic that assumes that interrupts are already disabled. In those
+cases, additional critical sections may be needed inside of the
+interrupt level processing. The likelihood of such a thing is probably
+pretty low, but cannot be fully discounted.</p>
+</section>
+</section>
+
+
+ </div>
+ </div>
+ <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
+ <a href="zerolatencyinterrupts.html" class="btn btn-neutral float-left" title="High Performance, Zero Latency Interrupts" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
+ <a href="../glossary.html" class="btn btn-neutral float-right" title="Glossary" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
+ </div>
+
+ <hr/>
+
+ <div role="contentinfo">
+ <p>© Copyright 2020, The Apache Software Foundation.</p>
+ </div>
+
+
+
+</footer>
+ </div>
+ </div>
+ </section>
+ </div>
+ <script>
+ jQuery(function () {
+ SphinxRtdTheme.Navigation.enable(true);
+ });
+ </script>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/content/docs/latest/guides/nfs.html b/content/docs/latest/guides/nfs.html
index 75bf07f7..72bc43d1 100644
--- a/content/docs/latest/guides/nfs.html
+++ b/content/docs/latest/guides/nfs.html
@@ -126,6 +126,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/pysimcoder.html b/content/docs/latest/guides/pysimcoder.html
index f059bc53..be589ff6 100644
--- a/content/docs/latest/guides/pysimcoder.html
+++ b/content/docs/latest/guides/pysimcoder.html
@@ -125,6 +125,8 @@
</li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/qemugdb.html b/content/docs/latest/guides/qemugdb.html
index c1f641e7..d3d9d0dd 100644
--- a/content/docs/latest/guides/qemugdb.html
+++ b/content/docs/latest/guides/qemugdb.html
@@ -125,6 +125,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/rndis.html b/content/docs/latest/guides/rndis.html
index 38a840ef..c369b548 100644
--- a/content/docs/latest/guides/rndis.html
+++ b/content/docs/latest/guides/rndis.html
@@ -125,6 +125,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/simulator.html b/content/docs/latest/guides/simulator.html
index 1507b5d4..a5d453bf 100644
--- a/content/docs/latest/guides/simulator.html
+++ b/content/docs/latest/guides/simulator.html
@@ -128,6 +128,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/tasktrace.html b/content/docs/latest/guides/tasktrace.html
index dcec0664..75ae58e5 100644
--- a/content/docs/latest/guides/tasktrace.html
+++ b/content/docs/latest/guides/tasktrace.html
@@ -124,6 +124,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/tasktraceinternal.html b/content/docs/latest/guides/tasktraceinternal.html
index 0a61f042..9668d653 100644
--- a/content/docs/latest/guides/tasktraceinternal.html
+++ b/content/docs/latest/guides/tasktraceinternal.html
@@ -139,6 +139,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/tasktraceuser.html b/content/docs/latest/guides/tasktraceuser.html
index ddd67d25..3ac31986 100644
--- a/content/docs/latest/guides/tasktraceuser.html
+++ b/content/docs/latest/guides/tasktraceuser.html
@@ -145,6 +145,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/usbtrace.html b/content/docs/latest/guides/usbtrace.html
index 1605991d..cc1f7b68 100644
--- a/content/docs/latest/guides/usbtrace.html
+++ b/content/docs/latest/guides/usbtrace.html
@@ -120,6 +120,8 @@
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/guides/zerolatencyinterrupts.html b/content/docs/latest/guides/zerolatencyinterrupts.html
index c738d7b1..f5d2a198 100644
--- a/content/docs/latest/guides/zerolatencyinterrupts.html
+++ b/content/docs/latest/guides/zerolatencyinterrupts.html
@@ -39,7 +39,9 @@
<script src="../_static/doctools.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
- <link rel="search" title="Search" href="../search.html" />
+ <link rel="search" title="Search" href="../search.html" />
+ <link rel="next" title="Nested Interrupts" href="nestedinterrupts.html" />
+ <link rel="prev" title="Custom Apps How-to" href="customapps.html" />
</head>
<body class="wy-body-for-nav">
@@ -95,7 +97,7 @@
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
-<ul>
+<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">Home</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../quickstart/index.html">Getting Started</a></li>
@@ -106,7 +108,36 @@
<li class="toctree-l1"><a class="reference internal" href="../applications/index.html">Applications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../reference/index.html">API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq/index.html">FAQ</a></li>
-<li class="toctree-l1"><a class="reference internal" href="index.html">Guides</a></li>
+<li class="toctree-l1 current"><a class="reference internal" href="index.html">Guides</a><ul class="current">
+<li class="toctree-l2"><a class="reference internal" href="nfs.html">NFS Client How-To</a></li>
+<li class="toctree-l2"><a class="reference internal" href="usbtrace.html">USB Device Trace</a></li>
+<li class="toctree-l2"><a class="reference internal" href="simulator.html">Simulator</a></li>
+<li class="toctree-l2"><a class="reference internal" href="qemugdb.html">How to debug NuttX using QEMU and GDB</a></li>
+<li class="toctree-l2"><a class="reference internal" href="rndis.html">How to use RNDIS</a></li>
+<li class="toctree-l2"><a class="reference internal" href="drivers.html">Drivers</a></li>
+<li class="toctree-l2"><a class="reference internal" href="tasktrace.html">Task Trace</a></li>
+<li class="toctree-l2"><a class="reference internal" href="cpp_cmake.html">C++ Example using CMake</a></li>
+<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
+<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
+<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2 current"><a class="current reference internal" href="#">High Performance, Zero Latency Interrupts</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#generic-interrupt-handling">Generic Interrupt Handling</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#bypassing-the-generic-interrupt-handling">Bypassing the Generic Interrupt Handling</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#getting-back-into-the-game">Getting Back into the Game</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#nested-interrupt-handling">Nested Interrupt Handling</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#cortex-m3-4-implementation">Cortex-M3/4 Implementation</a><ul>
+<li class="toctree-l4"><a class="reference internal" href="#configuration-options">Configuration Options</a></li>
+<li class="toctree-l4"><a class="reference internal" href="#disabling-the-high-priority-interrupt">Disabling the High Priority Interrupt</a></li>
+<li class="toctree-l4"><a class="reference internal" href="#dependencies">Dependencies</a></li>
+<li class="toctree-l4"><a class="reference internal" href="#configuring-high-priority-interrupts">Configuring High Priority Interrupts</a></li>
+<li class="toctree-l4"><a class="reference internal" href="#example-code">Example Code</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
+</ul>
+</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
</ul>
@@ -124,6 +155,7 @@
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> »</li>
+ <li><a href="index.html">Guides</a> »</li>
<li>High Performance, Zero Latency Interrupts</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/guides/zerolatencyinterrupts.rst.txt" rel="nofollow"> View page source</a>
@@ -141,17 +173,24 @@
<p>NuttX includes a generic interrupt handling subsystem that makes it
convenient to deal with interrupts using only IRQ numbers. In order to
integrate with this generic interrupt handling system, the platform
-specific code is expected to collect all thread state into an container,
+specific code is expected to collect all thread state into a container,
<code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">xcptcontext</span></code>. This container represents the full state of the
thread and can be saved, restored, and exchanged as a <em>unit of thread</em>.</p>
<p>While this state saving has many useful benefits, it does require
processing time. It was reported to me that this state saving required
about two microseconds on an STM32F4Discovery board. That added
-interrupt latency might be an issue in some circumstance.</p>
-<p><strong>Terminology:</strong> The concepts discussed in this Wiki are not unique to
-NuttX. Other RTOS have similar concepts but will use different
+interrupt latency might be an issue in some circumstances.</p>
+<p>In addition, critical sections that are required in various places
+throughout the RTOS can pause interrupt handling momentarily. This
+increases the latency for those interrupts which become pending during a
+critical section. As this is likely to occur for some instances of an
+interrupt and not others, the interrupt latency varies from time to time
+(experiences <em>jitter</em>). Like the added latency discussed above, that
+jitter might be an issue in some circumstances.</p>
+<p><strong>Terminology:</strong> The concepts discussed in this guide are not unique to
+NuttX. Other RTOSes have similar concepts but will use different
terminology. The <a class="reference external" href="https://www.embedded.com/design/operating-systems/4461604/Interrupts-in-the-Nucleus-SE-RTOS">Nucleus</a>
-RTOS, for example use the terms <em>Native</em> and <em>Managed</em> interrupts.</p>
+RTOS, for example, uses the terms <em>Native</em> and <em>Managed</em> interrupts.</p>
</section>
<section id="bypassing-the-generic-interrupt-handling">
<h2>Bypassing the Generic Interrupt Handling<a class="headerlink" href="#bypassing-the-generic-interrupt-handling" title="Permalink to this headline"></a></h2>
@@ -178,43 +217,37 @@ and detach custom vector handlers by writing directly to the vector
table. The ARM Cortex-M port provides interfaces to support this mode
when the <code class="docutils literal notranslate"><span class="pre">CONFIG_ARCH_RAMVECTORS</span></code> option is enabled.</p>
<p>So what is the downside? There are two:</p>
-<blockquote>
-<div><ul class="simple">
-<li><p>Your custom interrupt handler will not have collected its state
-into the <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">xcptcontext</span></code> container. Therefore, it cannot
-communicate with operating system. Your custom interrupt handler
-has been taken “out of the game” and can no longer work with the
-system.</p></li>
-<li><p>If your custom interrupt is truly going to be <em>high performance</em>
-then you will also have to support nested interrupts! The custom
-interrupt must have a high priority and must be able interrupt the
-generic interrupt handling logic. Otherwise, it will be
-occasionally delayed when there is a collision between your custom
-interrupt and other, lower priority interrupts.</p></li>
+<ul class="simple">
+<li><p>Your custom interrupt handler will not have collected its state into
+the <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">xcptcontext</span></code> container. Therefore, it cannot communicate
+with operating system. Your custom interrupt handler has been taken
+“out of the game” and can no longer work with the system.</p></li>
+<li><p>If your custom interrupt is truly going to be <em>high performance</em> then
+you will also have to support nested interrupts! The custom interrupt
+must have a high priority and must be able interrupt the generic
+interrupt handling logic. Otherwise, it will be occasionally delayed
+when there is a collision between your custom interrupt and other,
+lower priority interrupts.</p></li>
</ul>
-</div></blockquote>
</section>
<section id="getting-back-into-the-game">
<h2>Getting Back into the Game<a class="headerlink" href="#getting-back-into-the-game" title="Permalink to this headline"></a></h2>
-<p>As mentioned, the custom interrupt handler can not use most of the
-service of the OS since it has not created a <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">xcptcontext</span></code>
+<p>As mentioned, the custom interrupt handler cannot use most of the
+services of the OS since it has not created a <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">xcptcontext</span></code>
container. So it needs a mechanism to “get back into the game” when it
needs to interact with the operating system to, for example, post a
semaphore, signal a thread, or send a message.</p>
<p>The ARM Cortex-M family supports a special way to do this using the
<em>PendSV</em> interrupt:</p>
-<blockquote>
-<div><ul class="simple">
-<li><p>The custom logic would connect with the <em>PendSV</em> interrupt using
-the standard <code class="docutils literal notranslate"><span class="pre">irq_attach()</span></code> interface.</p></li>
+<ul class="simple">
+<li><p>The custom logic would connect with the <em>PendSV</em> interrupt using the
+standard <code class="docutils literal notranslate"><span class="pre">irq_attach()</span></code> interface.</p></li>
<li><p>In the custom interrupt handler, it would schedule the <em>PendSV</em>
interrupt when it needs to communicate with the OS.</p></li>
-<li><p>The <em>PendSV</em> interrupt is dispatched through generic interrupt
-system so when the attached <em>PendSV</em> interrupt is handled, it
-will be in a context where it can perform any necessary OS
-interactions.</p></li>
+<li><p>The <em>PendSV</em> interrupt is dispatched through the generic interrupt
+system so when the attached <em>PendSV</em> interrupt is handled, it will be
+in a context where it can perform any necessary OS interactions.</p></li>
</ul>
-</div></blockquote>
<p>With the ARMv7_M architecture, the <em>PendSV</em> interrupt can be generated
with:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">up_trigger_irq</span><span class="p">(</span><span class="n">NVIC_IRQ_PENDSV</span><span class="p">);</span><span class="w"></span>
@@ -231,35 +264,31 @@ scope of this Wiki page.</p>
<section id="nested-interrupt-handling">
<h2>Nested Interrupt Handling<a class="headerlink" href="#nested-interrupt-handling" title="Permalink to this headline"></a></h2>
<p>Some general notes about nested interrupt handling are provided in
-another <a class="reference external" href="https://cwiki.apache.org/confluence/display/NUTTX/Nested+Interrupts">Wiki page</a>.
-In this case, handling the nested custom interrupt is simpler because
-the generic interrupt handler is not re-entered. Rather, the generic
-interrupt handler must simply be made to co-exist with the custom
-interrupt interrupt handler.</p>
+<span class="xref std std-doc"><nestedinterrupts.rst></span>. In this case, handling the nested custom
+interrupt is simpler because the generic interrupt handler is not
+re-entered. Rather, the generic interrupt handler must simply be made to
+co-exist with the custom interrupt interrupt handler.</p>
<p>Modifications may be required to the generic interrupt handling logic
to accomplish. A few points need to be made here:</p>
-<blockquote>
-<div><ul class="simple">
+<ul class="simple">
<li><p>The MCU should support interrupt prioritization so that the custom
interrupt can be scheduled with a higher priority.</p></li>
<li><p>The generic interrupt handlers currently disable interrupts during
-interrupts. Instead, they must be able to keep the custom
-interrupt enabled throughout interrupt process but still prevent
-re-entrancy by other standard interrupts (This can be done by
-setting an interrupt base priority level in the Cortex-M family).</p></li>
-<li><p>The custom interrupt handler can now interrupt the generic
-interrupt handler at any place. Is the logic safe in all cases to
-be interrupted? Sometimes interrupt handlers place the MCU in
-momentarily perverse states while registers are being
-manipulated. Make sure that it is safe to take interrupts at any
-time (or else keep the interrupts disabled in the critical
-times).</p></li>
-<li><p>Will the custom interrupt handler have all of the resources it
-needs in place when it occurs? Will it have a valid stack
-pointer? (In the Cortex-M implementation, for example, the MSP
-may not be valid when the custom interrupt handler is entered).</p></li>
+interrupts. Instead, they must be able to keep the custom interrupt
+enabled throughout interrupt process but still prevent re-entrancy by
+other standard interrupts (This can be done by setting an interrupt
+base priority level in the Cortex-M family).</p></li>
+<li><p>The custom interrupt handler can now interrupt the generic interrupt
+handler at any place. Is the logic safe in all cases to be
+interrupted? Sometimes interrupt handlers place the MCU in momentarily
+perverse states while registers are being manipulated. Make sure that
+it is safe to take interrupts at any time (or else keep the interrupts
+disabled in the critical times).</p></li>
+<li><p>Will the custom interrupt handler have all of the resources it needs
+in place when it occurs? Will it have a valid stack pointer? (In the
+Cortex-M implementation, for example, the MSP may not be valid when
+the custom interrupt handler is entered).</p></li>
</ul>
-</div></blockquote>
<p>Some of these issues are complex and so you should expect some
complexity in getting the nested interrupt handler to work.</p>
</section>
@@ -310,17 +339,14 @@ priority interrupts.</p>
</section>
<section id="dependencies">
<h3>Dependencies<a class="headerlink" href="#dependencies" title="Permalink to this headline"></a></h3>
-<blockquote>
-<div><ul class="simple">
+<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_ARCH_HAVE_IRQPRIO</span></code>. Support for prioritized interrupt
support must be enabled.</p></li>
<li><p>Floating Point Registers. If used with a Cortex-M4 that supports
-hardware floating point, you cannot use hardware floating point
-in the high priority interrupt handler UNLESS you use the common
-vector logic that supports saving of floating point registers on
-all interrupts.</p></li>
+hardware floating point, you cannot use hardware floating point in the
+high priority interrupt handler UNLESS you use the common vector logic
+that supports saving of floating point registers on all interrupts.</p></li>
</ul>
-</div></blockquote>
</section>
<section id="configuring-high-priority-interrupts">
<h3>Configuring High Priority Interrupts<a class="headerlink" href="#configuring-high-priority-interrupts" title="Permalink to this headline"></a></h3>
@@ -329,17 +355,14 @@ things:</p>
<p>First, You need to change the address in the vector table so that the
high priority interrupt vectors to your special C interrupt handler.
There are two ways to do this:</p>
-<blockquote>
-<div><ul class="simple">
-<li><p>If you select <code class="docutils literal notranslate"><span class="pre">CONFIG_ARCH_RAMVECTORS</span></code>, then vectors will be
-kept in RAM and the system will support the interface: <code class="docutils literal notranslate"><span class="pre">int</span>
-<span class="pre">up_ramvec_attach(int</span> <span class="pre">irq,</span> <span class="pre">up_vector_t</span> <span class="pre">vector)</span></code>. That interface
-can be used to attach your C interrupt handler to the vector at
-run time.</p></li>
-<li><p>Alternatively, you could keep your vectors in FLASH but in order
-to this, you would have to develop your own custom vector table.</p></li>
+<ul class="simple">
+<li><p>If you select <code class="docutils literal notranslate"><span class="pre">CONFIG_ARCH_RAMVECTORS</span></code>, then vectors will be kept in
+RAM and the system will support the interface: <code class="docutils literal notranslate"><span class="pre">int</span>
+<span class="pre">up_ramvec_attach(int</span> <span class="pre">irq,</span> <span class="pre">up_vector_t</span> <span class="pre">vector)</span></code>. That interface can be
+used to attach your C interrupt handler to the vector at run time.</p></li>
+<li><p>Alternatively, you could keep your vectors in FLASH but in order to
+this, you would have to develop your own custom vector table.</p></li>
</ul>
-</div></blockquote>
<p>Second, you need to set the priority of your interrupt to <em>NVIC</em> to
<code class="docutils literal notranslate"><span class="pre">NVIC_SYSH_HIGH_PRIORITY</span></code> using the standard interface:
<code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">up_prioritize_irq(int</span> <span class="pre">irq,</span> <span class="pre">int</span> <span class="pre">priority);</span></code></p>
@@ -347,16 +370,13 @@ to this, you would have to develop your own custom vector table.</p></li>
<section id="example-code">
<h3>Example Code<a class="headerlink" href="#example-code" title="Permalink to this headline"></a></h3>
<p>You can find an example that tests the high priority, nested interrupts in the NuttX source:</p>
-<blockquote>
-<div><ul class="simple">
-<li><p>nuttx/boards/arm/stm32/viewtool-stm32f107/README.txt. Description
-of the configuration</p></li>
-<li><p>nuttx/boards/arm/stm32/viewtool-stm32f107/highpri. Test
-configuration</p></li>
+<ul class="simple">
+<li><p>nuttx/boards/arm/stm32/viewtool-stm32f107/README.txt. Description of
+the configuration</p></li>
+<li><p>nuttx/boards/arm/stm32/viewtool-stm32f107/highpri. Test configuration</p></li>
<li><p>nuttx/boards/arm/stm32/viewtool-stm32f107/src/stm32_highpri. Test
driver.</p></li>
</ul>
-</div></blockquote>
</section>
</section>
</section>
@@ -364,7 +384,10 @@ driver.</p></li>
</div>
</div>
- <footer>
+ <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
+ <a href="customapps.html" class="btn btn-neutral float-left" title="Custom Apps How-to" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
+ <a href="nestedinterrupts.html" class="btn btn-neutral float-right" title="Nested Interrupts" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
+ </div>
<hr/>
diff --git a/content/docs/latest/index.html b/content/docs/latest/index.html
index b237a932..6ea4f0a8 100644
--- a/content/docs/latest/index.html
+++ b/content/docs/latest/index.html
@@ -149,7 +149,7 @@ by following these <a class="reference internal" href="contributing/documentatio
<section id="nuttx-documentation">
<h1>NuttX Documentation<a class="headerlink" href="#nuttx-documentation" title="Permalink to this headline"></a></h1>
<p>NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).</p>
-<p>Last Updated: 19 May 23 at 00:11</p>
+<p>Last Updated: 20 May 23 at 00:11</p>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
@@ -238,6 +238,8 @@ by following these <a class="reference internal" href="contributing/documentatio
<li class="toctree-l2"><a class="reference internal" href="guides/pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="guides/customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="guides/customapps.html">Custom Apps How-to</a></li>
+<li class="toctree-l2"><a class="reference internal" href="guides/zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
+<li class="toctree-l2"><a class="reference internal" href="guides/nestedinterrupts.html">Nested Interrupts</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
diff --git a/content/docs/latest/objects.inv b/content/docs/latest/objects.inv
index 12153b8a..d3d71a0a 100644
Binary files a/content/docs/latest/objects.inv and b/content/docs/latest/objects.inv differ
diff --git a/content/docs/latest/reference/user/07_signals.html b/content/docs/latest/reference/user/07_signals.html
index 3fa7a7bf..04e19f16 100644
--- a/content/docs/latest/reference/user/07_signals.html
+++ b/content/docs/latest/reference/user/07_signals.html
@@ -406,7 +406,7 @@ name.</p>
<dl class="c function">
<dt class="sig sig-object c" id="c.sigaction">
-<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">sigaction</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">signo</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a [...]
+<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">sigaction</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">signo</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a [...]
<dd><p>Allows the calling task to examine and/or
specify the action to be associated with a specific signal.</p>
<p>The structure sigaction, used to describe an action to be taken, is
diff --git a/content/docs/latest/searchindex.js b/content/docs/latest/searchindex.js
index 442cf4f8..472cf161 100644
--- a/content/docs/latest/searchindex.js
+++ b/content/docs/latest/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","applications/wapi/commands","applications/wapi/index","applications/wapi/wireless","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drive [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","applications/nsh/builtin","applications/nsh/commands","applications/nsh/config","applications/nsh/customizing","applications/nsh/index","applications/nsh/installation","applications/nsh/login","applications/nsh/nsh","applications/wapi/commands","applications/wapi/index","applications/wapi/wireless","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drive [...]
\ No newline at end of file
diff --git a/content/feed.xml b/content/feed.xml
index db02fbd0..8c73db48 100644
--- a/content/feed.xml
+++ b/content/feed.xml
@@ -5,8 +5,8 @@
<description></description>
<link>/</link>
<atom:link href="/feed.xml" rel="self" type="application/rss+xml"/>
- <pubDate>Fri, 19 May 2023 00:12:34 +0000</pubDate>
- <lastBuildDate>Fri, 19 May 2023 00:12:34 +0000</lastBuildDate>
+ <pubDate>Sat, 20 May 2023 00:12:02 +0000</pubDate>
+ <lastBuildDate>Sat, 20 May 2023 00:12:02 +0000</lastBuildDate>
<generator>Jekyll v4.3.2</generator>
<item>