|
ChibiOS/RT
2.5.1 |
|
MSP430 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... | |
Functions | |
| void | _port_switch (Thread *ntp, Thread *otp) |
| Performs a context switch between two threads. | |
| void | _port_thread_start (void) |
| Thread start code. | |
Defines | |
| #define | ENABLE_WFI_IDLE 0 |
| Enables the use of a wait state in the idle thread loop. | |
| #define | CH_ARCHITECTURE_MSP430 |
| Macro defining the MSP430 architecture. | |
| #define | CH_ARCHITECTURE_NAME "MSP430" |
| Name of the implemented architecture. | |
| #define | CH_CORE_VARIANT_NAME "MSP430" |
| Name of the architecture variant (optional). | |
| #define | CH_COMPILER_NAME "GCC " __VERSION__ |
| 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 32 |
| 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) ISR(id, ISRNAME(vect, id)) |
| IRQ handler function declaration. | |
| #define | port_init() |
| Port-related initialization code. | |
| #define | port_lock() asm volatile ("dint" : : : "memory") |
| Kernel-lock action. | |
| #define | port_unlock() asm volatile ("eint" : : : "memory") |
| 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 volatile ("dint" : : : "memory") |
| Disables all the interrupt sources. | |
| #define | port_suspend() asm volatile ("dint" : : : "memory") |
| Disables the interrupt sources below kernel-level priority. | |
| #define | port_enable() asm volatile ("eint" : : : "memory") |
| Enables all the interrupt sources. | |
| #define | port_wait_for_interrupt() |
| Enters an architecture-dependent IRQ-waiting mode. | |
| #define | port_switch(ntp, otp) _port_switch(ntp, otp) |
Wrapper of the assembler _port_switch() function. | |
| #define | INLINE inline |
| Inline function modifier. | |
| #define | ROMCONST const |
| ROM constant modifier. | |
| #define | PACK_STRUCT_STRUCT __attribute__((packed)) |
| Packed structure modifier (within). | |
| #define | PACK_STRUCT_BEGIN |
| Packed structure modifier (before). | |
| #define | PACK_STRUCT_END |
| Packed structure modifier (after). | |
Typedefs | |
| typedef uint16_t | stkalign_t |
| 16 bits stack and memory alignment enforcement. | |
| typedef void * | regmsp_t |
| Generic MSP430 register. | |
| typedef int16_t | bool_t |
| typedef uint8_t | tmode_t |
| typedef uint8_t | tstate_t |
| typedef uint8_t | trefs_t |
| typedef uint8_t | tslices_t |
| typedef uint16_t | tprio_t |
| typedef int16_t | msg_t |
| typedef int16_t | eventid_t |
| typedef uint16_t | eventmask_t |
| typedef uint16_t | flagsmask_t |
| typedef uint16_t | systime_t |
| typedef int16_t | cnt_t |
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.
| [in] | ntp | the thread to be switched in |
| [in] | otp | the thread to be switched out |
Definition at line 165 of file GCC/ARMCMx/chcore_v6m.c.
| void _port_thread_start | ( | void | ) |
Thread start code.
Thread start code.
If the work function returns chThdExit() is automatically invoked.
Definition at line 51 of file ports/cosmic/STM8/chcore.c.
| #define ENABLE_WFI_IDLE 0 |
Enables the use of a wait state in the idle thread loop.
Definition at line 43 of file ports/GCC/MSP430/chcore.h.
| #define CH_ARCHITECTURE_MSP430 |
Macro defining the MSP430 architecture.
Definition at line 49 of file ports/GCC/MSP430/chcore.h.
| #define CH_ARCHITECTURE_NAME "MSP430" |
Name of the implemented architecture.
Definition at line 54 of file ports/GCC/MSP430/chcore.h.
| #define CH_CORE_VARIANT_NAME "MSP430" |
Name of the architecture variant (optional).
Definition at line 59 of file ports/GCC/MSP430/chcore.h.
| #define CH_COMPILER_NAME "GCC " __VERSION__ |
Name of the compiler supported by this port.
Definition at line 64 of file ports/GCC/MSP430/chcore.h.
| #define CH_PORT_INFO "None" |
Port-specific information string.
Definition at line 69 of file ports/GCC/MSP430/chcore.h.
| #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; \
}
Platform dependent part of the chThdCreateI() API.
This code usually setup the context switching frame represented by an intctx structure.
Definition at line 126 of file ports/GCC/MSP430/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 142 of file ports/GCC/MSP430/chcore.h.
| #define PORT_INT_REQUIRED_STACK 32 |
Per-thread stack overhead for interrupts servicing.
This constant is used in the calculation of the correct working area size. This value can be zero on those architecture where there is a separate interrupt stack and the stack space between intctx and extctx is known to be zero.
Definition at line 155 of file ports/GCC/MSP430/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 161 of file ports/GCC/MSP430/chcore.h.
| #define THD_WA_SIZE | ( | n | ) |
STACK_ALIGN(sizeof(Thread) + \ sizeof(struct intctx) + \ sizeof(struct extctx) + \ (n) + (PORT_INT_REQUIRED_STACK))
Computes the thread working area global size.
Definition at line 166 of file ports/GCC/MSP430/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 176 of file ports/GCC/MSP430/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 183 of file ports/GCC/MSP430/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 190 of file ports/GCC/MSP430/chcore.h.
| #define PORT_IRQ_HANDLER | ( | id | ) | ISR(id, ISRNAME(vect, id)) |
IRQ handler function declaration.
id can be a function name or a vector number depending on the port implementation. Definition at line 204 of file ports/GCC/MSP430/chcore.h.
| #define port_init | ( | void | ) |
Port-related initialization code.
Definition at line 210 of file ports/GCC/MSP430/chcore.h.
| #define port_lock | ( | void | ) | asm volatile ("dint" : : : "memory") |
Kernel-lock action.
Usually this function just disables interrupts but may perform more actions.
Definition at line 218 of file ports/GCC/MSP430/chcore.h.
| #define port_unlock | ( | void | ) | asm volatile ("eint" : : : "memory") |
Kernel-unlock action.
Usually this function just enables interrupts but may perform more actions.
Definition at line 226 of file ports/GCC/MSP430/chcore.h.
| #define port_lock_from_isr | ( | void | ) |
Kernel-lock action from an interrupt handler.
This function is invoked before invoking I-class APIs from interrupt handlers. The implementation is architecture dependen::define PORT_IRQ_EPILOGUE() { \ if (chSchIsPreemptionRequired()) \ chSchDoReschedule(); \ } t, in its simplest form it is void.
Definition at line 239 of file ports/GCC/MSP430/chcore.h.
| #define port_unlock_from_isr | ( | void | ) |
Kernel-unlock action from an interrupt handler.
This function is invoked after invoking I-class APIs from interrupt handlers. The implementation is architecture dependent, in its simplest form it is void.
Definition at line 248 of file ports/GCC/MSP430/chcore.h.
| #define port_disable | ( | void | ) | asm volatile ("dint" : : : "memory") |
Disables all the interrupt sources.
Definition at line 255 of file ports/GCC/MSP430/chcore.h.
| #define port_suspend | ( | void | ) | asm volatile ("dint" : : : "memory") |
Disables the interrupt sources below kernel-level priority.
port_disable() in this port, there is no difference between the two states. Definition at line 263 of file ports/GCC/MSP430/chcore.h.
| #define port_enable | ( | void | ) | asm volatile ("eint" : : : "memory") |
Enables all the interrupt sources.
Definition at line 269 of file ports/GCC/MSP430/chcore.h.
| #define port_wait_for_interrupt | ( | void | ) |
Enters an architecture-dependent IRQ-waiting mode.
The function is meant to return when an interrupt becomes pending. The simplest implementation is an empty function or macro but this would not take advantage of architecture-specific power saving modes.
Definition at line 290 of file ports/GCC/MSP430/chcore.h.
| #define port_switch | ( | ntp, | |
| otp | |||
| ) | _port_switch(ntp, otp) |
Wrapper of the assembler _port_switch() function.
Definition at line 296 of file ports/GCC/MSP430/chcore.h.
| #define INLINE inline |
Inline function modifier.
Definition at line 57 of file ports/GCC/MSP430/chtypes.h.
| #define ROMCONST const |
ROM constant modifier.
Definition at line 63 of file ports/GCC/MSP430/chtypes.h.
| #define PACK_STRUCT_STRUCT __attribute__((packed)) |
Packed structure modifier (within).
Definition at line 69 of file ports/GCC/MSP430/chtypes.h.
| #define PACK_STRUCT_BEGIN |
Packed structure modifier (before).
Definition at line 75 of file ports/GCC/MSP430/chtypes.h.
| #define PACK_STRUCT_END |
Packed structure modifier (after).
Definition at line 81 of file ports/GCC/MSP430/chtypes.h.
| typedef uint16_t stkalign_t |
16 bits stack and memory alignment enforcement.
Definition at line 74 of file ports/GCC/MSP430/chcore.h.
| typedef void* regmsp_t |
Generic MSP430 register.
Definition at line 79 of file ports/GCC/MSP430/chcore.h.
Fast boolean type.
Definition at line 41 of file ports/GCC/MSP430/chtypes.h.
Thread flags.
Definition at line 42 of file ports/GCC/MSP430/chtypes.h.
Thread state.
Definition at line 43 of file ports/GCC/MSP430/chtypes.h.
Thread references counter.
Definition at line 44 of file ports/GCC/MSP430/chtypes.h.
Thread time slices counter.
Definition at line 45 of file ports/GCC/MSP430/chtypes.h.
Thread priority.
Definition at line 46 of file ports/GCC/MSP430/chtypes.h.
Inter-thread message.
Definition at line 47 of file ports/GCC/MSP430/chtypes.h.
Event Id.
Definition at line 48 of file ports/GCC/MSP430/chtypes.h.
| typedef uint16_t eventmask_t |
Event mask.
Definition at line 49 of file ports/GCC/MSP430/chtypes.h.
| typedef uint16_t flagsmask_t |
Event flags.
Definition at line 50 of file ports/GCC/MSP430/chtypes.h.
System time.
Definition at line 51 of file ports/GCC/MSP430/chtypes.h.
Resources counter.
Definition at line 52 of file ports/GCC/MSP430/chtypes.h.