STM8, MSP430 and AVR ports adjusted for state checker option.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3229 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
930cd17e55
commit
c4f7ff481d
|
@ -151,7 +151,7 @@ struct context {
|
|||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
|
||||
/**
|
||||
* @brief Static working area allocation.
|
||||
|
|
|
@ -249,7 +249,7 @@ struct context {
|
|||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
|
||||
/**
|
||||
* @brief Static working area allocation.
|
||||
|
|
|
@ -123,7 +123,7 @@ void port_halt(void) {
|
|||
*/
|
||||
void _port_thread_start(void) {
|
||||
|
||||
asm volatile ("sei");
|
||||
chSysUnlock();
|
||||
asm volatile ("movw r24, r4");
|
||||
asm volatile ("movw r30, r2");
|
||||
asm volatile ("icall");
|
||||
|
|
|
@ -142,15 +142,15 @@ struct context {
|
|||
* @details This code usually setup the context switching frame represented
|
||||
* by an @p intctx structure.
|
||||
*/
|
||||
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
|
||||
tp->p_ctx.sp = (struct intctx*)((uint8_t *)workspace + wsize - \
|
||||
sizeof(struct intctx)); \
|
||||
tp->p_ctx.sp->r2 = (int)pf; \
|
||||
tp->p_ctx.sp->r3 = (int)pf >> 8; \
|
||||
tp->p_ctx.sp->r4 = (int)arg; \
|
||||
tp->p_ctx.sp->r5 = (int)arg >> 8; \
|
||||
tp->p_ctx.sp->pcl = (int)_port_thread_start >> 8; \
|
||||
tp->p_ctx.sp->pch = (int)_port_thread_start; \
|
||||
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
|
||||
tp->p_ctx.sp = (struct intctx*)((uint8_t *)workspace + wsize - \
|
||||
sizeof(struct intctx)); \
|
||||
tp->p_ctx.sp->r2 = (int)pf; \
|
||||
tp->p_ctx.sp->r3 = (int)pf >> 8; \
|
||||
tp->p_ctx.sp->r4 = (int)arg; \
|
||||
tp->p_ctx.sp->r5 = (int)arg >> 8; \
|
||||
tp->p_ctx.sp->pcl = (int)_port_thread_start >> 8; \
|
||||
tp->p_ctx.sp->pch = (int)_port_thread_start; \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,9 +185,9 @@ struct context {
|
|||
/**
|
||||
* @brief Computes the thread working area global size.
|
||||
*/
|
||||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
(sizeof(struct intctx) - 1) + \
|
||||
(sizeof(struct extctx) - 1) + \
|
||||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
(sizeof(struct intctx) - 1) + \
|
||||
(sizeof(struct extctx) - 1) + \
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
|
||||
/**
|
||||
|
@ -204,9 +204,9 @@ struct context {
|
|||
* @note This code tricks the compiler to save all the specified registers
|
||||
* by "touching" them.
|
||||
*/
|
||||
#define PORT_IRQ_PROLOGUE() { \
|
||||
asm ("" : : : "r18", "r19", "r20", "r21", "r22", "r23", "r24", \
|
||||
"r25", "r26", "r27", "r30", "r31"); \
|
||||
#define PORT_IRQ_PROLOGUE() { \
|
||||
asm ("" : : : "r18", "r19", "r20", "r21", "r22", "r23", "r24", \
|
||||
"r25", "r26", "r27", "r30", "r31"); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,9 +214,11 @@ struct context {
|
|||
* @details This macro must be inserted at the end of all IRQ handlers
|
||||
* enabled to invoke system APIs.
|
||||
*/
|
||||
#define PORT_IRQ_EPILOGUE() { \
|
||||
if (chSchIsPreemptionRequired()) \
|
||||
chSchDoReschedule(); \
|
||||
#define PORT_IRQ_EPILOGUE() { \
|
||||
dbg_check_lock(); \
|
||||
if (chSchIsPreemptionRequired()) \
|
||||
chSchDoReschedule(); \
|
||||
dbg_check_unlock(); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,8 +93,8 @@ void port_halt(void) {
|
|||
*/
|
||||
void _port_thread_start(void) {
|
||||
|
||||
asm volatile ("eint \n\t" \
|
||||
"mov r11, r15 \n\t" \
|
||||
chSysUnlock();
|
||||
asm volatile ("mov r11, r15 \n\t" \
|
||||
"call r10 \n\t" \
|
||||
"call #chThdExit");
|
||||
}
|
||||
|
|
|
@ -119,13 +119,13 @@ struct context {
|
|||
* @details This code usually setup the context switching frame represented
|
||||
* by an @p intctx structure.
|
||||
*/
|
||||
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
|
||||
tp->p_ctx.sp = (struct intctx *)((uint8_t *)workspace + \
|
||||
wsize - \
|
||||
sizeof(struct intctx)); \
|
||||
tp->p_ctx.sp->r10 = pf; \
|
||||
tp->p_ctx.sp->r11 = arg; \
|
||||
tp->p_ctx.sp->pc = _port_thread_start; \
|
||||
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
|
||||
tp->p_ctx.sp = (struct intctx *)((uint8_t *)workspace + \
|
||||
wsize - \
|
||||
sizeof(struct intctx)); \
|
||||
tp->p_ctx.sp->r10 = pf; \
|
||||
tp->p_ctx.sp->r11 = arg; \
|
||||
tp->p_ctx.sp->pc = _port_thread_start; \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,10 +159,10 @@ struct context {
|
|||
/**
|
||||
* @brief Computes the thread working area global size.
|
||||
*/
|
||||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
|
||||
/**
|
||||
* @brief Static working area allocation.
|
||||
|
@ -183,9 +183,11 @@ struct context {
|
|||
* @details This macro must be inserted at the end of all IRQ handlers
|
||||
* enabled to invoke system APIs.
|
||||
*/
|
||||
#define PORT_IRQ_EPILOGUE() { \
|
||||
if (chSchIsPreemptionRequired()) \
|
||||
chSchDoReschedule(); \
|
||||
#define PORT_IRQ_EPILOGUE() { \
|
||||
dbg_check_lock(); \
|
||||
if (chSchIsPreemptionRequired()) \
|
||||
chSchDoReschedule(); \
|
||||
dbg_check_unlock(); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,7 +222,11 @@ struct context {
|
|||
/**
|
||||
* @brief Kernel-lock action from an interrupt handler.
|
||||
* @details This function is invoked before invoking I-class APIs from
|
||||
* interrupt handlers. The implementation is architecture dependent,
|
||||
* interrupt handlers. The implementation is architecture dependen#define PORT_IRQ_EPILOGUE() { \
|
||||
if (chSchIsPreemptionRequired()) \
|
||||
chSchDoReschedule(); \
|
||||
}
|
||||
* t,
|
||||
* in its simplest form it is void.
|
||||
* @note This function is empty in this port.
|
||||
*/
|
||||
|
@ -270,8 +276,8 @@ struct context {
|
|||
*/
|
||||
#if ENABLE_WFI_IDLE != 0
|
||||
#ifndef port_wait_for_interrupt
|
||||
#define port_wait_for_interrupt() { \
|
||||
asm volatile ("nop" : : : "memory"); \
|
||||
#define port_wait_for_interrupt() { \
|
||||
asm volatile ("nop" : : : "memory"); \
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
|
|
|
@ -221,10 +221,10 @@ struct context {
|
|||
/**
|
||||
* @brief Computes the thread working area global size.
|
||||
*/
|
||||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
|
||||
/**
|
||||
* @brief Static working area allocation.
|
||||
|
@ -307,8 +307,8 @@ struct context {
|
|||
*/
|
||||
#if ENABLE_WFI_IDLE != 0
|
||||
#ifndef port_wait_for_interrupt
|
||||
#define port_wait_for_interrupt() { \
|
||||
asm volatile ("wait" : : : "memory"); \
|
||||
#define port_wait_for_interrupt() { \
|
||||
asm volatile ("wait" : : : "memory"); \
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
|
|
|
@ -144,7 +144,7 @@ struct context {
|
|||
sizeof(void *) * 4 + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
(n) + (PORT_INT_REQUIRED_STACK))
|
||||
|
||||
/**
|
||||
* Macro used to allocate a thread working area aligned as both position and
|
||||
|
|
|
@ -54,8 +54,8 @@ void _port_switch(Thread *otp) {
|
|||
*/
|
||||
void _port_thread_start(void) {
|
||||
|
||||
chSysUnlock();
|
||||
#pragma ASM
|
||||
RIM
|
||||
POPW X
|
||||
#pragma ENDASM
|
||||
}
|
||||
|
|
|
@ -206,8 +206,10 @@ struct stm8_startctx {
|
|||
* enabled to invoke system APIs.
|
||||
*/
|
||||
#define PORT_IRQ_EPILOGUE() { \
|
||||
dbg_check_lock(); \
|
||||
if (chSchIsPreemptionRequired()) \
|
||||
chSchDoReschedule(); \
|
||||
dbg_check_unlock(); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,8 +50,8 @@ void _port_switch(Thread *otp) {
|
|||
*/
|
||||
void _port_thread_start(void) {
|
||||
|
||||
_asm(" rim \n"
|
||||
" popw x \n");
|
||||
chSysUnlock();
|
||||
_asm(" popw x \n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -203,8 +203,10 @@ struct stm8_startctx {
|
|||
* enabled to invoke system APIs.
|
||||
*/
|
||||
#define PORT_IRQ_EPILOGUE() { \
|
||||
dbg_check_lock(); \
|
||||
if (chSchIsPreemptionRequired()) \
|
||||
chSchDoReschedule(); \
|
||||
dbg_check_unlock(); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue