summaryrefslogtreecommitdiffstats
path: root/porting/interrupts.rst
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2016-10-28 15:57:11 -0500
committerJoel Sherrill <joel@rtems.org>2016-10-28 15:57:11 -0500
commit7497f5ed9a2cebe06619987e295cae529dde9fad (patch)
treee0fd8a7bf9ba102380a23a50def8115487d167e0 /porting/interrupts.rst
parentfilesystem: Fix numbered lists. (diff)
downloadrtems-docs-7497f5ed9a2cebe06619987e295cae529dde9fad.tar.bz2
porting: Review and tidy up multiple formatting issues.
Diffstat (limited to '')
-rw-r--r--porting/interrupts.rst49
1 files changed, 35 insertions, 14 deletions
diff --git a/porting/interrupts.rst b/porting/interrupts.rst
index d8580ce..c95495d 100644
--- a/porting/interrupts.rst
+++ b/porting/interrupts.rst
@@ -1,5 +1,9 @@
.. comment SPDX-License-Identifier: CC-BY-SA-4.0
+.. COMMENT: COPYRIGHT (c) 1988-2002.
+.. COMMENT: On-Line Applications Research Corporation (OAR).
+.. COMMENT: All rights reserved.
+
Interrupts
##########
@@ -28,6 +32,7 @@ The CPU_MODES_INTERRUPT_MASK macro defines the number of bits actually used in t
The following illustrates how the CPU_MODES_INTERRUPT_MASK is set on a CPU
family like the Intel i386 where the CPU itself only recognizes two
interrupt levels - enabled and disabled.
+
.. code-block:: c
#define CPU_MODES_INTERRUPT_MASK 0x00000001
@@ -36,6 +41,7 @@ Obtaining the Current Interrupt Level
-------------------------------------
The _CPU_ISR_Get_level function returns the current interrupt level.
+
.. code-block:: c
uint32_t _CPU_ISR_Get_level( void )
@@ -54,13 +60,15 @@ manage a programmable interrupt controller via the rtems_task_mode
directive.
The following is a dummy implementation of the _CPU_ISR_Set_level routine:
+
.. code-block:: c
- #define _CPU_ISR_Set_level( new_level ) \\
- { \\
+ #define _CPU_ISR_Set_level( new_level ) \
+ { \
}
The following is the implementation from the Motorola M68K:
+
.. code-block:: c
XXX insert m68k implementation here
@@ -84,14 +92,16 @@ manipulate. It is typically the contents of the processor status
register. It is NOT the same format as manipulated by the
_CPU_ISR_Get_level and _CPU_ISR_Set_level routines. The following is a
dummy implementation that simply sets the previous level to 0.
+
.. code-block:: c
- #define _CPU_ISR_Disable( _isr_cookie ) \\
+ #define _CPU_ISR_Disable( _isr_cookie ) \
{ \
(_isr_cookie) = 0; /* do something to prevent warnings */ \
}
The following is the implementation from the Motorola M68K port:
+
.. code-block:: c
XXX insert m68k port here
@@ -105,13 +115,15 @@ RTEMS critical section to reenable interrupts. The parameter _level is
not modified but indicates that level that interrupts should be enabled
to. The following illustrates a dummy implementation of the
_CPU_ISR_Enable routine:
+
.. code-block:: c
- #define _CPU_ISR_Enable( _isr_cookie ) \\
- { \\
+ #define _CPU_ISR_Enable( _isr_cookie ) \
+ { \
}
The following is the implementation from the Motorola M68K port:
+
.. code-block:: c
XXX insert m68k version here
@@ -126,13 +138,15 @@ preceded by a call to _CPU_ISR_Disable and followed by a call to
_CPU_ISR_Enable. The parameter _level is not modified.
The following is a dummy implementation of the _CPU_ISR_Flash routine:
+
.. code-block:: c
- #define _CPU_ISR_Flash( _isr_cookie ) \\
- { \\
+ #define _CPU_ISR_Flash( _isr_cookie ) \
+ { \
}
The following is the implementation from the Motorola M68K port:
+
.. code-block:: c
XXX insert m68k version here
@@ -179,11 +193,13 @@ in the Interrupt Manager, then the macro CPU_ALLOCATE_INTERRUPT_STACK
should be set to TRUE.
NOTE: This should be TRUE is CPU_HAS_SOFTWARE_INTERRUPT_STACK is TRUE.
+
.. code-block:: c
#define CPU_ALLOCATE_INTERRUPT_STACK TRUE
If the CPU_HAS_SOFTWARE_INTERRUPT_STACK macro is set to TRUE, then RTEMS automatically allocates the stack memory in the initialization of the Interrupt Manager and the switch to that stack is performed in ``_ISR_Handler`` on the outermost interrupt. The _CPU_Interrupt_stack_low and _CPU_Interrupt_stack_high variables contain the addresses of the the lowest and highest addresses of the memory allocated for the interrupt stack. Although technically only one of these addresses is required to switch to the interrupt stack, by always providing both addresses, the port has more options avaialble to it without requiring modifications to the portable parts of the executive. Whether the stack grows up or down, this give the CPU dependent code the option of picking the version it wants to use.
+
.. code-block:: c
SCORE_EXTERN void *_CPU_Interrupt_stack_low;
@@ -200,6 +216,7 @@ The _CPU_Install_interrupt_stack routine XXX
This routine installs the hardware interrupt stack pointer.
NOTE: It need only be provided if CPU_HAS_HARDWARE_INTERRUPT_STAC is TRUE.
+
.. code-block:: c
void _CPU_Install_interrupt_stack( void )
@@ -211,6 +228,7 @@ Install a Raw Interrupt Handler
-------------------------------
The _CPU_ISR_install_raw_handler XXX
+
.. code-block:: c
void _CPU_ISR_install_raw_handler(
@@ -235,10 +253,11 @@ by this CPU model. The second macro is the
CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER. Since the table is zero-based, this
indicates the highest vector number which can be looked up in the table
and mapped into a user provided handler.
+
.. code-block:: c
#define CPU_INTERRUPT_NUMBER_OF_VECTORS 32
- #define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER \\
+ #define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER \
(CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
Install RTEMS Interrupt Handler
@@ -251,6 +270,7 @@ XXX Input parameters:
vector - interrupt vector number
old_handler - former ISR for this vector number
new_handler - replacement ISR for this vector number
+
.. code-block:: c
void _CPU_ISR_install_vector(
@@ -266,12 +286,14 @@ new_handler - replacement ISR for this vector number
If the interrupt vector table is a table of pointer to isr entry points,
then we need to install the appropriate RTEMS interrupt handler for this
vector number.
+
.. code-block:: c
_CPU_ISR_install_raw_handler( vector, new_handler, old_handler );
We put the actual user ISR address in _ISR_vector_table. This will be
used by the ``_ISR_Handler`` so the user gets control.
+
.. code-block:: c
_ISR_Vector_table[ vector ] = new_handler;
@@ -290,6 +312,7 @@ results in the saving of registers which are NOT preserved across
subroutine calls as well as any special interrupt state. A port should
define the ``CPU_Interrupt_frame`` structure so that application code can
examine the saved state.
+
.. code-block:: c
typedef struct {
@@ -301,6 +324,7 @@ Interrupt Dispatching
---------------------
The ``_ISR_Handler`` routine provides the RTEMS interrupt management.
+
.. code-block:: c
void _ISR_Handler()
@@ -333,6 +357,7 @@ hardware does not provide this information, then the assembly portion of
RTEMS for this port will contain a set of distinct interrupt entry points
which somehow place the vector number in a known place (which is safe if
another interrupt nests this one) and branches to ``_ISR_Handler``.
+
.. code-block:: c
save some or all context on stack
@@ -372,6 +397,7 @@ ISR Invoked with Frame Pointer
Does the RTEMS invoke the user's ISR with the vector number and a pointer
to the saved interrupt frame (1) or just the vector number (0)?
+
.. code-block:: c
#define CPU_ISR_PASSES_FRAME_POINTER 0
@@ -390,13 +416,8 @@ variable can be optionally defined by the CPU porter and contains the
address of the routine _Thread_Dispatch. This can make it easier to
invoke that routine at the end of the interrupt sequence (if a dispatch is
necessary).
+
.. code-block:: c
void (*_CPU_Thread_dispatch_pointer)();
-.. COMMENT: COPYRIGHT (c) 1988-2002.
-
-.. COMMENT: On-Line Applications Research Corporation (OAR).
-
-.. COMMENT: All rights reserved.
-