Alternate preemption mode added to IAR port too.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3016 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
24734a32ef
commit
d08ed6e93c
|
@ -523,6 +523,7 @@
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>AUserIncludes</name>
|
<name>AUserIncludes</name>
|
||||||
|
<state>$PROJ_DIR$\..\</state>
|
||||||
<state>$PROJ_DIR$\..\..\..\os\ports\IAR\ARMCMx\LPC11xx</state>
|
<state>$PROJ_DIR$\..\..\..\os\ports\IAR\ARMCMx\LPC11xx</state>
|
||||||
<state>$PROJ_DIR$\..\..\..\boards\EA_LPCXPRESSO_BB_1114</state>
|
<state>$PROJ_DIR$\..\..\..\boards\EA_LPCXPRESSO_BB_1114</state>
|
||||||
</option>
|
</option>
|
||||||
|
@ -1387,6 +1388,7 @@
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>AUserIncludes</name>
|
<name>AUserIncludes</name>
|
||||||
|
<state>$PROJ_DIR$\..\</state>
|
||||||
<state>$PROJ_DIR$\..\..\..\os\ports\IAR\ARMCMx\LPC11xx</state>
|
<state>$PROJ_DIR$\..\..\..\os\ports\IAR\ARMCMx\LPC11xx</state>
|
||||||
<state>$PROJ_DIR$\..\..\..\boards\EA_LPCXPRESSO_BB_1114</state>
|
<state>$PROJ_DIR$\..\..\..\boards\EA_LPCXPRESSO_BB_1114</state>
|
||||||
</option>
|
</option>
|
||||||
|
|
|
@ -45,6 +45,15 @@
|
||||||
/* Port configurable parameters. */
|
/* Port configurable parameters. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Alternate preemption method.
|
||||||
|
* @details Activating this option will make the Kernel use the PendSV
|
||||||
|
* handler for preemption instead of the NMI handler.
|
||||||
|
*/
|
||||||
|
#ifndef CORTEX_ALTERNATE_SWITCH
|
||||||
|
#define CORTEX_ALTERNATE_SWITCH FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Port derived parameters. */
|
/* Port derived parameters. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -72,6 +81,15 @@
|
||||||
#define CH_CORE_VARIANT_NAME "Cortex-M1"
|
#define CH_CORE_VARIANT_NAME "Cortex-M1"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Port-specific information string.
|
||||||
|
*/
|
||||||
|
#if !CORTEX_ALTERNATE_SWITCH || defined(__DOXYGEN__)
|
||||||
|
#define CH_PORT_INFO "Preemption through NMI"
|
||||||
|
#else
|
||||||
|
#define CH_PORT_INFO "Preemption through PendSV"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Port implementation part. */
|
/* Port implementation part. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
|
@ -24,12 +24,11 @@
|
||||||
PRESERVE8
|
PRESERVE8
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Imports the Cortex-Mx parameters header and performs the same calculations
|
* Imports the Cortex-Mx configuration headers.
|
||||||
* done in chcore.h.
|
|
||||||
*/
|
*/
|
||||||
#include "cmparams.h"
|
#define _FROM_ASM_
|
||||||
|
#include "chconf.h"
|
||||||
#define CORTEX_PRIORITY_MASK(n) ((n) << (8 - CORTEX_PRIORITY_BITS))
|
#include "chcore.h"
|
||||||
|
|
||||||
EXTCTX_SIZE SET 32
|
EXTCTX_SIZE SET 32
|
||||||
CONTEXT_OFFSET SET 12
|
CONTEXT_OFFSET SET 12
|
||||||
|
@ -81,13 +80,29 @@ _port_thread_start:
|
||||||
* The NMI vector is used for exception mode re-entering after a context
|
* The NMI vector is used for exception mode re-entering after a context
|
||||||
* switch.
|
* switch.
|
||||||
*/
|
*/
|
||||||
PUBLIC NMIVector
|
#if !CORTEX_ALTERNATE_SWITCH
|
||||||
|
PUBLIC NMIVector
|
||||||
NMIVector:
|
NMIVector:
|
||||||
mrs r3, PSP
|
mrs r3, PSP
|
||||||
adds r3, r3, #32
|
adds r3, r3, #32
|
||||||
msr PSP, r3
|
msr PSP, r3
|
||||||
cpsie i
|
cpsie i
|
||||||
bx lr
|
bx lr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PendSV vector.
|
||||||
|
* The PendSV vector is used for exception mode re-entering after a context
|
||||||
|
* switch.
|
||||||
|
*/
|
||||||
|
#if CORTEX_ALTERNATE_SWITCH
|
||||||
|
PUBLIC PendSVVector
|
||||||
|
PendSVVector:
|
||||||
|
mrs r3, PSP
|
||||||
|
adds r3, r3, #32
|
||||||
|
msr PSP, r3
|
||||||
|
bx lr
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Post-IRQ switch code.
|
* Post-IRQ switch code.
|
||||||
|
@ -96,12 +111,18 @@ NMIVector:
|
||||||
PUBLIC _port_switch_from_isr
|
PUBLIC _port_switch_from_isr
|
||||||
_port_switch_from_isr:
|
_port_switch_from_isr:
|
||||||
bl chSchDoRescheduleI
|
bl chSchDoRescheduleI
|
||||||
movs r3, #128
|
|
||||||
lsls r3, r3, #24
|
|
||||||
ldr r2, =SCB_ICSR
|
ldr r2, =SCB_ICSR
|
||||||
|
movs r3, #128
|
||||||
|
#if CORTEX_ALTERNATE_SWITCH
|
||||||
|
lsls r3, r3, #21
|
||||||
str r3, [r2, #0]
|
str r3, [r2, #0]
|
||||||
_waitnmi:
|
cpsie i
|
||||||
b _waitnmi
|
#else
|
||||||
|
lsls r3, r3, #24
|
||||||
|
str r3, [r2, #0]
|
||||||
|
#endif
|
||||||
|
waithere:
|
||||||
|
b waithere
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reschedule verification and setup after an IRQ.
|
* Reschedule verification and setup after an IRQ.
|
||||||
|
|
|
@ -89,8 +89,8 @@ NMIVector PROC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NMI vector.
|
* PendSV vector.
|
||||||
* The NMI vector is used for exception mode re-entering after a context
|
* The PendSV vector is used for exception mode re-entering after a context
|
||||||
* switch.
|
* switch.
|
||||||
*/
|
*/
|
||||||
#if CORTEX_ALTERNATE_SWITCH
|
#if CORTEX_ALTERNATE_SWITCH
|
||||||
|
|
Loading…
Reference in New Issue