Non portable code templates.
◆ PORT_SUPPORTS_RT
#define PORT_SUPPORTS_RT FALSE |
This port supports a realtime counter.
Definition at line 44 of file chcore.h.
◆ PORT_NATURAL_ALIGN
#define PORT_NATURAL_ALIGN sizeof (void *) |
Natural alignment constant.
- Note
- It is the minimum alignment for pointer-size variables.
Definition at line 50 of file chcore.h.
◆ PORT_STACK_ALIGN
Stack alignment constant.
- Note
- It is the alignment required for the stack pointer.
Definition at line 56 of file chcore.h.
◆ PORT_WORKING_AREA_ALIGN
#define PORT_WORKING_AREA_ALIGN sizeof (stkalign_t) |
Working Areas alignment constant.
- Note
- It is the alignment to be enforced for thread working areas.
Definition at line 62 of file chcore.h.
◆ PORT_ARCHITECTURE_XXX
#define PORT_ARCHITECTURE_XXX |
Macro defining an XXX architecture.
Definition at line 72 of file chcore.h.
◆ PORT_ARCHITECTURE_XXX_YYY
#define PORT_ARCHITECTURE_XXX_YYY |
Macro defining the specific XXX architecture.
Definition at line 77 of file chcore.h.
◆ PORT_ARCHITECTURE_NAME
#define PORT_ARCHITECTURE_NAME "XXX Architecture" |
Name of the implemented architecture.
Definition at line 82 of file chcore.h.
◆ PORT_COMPILER_NAME
#define PORT_COMPILER_NAME "GCC " __VERSION__ |
Compiler name and version.
Definition at line 88 of file chcore.h.
◆ PORT_INFO
#define PORT_INFO "no info" |
Port-specific information string.
Definition at line 97 of file chcore.h.
◆ PORT_IDLE_THREAD_STACK_SIZE
#define PORT_IDLE_THREAD_STACK_SIZE 32 |
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 111 of file chcore.h.
◆ PORT_INT_REQUIRED_STACK
#define PORT_INT_REQUIRED_STACK 256 |
Per-thread stack overhead for interrupts servicing.
This constant is used in the calculation of the correct working area size.
Definition at line 120 of file chcore.h.
◆ PORT_XXX_ENABLE_WFI_IDLE
#define PORT_XXX_ENABLE_WFI_IDLE FALSE |
Enables a "wait for interrupt" instruction in the idle loop.
Definition at line 127 of file chcore.h.
◆ PORT_THD_FUNCTION
#define PORT_THD_FUNCTION |
( |
|
tname, |
|
|
|
arg |
|
) |
| void tname(void *arg) |
Optimized thread function declaration macro.
Definition at line 182 of file chcore.h.
◆ PORT_SETUP_CONTEXT
#define PORT_SETUP_CONTEXT |
( |
|
tp, |
|
|
|
wbase, |
|
|
|
wtop, |
|
|
|
pf, |
|
|
|
arg |
|
) |
| |
Value:
Platform dependent part of the chThdCreateI()
API.
This code usually setup the context switching frame represented by an port_intctx
structure.
Definition at line 189 of file chcore.h.
◆ PORT_WA_SIZE
#define PORT_WA_SIZE |
( |
|
n | ) |
|
Value:
Computes the thread working area global size.
- Note
- There is no need to perform alignments in this macro.
Definition at line 196 of file chcore.h.
◆ PORT_WORKING_AREA
Static working area allocation.
This macro is used to allocate a static thread working area aligned as both position and size.
- Parameters
-
[in] | s | the name to be assigned to the stack array |
[in] | n | the stack size to be assigned to the thread |
Definition at line 208 of file chcore.h.
◆ PORT_IRQ_IS_VALID_PRIORITY
#define PORT_IRQ_IS_VALID_PRIORITY |
( |
|
n | ) |
false |
Priority level verification macro.
Definition at line 214 of file chcore.h.
◆ PORT_IRQ_IS_VALID_KERNEL_PRIORITY
#define PORT_IRQ_IS_VALID_KERNEL_PRIORITY |
( |
|
n | ) |
false |
Priority level verification macro.
Definition at line 219 of file chcore.h.
◆ PORT_IRQ_PROLOGUE
#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 226 of file chcore.h.
◆ PORT_IRQ_EPILOGUE
#define PORT_IRQ_EPILOGUE |
( |
| ) |
|
IRQ epilogue code.
This macro must be inserted at the end of all IRQ handlers enabled to invoke system APIs.
Definition at line 233 of file chcore.h.
◆ PORT_IRQ_HANDLER
#define PORT_IRQ_HANDLER |
( |
|
id | ) |
void id(void) |
IRQ handler function declaration.
- Note
id
can be a function name or a vector number depending on the port implementation.
Definition at line 243 of file chcore.h.
◆ PORT_FAST_IRQ_HANDLER
#define PORT_FAST_IRQ_HANDLER |
( |
|
id | ) |
void id(void) |
Fast IRQ handler function declaration.
- Note
id
can be a function name or a vector number depending on the port implementation.
Definition at line 254 of file chcore.h.
◆ port_switch
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.
- Note
- The implementation of this code affects directly the context switch performance so optimize here as much as you can.
- Parameters
-
[in] | ntp | the thread to be switched in |
[in] | otp | the thread to be switched out |
Definition at line 268 of file chcore.h.
◆ _port_init()
Port-related initialization code.
- Note
- This function is usually empty.
Definition at line 59 of file chcore.c.
◆ _port_switch()
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.
- Note
- The implementation of this code affects directly the context switch performance so optimize here as much as you can.
- Parameters
-
[in] | ntp | the thread to be switched in |
[in] | otp | the thread to be switched out |
Definition at line 72 of file chcore.c.
◆ port_get_irq_status()
static syssts_t port_get_irq_status |
( |
void |
| ) |
|
|
inlinestatic |
◆ port_irq_enabled()
static bool port_irq_enabled |
( |
syssts_t |
sts | ) |
|
|
inlinestatic |
◆ port_is_isr_context()
static bool port_is_isr_context |
( |
void |
| ) |
|
|
inlinestatic |
◆ port_lock()
static void port_lock |
( |
void |
| ) |
|
|
inlinestatic |
Kernel-lock action.
Usually this function just disables interrupts but may perform more actions.
Definition at line 348 of file chcore.h.
Referenced by chSysLock().
◆ port_unlock()
static void port_unlock |
( |
void |
| ) |
|
|
inlinestatic |
Kernel-unlock action.
Usually this function just enables interrupts but may perform more actions.
Definition at line 357 of file chcore.h.
◆ port_lock_from_isr()
static void port_lock_from_isr |
( |
void |
| ) |
|
|
inlinestatic |
◆ port_unlock_from_isr()
static void port_unlock_from_isr |
( |
void |
| ) |
|
|
inlinestatic |
◆ port_disable()
static void port_disable |
( |
void |
| ) |
|
|
inlinestatic |
Disables all the interrupt sources.
- Note
- Of course non-maskable interrupt sources are not included.
Definition at line 385 of file chcore.h.
Referenced by chSysDisable(), and chSysHalt().
◆ port_suspend()
static void port_suspend |
( |
void |
| ) |
|
|
inlinestatic |
Disables the interrupt sources below kernel-level priority.
- Note
- Interrupt sources above kernel level remains enabled.
Definition at line 393 of file chcore.h.
Referenced by chSysSuspend().
◆ port_enable()
static void port_enable |
( |
void |
| ) |
|
|
inlinestatic |
Enables all the interrupt sources.
Definition at line 400 of file chcore.h.
◆ port_wait_for_interrupt()
static void port_wait_for_interrupt |
( |
void |
| ) |
|
|
inlinestatic |
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 411 of file chcore.h.
Referenced by __idle_thread().
◆ port_rt_get_counter_value()
static rtcnt_t port_rt_get_counter_value |
( |
void |
| ) |
|
|
inlinestatic |
Returns the current value of the realtime counter.
- Returns
- The realtime counter value.
Definition at line 422 of file chcore.h.