|
ChibiOS/RT
2.5.1 |
|
STM8 specific port code, structures and macros.
Data Structures | |
| struct | extctx |
| Interrupt saved context. More... | |
| struct | intctx |
| System saved context. More... | |
| struct | context |
Platform dependent part of the Thread structure. More... | |
| struct | stm8_startctx |
| Start context. More... | |
| struct | ReadyList |
| Ready list header. More... | |
Functions | |
| void | _port_switch (Thread *otp) |
| Performs a context switch between two threads. | |
| void | _port_thread_start (void) |
| Thread start code. | |
| void | port_halt (void) |
| Halts the system. | |
Variables | |
| tiny ReadyList | rlist |
| Ready list header. | |
| tiny ReadyList | rlist |
| Ready list header. | |
| __tiny ReadyList | rlist |
| Ready list header. | |
| __tiny ReadyList | rlist |
| Ready list header. | |
| text weak _port_switch r14 r1 pop r4 pop r5 pop r6 pop r7 pop r8 pop r9 pop r10 pop r11 ret weak _port_thread_start | _port_thread_start |
| Thread start code. | |
Defines | |
| #define | STM8_ENABLE_WFI_IDLE FALSE |
| Enables the use of the WFI instruction in the idle thread loop. | |
| #define | CH_ARCHITECTURE_STM8 |
| Unique macro for the implemented architecture. | |
| #define | CH_ARCHITECTURE_NAME "STM8" |
| Name of the implemented architecture. | |
| #define | CH_COMPILER_NAME "Cosmic" |
| Name of the compiler supported by this port. | |
| #define | CH_PORT_INFO "None" |
| Port-specific information string. | |
| #define | SETUP_CONTEXT(workspace, wsize, pf, arg) |
Platform dependent part of the chThdCreateI() API. | |
| #define | PORT_IDLE_THREAD_STACK_SIZE 0 |
| Stack size for the system idle thread. | |
| #define | PORT_INT_REQUIRED_STACK 48 |
| Per-thread stack overhead for interrupts servicing. | |
| #define | STACK_ALIGN(n) ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) |
| Enforces a correct alignment for a stack area size value. | |
| #define | THD_WA_SIZE(n) |
| Computes the thread working area global size. | |
| #define | WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)] |
| Static working area allocation. | |
| #define | PORT_IRQ_PROLOGUE() |
| IRQ prologue code. | |
| #define | PORT_IRQ_EPILOGUE() |
| IRQ epilogue code. | |
| #define | PORT_IRQ_HANDLER(id) @far @interrupt @svlreg void vector##id(void) |
| IRQ handler function declaration. | |
| #define | port_init() |
| Port-related initialization code. | |
| #define | port_lock() _asm("sim") |
| Kernel-lock action. | |
| #define | port_unlock() _asm("rim") |
| Kernel-unlock action. | |
| #define | port_lock_from_isr() |
| Kernel-lock action from an interrupt handler. | |
| #define | port_unlock_from_isr() |
| Kernel-unlock action from an interrupt handler. | |
| #define | port_disable() _asm("sim") |
| Disables all the interrupt sources. | |
| #define | port_suspend() _asm("sim") |
| Disables the interrupt sources that are not supposed to preempt the kernel. | |
| #define | port_enable() _asm("rim") |
| Enables all the interrupt sources. | |
| #define | port_wait_for_interrupt() _asm("wfi") |
| Enters an architecture-dependent halt mode. | |
| #define | port_switch(ntp, otp) _port_switch(otp) |
| Performs a context switch between two threads. | |
| #define | INLINE @inline |
| Inline function modifier. | |
| #define | ROMCONST const |
| ROM constant modifier. | |
| #define | PACK_STRUCT_STRUCT |
| Packed structure modifier (within). | |
| #define | PACK_STRUCT_BEGIN |
| Packed structure modifier (before). | |
| #define | PACK_STRUCT_END |
| Packed structure modifier (after). | |
| #define | STM8_ENABLE_WFI_IDLE FALSE |
| Enables the use of the WFI instruction in the idle thread loop. | |
| #define | CH_ARCHITECTURE_STM8 |
| Unique macro for the implemented architecture. | |
| #define | CH_ARCHITECTURE_NAME "STM8" |
| Name of the implemented architecture. | |
| #define | CH_COMPILER_NAME "IAR" |
| Name of the compiler supported by this port. | |
| #define | CH_PORT_INFO "None" |
| Port-specific information string. | |
| #define | SETUP_CONTEXT(workspace, wsize, pf, arg) |
Platform dependent part of the chThdCreateI() API. | |
| #define | PORT_IDLE_THREAD_STACK_SIZE 0 |
| Stack size for the system idle thread. | |
| #define | PORT_INT_REQUIRED_STACK 48 |
| Per-thread stack overhead for interrupts servicing. | |
| #define | STACK_ALIGN(n) ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) |
| Enforces a correct alignment for a stack area size value. | |
| #define | THD_WA_SIZE(n) |
| Computes the thread working area global size. | |
| #define | WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)] |
| Static working area allocation. | |
| #define | PORT_IRQ_PROLOGUE() |
| IRQ prologue code. | |
| #define | PORT_IRQ_EPILOGUE() |
| IRQ epilogue code. | |
| #define | PORT_IRQ_HANDLER(id) _Pragma(VECTOR_ID((id)+2)) __interrupt void vector##id(void) |
| IRQ handler function declaration. | |
| #define | port_init() |
| Port-related initialization code. | |
| #define | port_lock() asm("sim") |
| Kernel-lock action. | |
| #define | port_unlock() asm("rim") |
| Kernel-unlock action. | |
| #define | port_lock_from_isr() |
| Kernel-lock action from an interrupt handler. | |
| #define | port_unlock_from_isr() |
| Kernel-unlock action from an interrupt handler. | |
| #define | port_disable() asm("sim") |
| Disables all the interrupt sources. | |
| #define | port_suspend() asm("sim") |
| Disables the interrupt sources that are not supposed to preempt the kernel. | |
| #define | port_enable() asm("rim") |
| Enables all the interrupt sources. | |
| #define | port_wait_for_interrupt() asm("wfi") |
| Enters an architecture-dependent halt mode. | |
| #define | port_switch(ntp, otp) _port_switch(otp) |
| Performs a context switch between two threads. | |
| #define | port_halt() _port_halt() |
Wrapper of the assembler _port_halt() function. | |
Typedefs | |
| typedef uint8_t | stkalign_t |
| Base type for stack alignment. | |
| typedef void(* | stm8func_t )(void) |
| Generic STM8 function pointer. | |
| typedef unsigned char | uint8_t |
| typedef signed char | int8_t |
| typedef unsigned int | uint16_t |
| typedef signed int | int16_t |
| typedef unsigned long | uint32_t |
| typedef signed long | int32_t |
| typedef uint8_t | uint_fast8_t |
| typedef uint16_t | uint_fast16_t |
| typedef uint32_t | uint_fast32_t |
| typedef int8_t | bool_t |
| typedef uint8_t | tmode_t |
| typedef uint8_t | tstate_t |
| typedef uint8_t | trefs_t |
| typedef uint8_t | tslices_t |
| typedef uint8_t | tprio_t |
| typedef int16_t | msg_t |
| typedef int8_t | eventid_t |
| typedef uint8_t | eventmask_t |
| typedef uint8_t | flagsmask_t |
| typedef uint16_t | systime_t |
| typedef int8_t | cnt_t |
| typedef uint8_t | stkalign_t |
| Base type for stack alignment. | |
| typedef void(* | stm8func_t )(void) |
| Generic STM8 function pointer. | |
| void _port_switch | ( | Thread * | otp | ) |
Performs a context switch between two threads.
| otp | the thread to be switched out |
Definition at line 38 of file ports/cosmic/STM8/chcore.c.
| void _port_thread_start | ( | void | ) |
Thread start code.
Definition at line 51 of file ports/cosmic/STM8/chcore.c.
| void port_halt | ( | void | ) |
Halts the system.
This function is invoked by the operating system when an unrecoverable error is detected (for example because a programming error in the application code that triggers an assertion while in debug mode).
Definition at line 64 of file ports/cosmic/STM8/chcore.c.
References port_disable, and TRUE.
Ready list header.
Definition at line 31 of file ports/cosmic/STM8/chcore.c.
Ready list header.
Definition at line 31 of file ports/IAR/STM8/chcore.c.
| void _port_thread_start |
Thread start code.
Definition at line 45 of file MSP430/chcoreasm.s.
| #define STM8_ENABLE_WFI_IDLE FALSE |
Enables the use of the WFI instruction in the idle thread loop.
Definition at line 44 of file ports/cosmic/STM8/chcore.h.
| #define CH_ARCHITECTURE_STM8 |
Unique macro for the implemented architecture.
Definition at line 54 of file ports/cosmic/STM8/chcore.h.
| #define CH_ARCHITECTURE_NAME "STM8" |
Name of the implemented architecture.
Definition at line 59 of file ports/cosmic/STM8/chcore.h.
Referenced by TestThread().
| #define CH_COMPILER_NAME "Cosmic" |
Name of the compiler supported by this port.
Definition at line 64 of file ports/cosmic/STM8/chcore.h.
Referenced by TestThread().
| #define CH_PORT_INFO "None" |
Port-specific information string.
Definition at line 69 of file ports/cosmic/STM8/chcore.h.
Referenced by TestThread().
| #define SETUP_CONTEXT | ( | workspace, | |
| wsize, | |||
| pf, | |||
| arg | |||
| ) |
{ \
struct stm8_startctx *scp; \
scp = (struct stm8_startctx *)((uint8_t *)workspace + wsize - \
sizeof(struct stm8_startctx)); \
scp->ts = _port_thread_start; \
scp->arg = arg; \
scp->pc = (stm8func_t)pf; \
scp->ret = (stm8func_t)chThdExit; \
tp->p_ctx.sp = (struct intctx *)scp; \
}
Platform dependent part of the chThdCreateI() API.
This code usually setup the context switching frame represented by an intctx structure.
Definition at line 148 of file ports/cosmic/STM8/chcore.h.
Referenced by chThdCreateI().
| #define PORT_IDLE_THREAD_STACK_SIZE 0 |
Stack size for the system idle thread.
This size depends on the idle thread implementation, usually the idle thread should take no more space than those reserved by PORT_INT_REQUIRED_STACK.
Definition at line 166 of file ports/cosmic/STM8/chcore.h.
| #define PORT_INT_REQUIRED_STACK 48 |
Per-thread stack overhead for interrupts servicing.
This is a safe value, you may trim it down after reading the right size in the map file.
Definition at line 175 of file ports/cosmic/STM8/chcore.h.
| #define STACK_ALIGN | ( | n | ) | ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) |
Enforces a correct alignment for a stack area size value.
Definition at line 181 of file ports/cosmic/STM8/chcore.h.
| #define THD_WA_SIZE | ( | n | ) |
STACK_ALIGN(sizeof(Thread) + \ (sizeof(struct intctx) - 1) + \ (sizeof(struct extctx) - 1) + \ (n) + (PORT_INT_REQUIRED_STACK))
Computes the thread working area global size.
Definition at line 186 of file ports/cosmic/STM8/chcore.h.
Referenced by chThdCreateI().
| #define WORKING_AREA | ( | s, | |
| n | |||
| ) | stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)] |
Static working area allocation.
This macro is used to allocate a static thread working area aligned as both position and size.
Definition at line 196 of file ports/cosmic/STM8/chcore.h.
| #define PORT_IRQ_PROLOGUE | ( | ) |
IRQ prologue code.
This macro must be inserted at the start of all IRQ handlers enabled to invoke system APIs.
Definition at line 203 of file ports/cosmic/STM8/chcore.h.
| #define PORT_IRQ_EPILOGUE | ( | ) |
{ \
dbg_check_lock(); \
if (chSchIsPreemptionRequired()) \
chSchDoReschedule(); \
dbg_check_unlock(); \
}
IRQ epilogue code.
This macro must be inserted at the end of all IRQ handlers enabled to invoke system APIs.
Definition at line 210 of file ports/cosmic/STM8/chcore.h.
| #define PORT_IRQ_HANDLER | ( | id | ) | @far @interrupt @svlreg void vector##id(void) |
IRQ handler function declaration.
id can be a function name or a vector number depending on the port implementation. Definition at line 222 of file ports/cosmic/STM8/chcore.h.
| void port_init | ( | ) |
Port-related initialization code.
Definition at line 228 of file ports/cosmic/STM8/chcore.h.
Referenced by chSysInit().
| #define port_lock | ( | void | ) | _asm("sim") |
Kernel-lock action.
Definition at line 234 of file ports/cosmic/STM8/chcore.h.
| #define port_unlock | ( | void | ) | _asm("rim") |
Kernel-unlock action.
Definition at line 240 of file ports/cosmic/STM8/chcore.h.
Referenced by _port_switch_from_isr().
| #define port_lock_from_isr | ( | void | ) |
Kernel-lock action from an interrupt handler.
Definition at line 246 of file ports/cosmic/STM8/chcore.h.
Referenced by _port_irq_epilogue(), dbg_check_enter_isr(), and dbg_check_leave_isr().
| #define port_unlock_from_isr | ( | void | ) |
Kernel-unlock action from an interrupt handler.
Definition at line 252 of file ports/cosmic/STM8/chcore.h.
Referenced by _port_irq_epilogue(), dbg_check_enter_isr(), dbg_check_leave_isr(), NMIVector(), and SVCallVector().
| #define port_disable | ( | void | ) | _asm("sim") |
Disables all the interrupt sources.
Definition at line 259 of file ports/cosmic/STM8/chcore.h.
Referenced by port_halt().
| #define port_suspend | ( | void | ) | _asm("sim") |
Disables the interrupt sources that are not supposed to preempt the kernel.
port_disable() in this port, there is no difference between the two states. Definition at line 267 of file ports/cosmic/STM8/chcore.h.
| #define port_enable | ( | void | ) | _asm("rim") |
Enables all the interrupt sources.
Definition at line 273 of file ports/cosmic/STM8/chcore.h.
| #define port_wait_for_interrupt | ( | void | ) | _asm("wfi") |
Enters an architecture-dependent halt mode.
Definition at line 280 of file ports/cosmic/STM8/chcore.h.
Referenced by _idle_thread().
| #define port_switch | ( | ntp, | |
| otp | |||
| ) | _port_switch(otp) |
Performs a context switch between two threads.
This is the most critical code in any port, this function is responsible for the context switch between 2 threads.
| ntp | the thread to be switched in |
| otp | the thread to be switched out |
Definition at line 294 of file ports/cosmic/STM8/chcore.h.
| #define INLINE @inline |
Inline function modifier.
Definition at line 66 of file ports/cosmic/STM8/chtypes.h.
| #define ROMCONST const |
ROM constant modifier.
Definition at line 72 of file ports/cosmic/STM8/chtypes.h.
| #define PACK_STRUCT_STRUCT |
Packed structure modifier (within).
Definition at line 78 of file ports/cosmic/STM8/chtypes.h.
| #define PACK_STRUCT_BEGIN |
Packed structure modifier (before).
Definition at line 84 of file ports/cosmic/STM8/chtypes.h.
| #define PACK_STRUCT_END |
Packed structure modifier (after).
Definition at line 90 of file ports/cosmic/STM8/chtypes.h.
| #define STM8_ENABLE_WFI_IDLE FALSE |
Enables the use of the WFI instruction in the idle thread loop.
Definition at line 44 of file ports/IAR/STM8/chcore.h.
| #define CH_ARCHITECTURE_STM8 |
Unique macro for the implemented architecture.
Definition at line 54 of file ports/IAR/STM8/chcore.h.
| #define CH_ARCHITECTURE_NAME "STM8" |
Name of the implemented architecture.
Definition at line 59 of file ports/IAR/STM8/chcore.h.
| #define CH_COMPILER_NAME "IAR" |
Name of the compiler supported by this port.
Definition at line 64 of file ports/IAR/STM8/chcore.h.
| #define CH_PORT_INFO "None" |
Port-specific information string.
Definition at line 69 of file ports/IAR/STM8/chcore.h.
| #define SETUP_CONTEXT | ( | workspace, | |
| wsize, | |||
| pf, | |||
| arg | |||
| ) |
{ \
struct stm8_startctx *scp; \
scp = (struct stm8_startctx *)((uint8_t *)workspace + wsize - \
sizeof(struct stm8_startctx)); \
scp->ts = (stm8func_t)_port_thread_start; \
scp->arg = (void *)arg; \
scp->pc = (stm8func_t)pf; \
scp->ret = (stm8func_t)chThdExit; \
tp->p_ctx.sp = (struct intctx *)scp; \
}
Platform dependent part of the chThdCreateI() API.
This code usually setup the context switching frame represented by an intctx structure.
Definition at line 154 of file ports/IAR/STM8/chcore.h.
| #define PORT_IDLE_THREAD_STACK_SIZE 0 |
Stack size for the system idle thread.
This size depends on the idle thread implementation, usually the idle thread should take no more space than those reserved by PORT_INT_REQUIRED_STACK.
Definition at line 172 of file ports/IAR/STM8/chcore.h.
| #define PORT_INT_REQUIRED_STACK 48 |
Per-thread stack overhead for interrupts servicing.
This is a safe value, you may trim it down after reading the right size in the map file.
Definition at line 181 of file ports/IAR/STM8/chcore.h.
| #define STACK_ALIGN | ( | n | ) | ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) |
Enforces a correct alignment for a stack area size value.
Definition at line 187 of file ports/IAR/STM8/chcore.h.
| #define THD_WA_SIZE | ( | n | ) |
STACK_ALIGN(sizeof(Thread) + \ (sizeof(struct intctx) - 1) + \ (sizeof(struct extctx) - 1) + \ (n) + (PORT_INT_REQUIRED_STACK))
Computes the thread working area global size.
Definition at line 192 of file ports/IAR/STM8/chcore.h.
| #define WORKING_AREA | ( | s, | |
| n | |||
| ) | stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)] |
Static working area allocation.
This macro is used to allocate a static thread working area aligned as both position and size.
Definition at line 202 of file ports/IAR/STM8/chcore.h.
| #define PORT_IRQ_PROLOGUE | ( | ) |
IRQ prologue code.
This macro must be inserted at the start of all IRQ handlers enabled to invoke system APIs.
Definition at line 209 of file ports/IAR/STM8/chcore.h.
| #define PORT_IRQ_EPILOGUE | ( | ) |
{ \
dbg_check_lock(); \
if (chSchIsPreemptionRequired()) \
chSchDoReschedule(); \
dbg_check_unlock(); \
}
IRQ epilogue code.
This macro must be inserted at the end of all IRQ handlers enabled to invoke system APIs.
Definition at line 216 of file ports/IAR/STM8/chcore.h.
| #define PORT_IRQ_HANDLER | ( | id | ) | _Pragma(VECTOR_ID((id)+2)) __interrupt void vector##id(void) |
IRQ handler function declaration.
id can be a function name or a vector number depending on the port implementation. Definition at line 228 of file ports/IAR/STM8/chcore.h.
| #define port_init | ( | void | ) |
Port-related initialization code.
Definition at line 235 of file ports/IAR/STM8/chcore.h.
| #define port_lock | ( | void | ) | asm("sim") |
Kernel-lock action.
Definition at line 241 of file ports/IAR/STM8/chcore.h.
| #define port_unlock | ( | void | ) | asm("rim") |
Kernel-unlock action.
Definition at line 247 of file ports/IAR/STM8/chcore.h.
| #define port_lock_from_isr | ( | void | ) |
Kernel-lock action from an interrupt handler.
Definition at line 253 of file ports/IAR/STM8/chcore.h.
| #define port_unlock_from_isr | ( | void | ) |
Kernel-unlock action from an interrupt handler.
Definition at line 259 of file ports/IAR/STM8/chcore.h.
| #define port_disable | ( | void | ) | asm("sim") |
Disables all the interrupt sources.
Definition at line 266 of file ports/IAR/STM8/chcore.h.
| #define port_suspend | ( | void | ) | asm("sim") |
Disables the interrupt sources that are not supposed to preempt the kernel.
port_disable() in this port, there is no difference between the two states. Definition at line 274 of file ports/IAR/STM8/chcore.h.
| #define port_enable | ( | void | ) | asm("rim") |
Enables all the interrupt sources.
Definition at line 280 of file ports/IAR/STM8/chcore.h.
| #define port_wait_for_interrupt | ( | void | ) | asm("wfi") |
Enters an architecture-dependent halt mode.
Definition at line 287 of file ports/IAR/STM8/chcore.h.
| #define port_switch | ( | ntp, | |
| otp | |||
| ) | _port_switch(otp) |
Performs a context switch between two threads.
This is the most critical code in any port, this function is responsible for the context switch between 2 threads.
| ntp | the thread to be switched in |
| otp | the thread to be switched out |
Definition at line 301 of file ports/IAR/STM8/chcore.h.
| void port_halt | ( | ) | _port_halt() |
Wrapper of the assembler _port_halt() function.
Halts the system.
This function is invoked by the operating system when an unrecoverable error is detected (for example because a programming error in the application code that triggers an assertion while in debug mode).
Definition at line 301 of file ports/GCC/MSP430/chcore.h.
| typedef uint8_t stkalign_t |
Base type for stack alignment.
Definition at line 79 of file ports/cosmic/STM8/chcore.h.
| typedef void(* stm8func_t)(void) |
Generic STM8 function pointer.
Definition at line 86 of file ports/cosmic/STM8/chcore.h.
| typedef unsigned char uint8_t |
C99-style 8 bits unsigned.
Definition at line 40 of file ports/cosmic/STM8/chtypes.h.
| typedef signed char int8_t |
C99-style 8 bits signed.
Definition at line 41 of file ports/cosmic/STM8/chtypes.h.
| typedef unsigned int uint16_t |
C99-style 16 bits unsigned.
Definition at line 42 of file ports/cosmic/STM8/chtypes.h.
| typedef signed int int16_t |
C99-style 16 bits signed.
Definition at line 43 of file ports/cosmic/STM8/chtypes.h.
| typedef unsigned long uint32_t |
C99-style 32 bits unsigned.
Definition at line 44 of file ports/cosmic/STM8/chtypes.h.
| typedef signed long int32_t |
C99-style 32 bits signed.
Definition at line 45 of file ports/cosmic/STM8/chtypes.h.
| typedef uint8_t uint_fast8_t |
C99-style 8 bits unsigned.
Definition at line 46 of file ports/cosmic/STM8/chtypes.h.
| typedef uint16_t uint_fast16_t |
C99-style 16 bits unsigned.
Definition at line 47 of file ports/cosmic/STM8/chtypes.h.
| typedef uint32_t uint_fast32_t |
C99-style 32 bits unsigned.
Definition at line 48 of file ports/cosmic/STM8/chtypes.h.
Fast boolean type.
Definition at line 50 of file ports/cosmic/STM8/chtypes.h.
Thread flags.
Definition at line 51 of file ports/cosmic/STM8/chtypes.h.
Thread state.
Definition at line 52 of file ports/cosmic/STM8/chtypes.h.
Thread references counter.
Definition at line 53 of file ports/cosmic/STM8/chtypes.h.
Thread time slices counter.
Definition at line 54 of file ports/cosmic/STM8/chtypes.h.
Thread priority.
Definition at line 55 of file ports/cosmic/STM8/chtypes.h.
Inter-thread message.
Definition at line 56 of file ports/cosmic/STM8/chtypes.h.
Event Id.
Definition at line 57 of file ports/cosmic/STM8/chtypes.h.
| typedef uint8_t eventmask_t |
Event mask.
Definition at line 58 of file ports/cosmic/STM8/chtypes.h.
| typedef uint8_t flagsmask_t |
Event flags.
Definition at line 59 of file ports/cosmic/STM8/chtypes.h.
System time.
Definition at line 60 of file ports/cosmic/STM8/chtypes.h.
Resources counter.
Definition at line 61 of file ports/cosmic/STM8/chtypes.h.
| typedef uint8_t stkalign_t |
Base type for stack alignment.
Definition at line 79 of file ports/IAR/STM8/chcore.h.
| typedef void(* stm8func_t)(void) |
Generic STM8 function pointer.
Definition at line 86 of file ports/IAR/STM8/chcore.h.