aboutsummaryrefslogtreecommitdiffstats
path: root/docs/ch.txt
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-12-28 13:17:52 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-12-28 13:17:52 +0000
commit458a2834834986bc13171439b2f6889ad14044b8 (patch)
tree11d65302935be400928041904f62c3c35be65ca7 /docs/ch.txt
parent0daf2f968782458e10e948c0ee786af9c2c4dffa (diff)
downloadChibiOS-458a2834834986bc13171439b2f6889ad14044b8.tar.gz
ChibiOS-458a2834834986bc13171439b2f6889ad14044b8.tar.bz2
ChibiOS-458a2834834986bc13171439b2f6889ad14044b8.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@549 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'docs/ch.txt')
-rw-r--r--docs/ch.txt29
1 files changed, 26 insertions, 3 deletions
diff --git a/docs/ch.txt b/docs/ch.txt
index 4db76915a..46fd52004 100644
--- a/docs/ch.txt
+++ b/docs/ch.txt
@@ -159,11 +159,34 @@
* architecture.</li>
* <li>FIQ sources can preempt the kernel (by design) so it is not possible to
* invoke the kernel APIs from inside a FIQ handler.</li>
+ * <li>Interrupt handlers do not save function-saved registers so you need to
+ * make sure your code saves them or does not use them (this happens
+ * because in the ARM7 port all the OS interrupt handlers are declared
+ * naked).<br>
+ * Function-trashed registers (R0-R3,R12,LR,SR) are saved/restored by the
+ * system macros \p chSysIRQEnterI() and \p chSysIRQExitI().<br>
+ * The easiest way to ensure this is to just invoke a function from within
+ * the interrupt handler, the function code will save all the required
+ * registers.<br>
+ * Example:
+ * @code
+ * __attribute__((naked, weak))
+ * void irq_handler(void) {
+ * chSysIRQEnterI();
+ *
+ * serve_interrupt();
+ *
+ * VICVectAddr = 0; // This is LPC214x-specific.
+ * chSysIRQExitI();
+ * }
+ * @endcode
+ * This is not a bug but an implementation choice, this solution allows to
+ * have interrupt handlers compiled in thumb mode without have to use an
+ * interworking mode (the mode switch is hidden in the macros), this
+ * greatly improves code efficiency and size. You can look at the serial
+ * driver for real examples of interrupt handlers.</li>
* </ul>
* </p>
- * <p>
- * The ARM7 port is shared by multiple demos targeted to various implementations:
- * </p>
* @ingroup Ports
*/
/** @} */