Choco OS
V.0.16.9.0
Join to the chocolate world
|
Manage system operations. More...
Typedefs | |
typedef void | oC_SYS_LLD_Context_t |
type for storing context of the machine More... | |
typedef void(* | oC_SYS_LLD_Interrupt_t) (void) |
type for storing interrupt pointers More... | |
typedef void(* | oC_SYS_LLD_SysTickIncrementHandler_t) (void) |
stores SysTick interrupt handler More... | |
typedef void(* | oC_SYS_LLD_EventInterrupt_t) (oC_SYS_LLD_EventFlags_t EventFlags, oC_SYS_LLD_Context_t *Context, void *BusAddress) |
stores event handler function More... | |
typedef void(* | oC_SYS_LLD_ContextHandler_t) (void *Parameter) |
stores pointer to context handler function More... | |
typedef void(* | oC_SYS_LLD_ContextExitHandler_t) (void) |
pointer to the context exit handler More... | |
Enumerations |
Functions | |
oC_ErrorCode_t | oC_SYS_LLD_TurnOnDriver (void) |
initializes the driver to work More... | |
oC_ErrorCode_t | oC_SYS_LLD_TurnOffDriver (void) |
release the driver More... | |
oC_ErrorCode_t | oC_SYS_LLD_SetEventInterruptHandler (oC_SYS_LLD_EventInterrupt_t EventHandler, oC_SYS_LLD_EventFlags_t EventsFlags) |
sets event interrupt handler More... | |
bool | oC_SYS_LLD_IsMachineSupportMultithreadMode (void) |
checks if the machine supports multi-thread mode More... | |
void | oC_SYS_LLD_TurnOnInterrupts (void) |
turns on interrupt More... | |
void | oC_SYS_LLD_TurnOffInterrupts (void) |
turns off interrupt More... | |
void | oC_SYS_LLD_EnterCriticalSection (void) |
enters to critical section More... | |
void | oC_SYS_LLD_ExitCriticalSection (void) |
exits from critical section More... | |
bool | oC_SYS_LLD_AreInterruptsEnabled (void) |
checks if interrupts are turned on More... | |
oC_ErrorCode_t | oC_SYS_LLD_ConfigureSystemTimer (oC_Frequency_t Frequency, oC_SYS_LLD_SysTickIncrementHandler_t Interrupt) |
configures system timer More... | |
oC_ErrorCode_t | oC_SYS_LLD_ReadSystemTimerFrequency (oC_Frequency_t *outFrequency) |
reads configured system frequency More... | |
oC_ErrorCode_t | oC_SYS_LLD_SetNextContext (oC_SYS_LLD_Context_t *Context) |
configures next machine context More... | |
oC_Int_t | oC_SYS_LLD_GetContextStackSize (oC_SYS_LLD_Context_t *Context) |
returns size of the stack for context More... | |
oC_Int_t | oC_SYS_LLD_GetContextFreeStackSize (oC_SYS_LLD_Context_t *Context) |
returns size of free stack in the context More... | |
oC_ErrorCode_t | oC_SYS_LLD_ReturnToSystemContext (void) |
switches to the system context More... | |
oC_SYS_LLD_Context_t * | oC_SYS_LLD_GetCurrentContext (void) |
returns pointer to the current context More... | |
oC_SYS_LLD_Context_t * | oC_SYS_LLD_GetSystemContext (void) |
returns pointer to the system context More... | |
oC_ErrorCode_t | oC_SYS_LLD_InitializeContext (oC_SYS_LLD_Context_t **Context, oC_Int_t StackSize, oC_SYS_LLD_ContextHandler_t ContextHandler, void *Parameters, oC_SYS_LLD_ContextExitHandler_t ExitHandler) |
initializes stack of process More... | |
oC_Int_t | oC_SYS_LLD_GetMinimumContextSize (oC_Int_t StackSize) |
returns minimum size to allocate for context More... | |
const char * | oC_SYS_LLD_GetMachineName (void) |
returns printable name of the machine More... | |
const char * | oC_SYS_LLD_GetMachineFamilyName (void) |
returns printable name of the machine family More... | |
const char * | oC_SYS_LLD_GetMachineProducentName (void) |
returns printable name of the machine producent More... | |
void | oC_SYS_LLD_Reset (void) |
software reset of the machine More... | |
bool | oC_SYS_LLD_IsStackPushDecrementPointer (void) |
flag if stack push is decrement pointer More... | |
oC_ErrorCode_t | oC_SYS_LLD_ReadPowerState (float *outVcc) |
reads power state More... | |
void * | oC_SYS_LLD_GetLastProcessStackPointer (void) |
returns stack pointer of last executed process More... | |
kill
thread function. If thread want to destroy by itself, it should just change current context and wait. On the other hand, when some other thread want to kill a thread, there is no need to inform this module - if other thread want to kill, so other thread is currently active.Some example pseudo-code (do not use it - it is only for explanation):
typedef void oC_SYS_LLD_Context_t |
This is the type for storing context of the machine. It should be dynamically allocated with size from the function oC_SYS_LLD_GetContextStackSize. The start of this structure pointer is at the start of the stack. It must be initialized by oC_SYS_LLD_InitializeContext function before usage. When it is done, you can change the context of the machine (call other task) by using the function oC_SYS_LLD_SetNextContext.
Definition at line 143 of file oc_sys_lld.h.
typedef void(* oC_SYS_LLD_ContextExitHandler_t) (void) |
The type stores pointer to the function, that is called, when the context handler finish work.
Definition at line 216 of file oc_sys_lld.h.
typedef void(* oC_SYS_LLD_ContextHandler_t) (void *Parameter) |
The type stores pointer to the function, that handle context
Parameter | User parameter for the function |
Definition at line 207 of file oc_sys_lld.h.
typedef void(* oC_SYS_LLD_EventInterrupt_t) (oC_SYS_LLD_EventFlags_t EventFlags, oC_SYS_LLD_Context_t *Context, void *BusAddress) |
The type is for storing handler of events. It is a function that will be called, when one of enabled events by oC_SYS_LLD_SetEventInterruptHandler function will occur.
EventFlags | Flags of active events (can be more than one) |
Context | Context of the event |
Definition at line 196 of file oc_sys_lld.h.
typedef void(* oC_SYS_LLD_Interrupt_t) (void) |
The type is for storing interrupt handler function pointer. The function that is set to this pointer should be as short as possible, and it should be included, that this is executed in an interrupt.
Definition at line 172 of file oc_sys_lld.h.
typedef void(* oC_SYS_LLD_SysTickIncrementHandler_t) (void) |
The type is for storing special function - SysTick handler. It is the function, that is called periodically as interrupt for inform the system about need the increment of the system tick counter. The handler should also change the current system task if it is needed.
Definition at line 182 of file oc_sys_lld.h.
The type stores flags for module events. Event handler, and interrupts selection can be done by oC_SYS_LLD_SetEventInterruptHandler function.
Definition at line 153 of file oc_sys_lld.h.
bool oC_SYS_LLD_AreInterruptsEnabled | ( | void | ) |
Definition at line 250 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_ConfigureSystemTimer | ( | oC_Frequency_t | Frequency, |
oC_SYS_LLD_SysTickIncrementHandler_t | Interrupt | ||
) |
The function is for configuration of the system timer that should call the Interrupt with the given Frequency.
Frequency | Frequency of switching context event |
Interrupt | SysTick increment interrupt handler |
Definition at line 261 of file oc_sys_lld.c.
void oC_SYS_LLD_EnterCriticalSection | ( | void | ) |
The function enters to critical section.
Definition at line 228 of file oc_sys_lld.c.
void oC_SYS_LLD_ExitCriticalSection | ( | void | ) |
The function enters to critical section.
Definition at line 239 of file oc_sys_lld.c.
oC_Int_t oC_SYS_LLD_GetContextFreeStackSize | ( | oC_SYS_LLD_Context_t * | Context | ) |
The function returns size of the free memory on the context stack.
Context | Pointer to the context initialized before by oC_SYS_LLD_InitializeContext |
Definition at line 368 of file oc_sys_lld.c.
oC_Int_t oC_SYS_LLD_GetContextStackSize | ( | oC_SYS_LLD_Context_t * | Context | ) |
It returns size of the stack, that is allocated for the context. Note, that this size does not contain an extra size that is additionally required and used for handling the context. All of this size is used only for handling the process stack.
Context | Initialized context pointer |
Definition at line 350 of file oc_sys_lld.c.
oC_SYS_LLD_Context_t * oC_SYS_LLD_GetCurrentContext | ( | void | ) |
Definition at line 397 of file oc_sys_lld.c.
void * oC_SYS_LLD_GetLastProcessStackPointer | ( | void | ) |
Definition at line 537 of file oc_sys_lld.c.
const char * oC_SYS_LLD_GetMachineFamilyName | ( | void | ) |
The function is for reading name of the target machine family.
Definition at line 474 of file oc_sys_lld.c.
const char * oC_SYS_LLD_GetMachineName | ( | void | ) |
The function is for reading name of the target machine.
Definition at line 463 of file oc_sys_lld.c.
const char * oC_SYS_LLD_GetMachineProducentName | ( | void | ) |
The function is for reading name of the target machine company.
Definition at line 485 of file oc_sys_lld.c.
oC_Int_t oC_SYS_LLD_GetMinimumContextSize | ( | oC_Int_t | StackSize | ) |
The function returns the minimum size of allocation that is needed to handle the context switching.
StackSize | The minimum stack size, that you will need for the task |
Definition at line 452 of file oc_sys_lld.c.
oC_SYS_LLD_Context_t * oC_SYS_LLD_GetSystemContext | ( | void | ) |
Definition at line 408 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_InitializeContext | ( | oC_SYS_LLD_Context_t ** | Context, |
oC_Int_t | StackSize, | ||
oC_SYS_LLD_ContextHandler_t | ContextHandler, | ||
void * | Parameters, | ||
oC_SYS_LLD_ContextExitHandler_t | ExitHandler | ||
) |
The function is for initialization of a context stack. Note, that the context must be allocated and initialized before. The minimum size of the stack for a context can be read by the function oC_SYS_LLD_GetMinimumContextSize.
Here some example of usage:
Context | Allocated memory to initialize. It will be used as a context stack. |
StackSize | Size of the stack. It is not equal to the allocation size (this size should be smaller) |
ContextHandler | The function that should be called, while this context is active |
Parameters | Optional parameter for the ContextHandler function |
ExitHandler | The function that should be called, when the context handler will finish. |
oC_ErrorCode_None
if successDefinition at line 419 of file oc_sys_lld.c.
bool oC_SYS_LLD_IsMachineSupportMultithreadMode | ( | void | ) |
The function checks if the machine supports multi-thread mode. It returns false if it is not supported or not implemented already.
Definition at line 195 of file oc_sys_lld.c.
bool oC_SYS_LLD_IsStackPushDecrementPointer | ( | void | ) |
The function is for checking if stack push command is decrement or increment pointer on this machine.
Definition at line 507 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_ReadPowerState | ( | float * | outVcc | ) |
The function reads current power state (the VCC of the CPU)
Definition at line 518 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_ReadSystemTimerFrequency | ( | oC_Frequency_t * | outFrequency | ) |
The function is for reading frequency of the system timer.
outFrequency | a destination for the variable where the frequency should be saved. |
Definition at line 299 of file oc_sys_lld.c.
void oC_SYS_LLD_Reset | ( | void | ) |
This function never returns.
Definition at line 496 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_ReturnToSystemContext | ( | void | ) |
The function returns to the system context - the context, that was active, when the SYS LLD module was turned on.
Definition at line 386 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_SetEventInterruptHandler | ( | oC_SYS_LLD_EventInterrupt_t | EventHandler, |
oC_SYS_LLD_EventFlags_t | EventsFlags | ||
) |
The function is for configuration of the event interrupts for the module. For information what events are handled, look at the oC_SYS_LLD_EventFlags_t type. The function configures and turns on each interrupt.
EventHandler | Pointer to the function that should be called, when event occurs |
EventsFlags | Events, that should be enabled |
Definition at line 164 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_SetNextContext | ( | oC_SYS_LLD_Context_t * | Context | ) |
The function is for setting next context of the machine. It will save the pointer for later - the context will be switched with the first call of context switching interrupt. The context is the process stack. It should be allocated and initialized by oC_SYS_LLD_InitializeContext function before usage.
Definition at line 321 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_TurnOffDriver | ( | void | ) |
The function is for releasing resources needed for the driver. The main driver should call it every time, when it is turned off. This function should restore default states in all resources, that are handled and was initialized by the driver. It must not protect by itself again turning off the driver when it is not turned on.
Definition at line 138 of file oc_sys_lld.c.
void oC_SYS_LLD_TurnOffInterrupts | ( | void | ) |
The function is for turning off interrupts. It not protect before recursive calling, each call of this function turns off interrupts.This function can be used also when module is turned off.
Definition at line 217 of file oc_sys_lld.c.
oC_ErrorCode_t oC_SYS_LLD_TurnOnDriver | ( | void | ) |
The function is for initializing the low level driver. It will be called every time when the driver will turned on. There is no need to protect again returning because the main driver should protect it by itself.
Definition at line 103 of file oc_sys_lld.c.
void oC_SYS_LLD_TurnOnInterrupts | ( | void | ) |
The function is for turning on interrupts. It not protect before recursive calling, each call of this function turns on interrupts. This function can be used also when module is turned off.
Definition at line 206 of file oc_sys_lld.c.