distortos
v0.7.0
object-oriented C++ RTOS for microcontrollers
|
Architecture-related code of distortos project. More...
Classes | |
struct | ExceptionFpuStackFrame |
stack frame for ARMv7-M created by hardware on exception entry when FPU context is active More... | |
struct | ExceptionStackFrame |
stack frame for ARMv6-M and ARMv7-M created by hardware on exception entry More... | |
struct | SoftwareStackFrame |
stack frame for ARMv6-M and ARMv7-M created by software during context switch More... | |
struct | StackFrame |
complete stack frame of thread for ARMv6-M and ARMv7-M More... | |
Typedefs | |
using | InterruptMask = uint32_t |
interrupt mask More... | |
Functions | |
InterruptMask | disableInterruptMasking () |
Disables interrupt masking. More... | |
InterruptMask | enableInterruptMasking () |
Enables interrupt masking. More... | |
std::pair< void *, size_t > | getMainStack () |
Gets the stack used to run main(). More... | |
std::pair< int, void * > | initializeStack (void *buffer, size_t size, internal::RunnableThread &runnableThread) |
Architecture-specific stack initialization. More... | |
bool | isInInterruptContext () |
Architecture-specific check of context. More... | |
void | requestContextSwitch () |
Architecture-specific request for context switch. More... | |
int | requestFunctionExecution (internal::ThreadControlBlock &threadControlBlock, void(&function)()) |
Requests execution of provided function in the specified thread. More... | |
void | restoreInterruptMasking (InterruptMask interruptMask) |
Restores interrupt masking. More... | |
int | supervisorCall (int(&function)(int, int, int, int), int argument1, int argument2, int argument3, int argument4) |
Supervisor call. More... | |
Variables | |
char | __process_stack_start [] |
beginning of process stack - imported from linker script More... | |
char | __process_stack_size [] |
size of process stack, bytes - imported from linker script More... | |
Architecture-related code of distortos project.
using distortos::architecture::InterruptMask = typedef uint32_t |
interrupt mask
InterruptMask distortos::architecture::disableInterruptMasking | ( | ) |
Disables interrupt masking.
Enables normal-priority interrupts.
InterruptMask distortos::architecture::enableInterruptMasking | ( | ) |
Enables interrupt masking.
Disables normal-priority interrupts.
std::pair< void *, size_t > distortos::architecture::getMainStack | ( | ) |
Gets the stack used to run main().
std::pair< int, void * > distortos::architecture::initializeStack | ( | void * | buffer, |
size_t | size, | ||
internal::RunnableThread & | runnableThread | ||
) |
Architecture-specific stack initialization.
This function fills provided buffer with hardware and software stack frame and calculates value of stack pointer register. After this function completes, stack is ready for context switching.
[in] | buffer | is a pointer to stack's buffer |
[in] | size | is the size of stack's buffer, bytes |
[in] | runnableThread | is a reference to internal::RunnableThread object that is being run |
bool distortos::architecture::isInInterruptContext | ( | ) |
Architecture-specific check of context.
Checks whether thread or interrupt context is currently active. An example use is when the application needs to decide between blocking or non-blocking behaviour, as blocking is not possible in interrupt context.
void distortos::architecture::requestContextSwitch | ( | ) |
Architecture-specific request for context switch.
Causes the architecture to do context save, call internal::getScheduler().switchContext() and do context restore. The call to internal::getScheduler().switchContext() must be done from the context in which such call is valid (usually system interrupt).
int distortos::architecture::requestFunctionExecution | ( | internal::ThreadControlBlock & | threadControlBlock, |
void(&)() | function | ||
) |
Requests execution of provided function in the specified thread.
Main use case for this function is to request execution of signals delivery function. In such case it is called when an unblocked signal, which is not ignored, is generated or queued for specified thread.
It must arrange for given function to be executed in specified thread as soon as possible. This generally requires dealing with following scenarios:
[in] | threadControlBlock | is a reference to internal::ThreadControlBlock of thread in which function should be executed |
[in] | function | is a reference to function that should be executed in thread associated with threadControlBlock |
void distortos::architecture::restoreInterruptMasking | ( | InterruptMask | interruptMask | ) |
Restores interrupt masking.
Restores previous interrupt masking state (before matching enableInterruptMasking() or disableInterruptMasking() was called), enabling some (maybe all, maybe none) interrupts.
[in] | interruptMask | is the value of interrupts' mask, must come from previous call to enableInterruptMasking() or disableInterruptMasking() |
int distortos::architecture::supervisorCall | ( | int(&)(int, int, int, int) | function, |
int | argument1, | ||
int | argument2, | ||
int | argument3, | ||
int | argument4 | ||
) |
Supervisor call.
Requests execution of function with arguments from SVC_Handler().
[in] | function | is a reference to function that will be executed |
[in] | argument1 | is the first argument for function |
[in] | argument2 | is the second argument for function |
[in] | argument3 | is the third argument for function |
[in] | argument4 | is the fourth argument for function |
char distortos::architecture::__process_stack_size[] |
size of process stack, bytes - imported from linker script
char distortos::architecture::__process_stack_start[] |
beginning of process stack - imported from linker script