42 #define _________________________________________LOCAL_TYPES_SECTION________________________________________________________________________ 46 #undef _________________________________________LOCAL_TYPES_SECTION________________________________________________________________________ 54 #define _________________________________________LOCAL_MACROS_SECTION_______________________________________________________________________ 56 #define PWR_CR1 oC_Register(PWR,PWR_CR1) 57 #define IsRam(Address) (oC_LSF_IsRamAddress(Address) || oC_LSF_IsExternalAddress(Address)) 58 #define IsRom(Address) oC_LSF_IsRomAddress(Address) 60 #undef _________________________________________LOCAL_MACROS_SECTION_______________________________________________________________________ 67 #define _________________________________________VARIABLES_SECTION__________________________________________________________________________ 73 #undef _________________________________________VARIABLES_SECTION__________________________________________________________________________ 80 #define _________________________________________LOCAL_PROTOTYPES_SECTION___________________________________________________________________ 85 #undef _________________________________________LOCAL_PROTOTYPES_SECTION___________________________________________________________________ 92 #define _________________________________________INTERFACE_FUNCITONS_SECTION________________________________________________________________ 105 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
116 EventInterruptHandler =
NULL;
117 EnabledEventsFlags = 0;
118 SystemTimerFrequency = 0;
120 errorCode = oC_ErrorCode_None;
124 errorCode = oC_ErrorCode_CannotInitializeModule;
140 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
146 EventInterruptHandler =
NULL;
147 EnabledEventsFlags = 0;
148 SystemTimerFrequency = 0;
152 errorCode = oC_ErrorCode_None;
166 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
172 oC_AssignErrorCodeIfFalse(&errorCode , IsRam(EventHandler) || IsRom(EventHandler) , oC_ErrorCode_WrongEventHandlerAddress) &&
173 oC_AssignErrorCodeIfFalse(&errorCode , EventInterruptHandler ==
NULL , oC_ErrorCode_InterruptHandlerAlreadySet)
176 EventInterruptHandler = EventHandler;
177 EnabledEventsFlags = EventsFlags;
179 EnableEventsInterrupts(EventsFlags);
181 errorCode = oC_ErrorCode_None;
263 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
269 oC_AssignErrorCodeIfFalse(&errorCode , IsRom(Interrupt) || IsRam(Interrupt) , oC_ErrorCode_WrongEventHandlerAddress) &&
270 oC_AssignErrorCodeIfFalse(&errorCode , Frequency > 0 && (Frequency <= clockFrequency) , oC_ErrorCode_WrongFrequency)
273 uint32_t prescaler = clockFrequency / Frequency;
279 SystemTimerFrequency = clockFrequency / prescaler;
280 errorCode = oC_ErrorCode_None;
284 errorCode = oC_ErrorCode_FrequencyNotPossible;
301 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
305 if(oC_AssignErrorCodeIfFalse(&errorCode , SystemTimerFrequency != 0 , oC_ErrorCode_SystemClockNotConfigured))
307 *outFrequency = SystemTimerFrequency;
308 errorCode = oC_ErrorCode_None;
323 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
331 errorCode = oC_ErrorCode_None;
335 errorCode = oC_ErrorCode_ContextNotCorrect;
352 oC_Int_t stackSize = 0;
370 oC_Int_t freeStackSize = 0;
377 return freeStackSize;
421 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
426 oC_AssignErrorCodeIfFalse(&errorCode , IsRam(Context) , oC_ErrorCode_OutputAddressNotInRAM ) &&
427 oC_AssignErrorCodeIfFalse(&errorCode , IsRam(Context) || IsRom(ContextHandler) , oC_ErrorCode_WrongEventHandlerAddress ) &&
428 oC_AssignErrorCodeIfFalse(&errorCode , IsRam(ExitHandler) || IsRom(ExitHandler) , oC_ErrorCode_WrongEventHandlerAddress ) &&
429 oC_AssignErrorCodeIfFalse(&errorCode , StackSize > 0 , oC_ErrorCode_WrongStackSize)
434 errorCode = oC_ErrorCode_None;
438 errorCode = oC_ErrorCode_CannotInitializeStack;
520 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
522 if(oC_AssignErrorCodeIfFalse(&errorCode , oC_LSF_IsRamAddress(outVcc) , oC_ErrorCode_OutputAddressNotInRAM))
525 errorCode = oC_ErrorCode_None;
542 #undef _________________________________________INTERFACE_FUNCITONS_SECTION________________________________________________________________ 550 #define _________________________________________LOCAL_FUNCTIONS_SECTION____________________________________________________________________ 572 if(IsRom(EventInterruptHandler) || IsRam(EventInterruptHandler))
574 if(EnabledEventsFlags & EventFlags)
581 #undef _________________________________________LOCAL_FUNCTIONS_SECTION____________________________________________________________________ 588 #define _________________________________________INTERRUPTS_SECTION_________________________________________________________________________ 600 oC_ASSERT( EventInterruptHandler !=
NULL );
603 #undef _________________________________________INTERRUPTS_SECTION_________________________________________________________________________ #define oC_InterruptHandler(BASE_NAME, TYPE_NAME)
Define handler for interrupt.
oC_SYS_LLD_Context_t * oC_SYS_LLD_GetSystemContext(void)
returns pointer to the system context
oC_SYS_LLD_EventFlags_t
event flags handled by the module.
oC_Int_t oC_MCS_GetMinimumStackBufferSize(oC_Int_t StackSize)
returns minimum stack buffer size
void * oC_MCS_GetCurrentProcessStackPointer(void)
returns current value of PSP
oC_InterruptHandler_t oC_UnexpectedInterruptHandler
Handler for unexpected interrupts.
void(* oC_SYS_LLD_ContextHandler_t)(void *Parameter)
stores pointer to context handler function
oC_Int_t oC_SYS_LLD_GetMinimumContextSize(oC_Int_t StackSize)
returns minimum size to allocate for context
#define oC_MACHINE_FAMILY
double oC_Frequency_t
type to store frequency
void(* oC_SYS_LLD_EventInterrupt_t)(oC_SYS_LLD_EventFlags_t EventFlags, oC_SYS_LLD_Context_t *Context, void *BusAddress)
stores event handler function
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
oC_SYS_LLD_Context_t * oC_SYS_LLD_GetCurrentContext(void)
returns pointer to the current context
const char * oC_SYS_LLD_GetMachineFamilyName(void)
returns printable name of the machine family
void * oC_MCS_GetHardFaultReason(void)
returns address that cause a hard fault
The file contains definitions for the compiler, that helps to manage errors, etc. ...
oC_Stack_t oC_MCS_GetSystemStack(void)
returns pointer to the system stack
oC_ErrorCode_t oC_SYS_LLD_TurnOnDriver(void)
initializes the driver to work
const char * oC_SYS_LLD_GetMachineProducentName(void)
returns printable name of the machine producent
The file with interface for LSF module.
bool oC_MCS_ReturnToSystemStack(void)
sets next stack as system stack
oC_ErrorCode_t oC_SYS_LLD_ReturnToSystemContext(void)
switches to the system context
void oC_MCS_Reboot(void)
Software reboots of machine.
void oC_SYS_LLD_ExitCriticalSection(void)
exits from critical section
The file with LLD interface for the MEM driver.
bool oC_MCS_InitializeStack(oC_Stack_t *outStack, void *Buffer, oC_Int_t BufferSize, oC_ContextHandler_t ContextHandler, void *HandlerParameter, oC_ContextExitHandler_t ExitHandler)
initializes stack for the system
oC_ErrorCode_t oC_SYS_LLD_ConfigureSystemTimer(oC_Frequency_t Frequency, oC_SYS_LLD_SysTickIncrementHandler_t Interrupt)
configures system timer
oC_ErrorCode_t oC_SYS_LLD_ReadSystemTimerFrequency(oC_Frequency_t *outFrequency)
reads configured system frequency
void oC_SYS_LLD_Context_t
type for storing context of the machine
void oC_SYS_LLD_TurnOnInterrupts(void)
turns on interrupt
void(* oC_SYS_LLD_SysTickIncrementHandler_t)(void)
stores SysTick interrupt handler
oC_Int_t oC_MCS_GetFreeStackSize(oC_Stack_t Stack)
returns number of free stack
oC_ErrorCode_t oC_SYS_LLD_TurnOffDriver(void)
release the driver
bool oC_MCS_SetNextStack(oC_Stack_t Stack)
sets next stack for context switching
void(* oC_SYS_LLD_ContextExitHandler_t)(void)
pointer to the context exit handler
The file with interface for the module library.
const char * oC_SYS_LLD_GetMachineName(void)
returns printable name of the machine
oC_Frequency_t oC_CLOCK_LLD_GetClockFrequency(void)
returns frequency of the system clock
oC_Int_t oC_SYS_LLD_GetContextStackSize(oC_SYS_LLD_Context_t *Context)
returns size of the stack for context
static bool oC_Module_IsTurnedOn(oC_Module_t Module)
checks if the module is turned on
The file with LLD interface for the CLOCK driver.
oC_ErrorCode_t oC_SYS_LLD_ReadPowerState(float *outVcc)
reads power state
oC_ErrorCode_t oC_SYS_LLD_SetNextContext(oC_SYS_LLD_Context_t *Context)
configures next machine context
void oC_SYS_LLD_EnterCriticalSection(void)
enters to critical section
bool oC_MCS_ConfigureSystemTimer(oC_UInt_t Prescaler, oC_FindNextStackHandler_t FindNextStackHandler)
configures system timer
bool oC_MCS_AreInterruptsEnabled(void)
Checks if interrupts are enabled in HW.
oC_Int_t oC_MCS_GetStackSize(oC_Stack_t Stack)
returns size of stack
static void oC_Module_TurnOn(oC_Module_t Module)
sets module as turned on
Contains machine core specific functions.
bool oC_MCS_InitializeModule(void)
initializes module to work
oC_ErrorCode_t oC_SYS_LLD_SetEventInterruptHandler(oC_SYS_LLD_EventInterrupt_t EventHandler, oC_SYS_LLD_EventFlags_t EventsFlags)
sets event interrupt handler
static void oC_MCS_EnterCriticalSection(void)
Enters to critical section.
oC_Stack_t oC_MCS_GetCurrentStack(void)
returns current stack
The file with interface for the machine module.
The file with interface interrupt module.
void oC_MCS_DisableInterrupts(void)
Globally disables interrupts (always)
#define oC_MCS_IsStackPushDecrementPointer()
returns true if stack push decrements SP
void oC_SYS_LLD_Reset(void)
software reset of the machine
static bool oC_Module_TurnOffVerification(oC_ErrorCode_t *outErrorCode, oC_Module_t Module)
verify if module is turned off
static bool oC_MCS_ExitCriticalSection(void)
Exits from critical section.
static bool oC_Module_TurnOnVerification(oC_ErrorCode_t *outErrorCode, oC_Module_t Module)
verify if module is turned on
void oC_MCS_EnableInterrupts(void)
Globally enables interrupts (always)
The file with LLD interface for the SYS driver.
bool oC_SYS_LLD_AreInterruptsEnabled(void)
checks if interrupts are turned on
void * oC_SYS_LLD_GetLastProcessStackPointer(void)
returns stack pointer of last executed process
bool oC_SYS_LLD_IsStackPushDecrementPointer(void)
flag if stack push is decrement pointer
void oC_SYS_LLD_TurnOffInterrupts(void)
turns off interrupt
bool oC_SYS_LLD_IsMachineSupportMultithreadMode(void)
checks if the machine supports multi-thread mode
Hard fault, reason is unknown.
#define NULL
pointer to a zero
static void oC_Module_TurnOff(oC_Module_t Module)
sets module as turned off
oC_Int_t oC_SYS_LLD_GetContextFreeStackSize(oC_SYS_LLD_Context_t *Context)
returns size of free stack in the context