40 #ifndef SYSTEM_PORTABLE_INC_MCS_OC_MCS_H_ 41 #define SYSTEM_PORTABLE_INC_MCS_OC_MCS_H_ 43 #include <oc_interrupts_defs.h> 47 #include <oc_mcs_defs.h> 50 #include <oc_errors.h> 57 #define _________________________________________MACROS_SECTION_____________________________________________________________________________ 77 #define oC_MCS_IsStackPushDecrementPointer() oC_MCS_STACK_PUSH_DECREMENTS_POINTER 89 #define oC_MCS_AlignStackPointer(Pointer) ((void*)oC_MCS_AlignSize((void*)Pointer,oC_MCS_STACK_MEMORY_ALIGNMENT)) 100 #define oC_MCS_AlignPointer(Pointer) ((void*)oC_MCS_AlignSize((void*)Pointer,oC_MCS_MEMORY_ALIGNMENT)) 111 #define oC_MCS_AlignSize(Size,Alignment) ((((oC_UInt_t)(Size)) + (Alignment) - 1) & ~((Alignment)-1)) 119 #define oC_MCS_IsStackPointerAligned(Pointer) (oC_MCS_AlignStackPointer(Pointer) == ((void*)(Pointer))) 127 #define oC_MCS_IsPointerAligned(Pointer) (oC_MCS_AlignPointer(Pointer) == Pointer) 129 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________ 137 #define _________________________________________TYPES_SECTION______________________________________________________________________________ 154 #define IRQn_(NAME,TYPE) oC_1WORD_FROM_3(TYPE , NAME , _IRQn) 156 #define CREATE_INTERRUPT_NUMBER( BASE_NAME , INTERRUPT_TYPE , INTERRUPT_NUMBER , ...) IRQn_(BASE_NAME , INTERRUPT_TYPE) = INTERRUPT_NUMBER , 162 #undef CREATE_INTERRUPT_NUMBER 267 #undef _________________________________________TYPES_SECTION______________________________________________________________________________ 277 #define _________________________________________PROTOTYPES_SECTION_________________________________________________________________________ 449 oC_Int_t BufferSize ,
451 void * HandlerParameter ,
678 #undef _________________________________________PROTOTYPES_SECTION_________________________________________________________________________ 686 #define _________________________________________GLOBAL_VARIABLES_SECTION___________________________________________________________________ 690 #undef _________________________________________GLOBAL_VARIABLES_SECTION___________________________________________________________________ 698 #define _________________________________________STATIC_INLINE_SECTION______________________________________________________________________ 723 static const int16_t criticalCounterMax = INT16_MAX - INT8_MAX;
786 bool interruptsEnabled =
false;
793 return interruptsEnabled;
828 #undef _________________________________________STATIC_INLINE_SECTION______________________________________________________________________
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
bool Cacheable
True if the region should be cacheable - If you set a region to be cacheable: When you load from that...
The file with interface for the GPIO driver.
oC_MemorySize_t Size
Size of the region.
bool oC_MCS_SetMemoryAccessMode(oC_MCS_MemoryAccessMode_t Mode)
sets the memory access mode
void(* oC_FindNextStackHandler_t)(void)
stores pointer to function for searching next stack
Memory controller is configured to allow for memory access only for regions that can be accessible by...
void * oC_MCS_GetHardFaultReason(void)
returns address that cause a hard fault
int16_t oC_MCS_CriticalSectionCounter
global variable with critical section nesting counter
oC_Stack_t oC_MCS_GetSystemStack(void)
returns pointer to the system stack
bool oC_MCS_SetInterruptPriority(IRQn_Type InterruptNumber, oC_InterruptPriotity_t Priority)
sets interrupt priority
bool oC_MCS_ReturnToSystemStack(void)
sets next stack as system stack
static bool oC_MCS_IsCriticalSectionActive(void)
checks if critical section is active
void oC_MCS_Reboot(void)
Software reboots of machine.
oC_InterruptPriotity_t
stores priority of interrupts
void * oC_MCS_GetCurrentMainStackPointer(void)
returns current value of MSP
const void * BaseAddress
Base address of the region - this must point to the start of the region.
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
static bool oC_MCS_ChangeCriticalSectionCounter(int8_t ValueToAdd)
Increment or decrement counter for critical sections.
bool oC_MCS_EnableInterrupt(IRQn_Type InterruptNumber)
enables interrupt with specified number
void(* oC_ContextHandler_t)(void *ContextParameter)
stores handler of function, that handles context
uint32_t RegionNumber
Number of the region to configure.
oC_ErrorCode_t oC_MCS_ConfigureMemoryRegion(const oC_MCS_MemoryRegionConfig_t *Config)
configures memory region
#define oC_MACHINE_INTERRUPTS_LIST(ADD_INTERRUPT)
Definition of interrupts.
oC_Int_t oC_MCS_GetFreeStackSize(oC_Stack_t Stack)
returns number of free stack
bool oC_MCS_SetNextStack(oC_Stack_t Stack)
sets next stack for context switching
void oC_MCS_Delay(register oC_UInt_t Cycles)
delays operations for cycles
void(* oC_ContextExitHandler_t)(void)
stores handler of function called, when context handling is finished
bool Bufforable
True if the region should be bufforable - Bufferable means whether a write to the address can be buff...
Value for functions, that returns priority to provide error handling.
bool oC_MCS_IsInterruptEnabled(IRQn_Type InterruptNumber)
checks if interrupt is enabled
oC_Access_t UserAccess
Definition of access for user space.
oC_Access_t
Type for storing access (R/W/RW)
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
Memory controller is configured to allow for memory access for regions that can be accessible by a pr...
uint32_t oC_MCS_GetNumberOfRegions(void)
returns number of regions that are currently configured
bool oC_MCS_InitializeModule(void)
initializes module to work
IRQn_Type
type for the CMSIS library, that contains definitions of interrupts
static void oC_MCS_EnterCriticalSection(void)
Enters to critical section.
oC_MCS_MemoryAccessMode_t
stores memory access mode
oC_Stack_t oC_MCS_GetCurrentStack(void)
returns current stack
configuration structure for the memory region
oC_InterruptPriotity_t oC_MCS_GetInterruptPriority(IRQn_Type InterruptNumber)
returns interrupt priority
oC_Access_t PrivilegedAccess
Definition of access for privileged space (portable or core)
void oC_MCS_DisableInterrupts(void)
Globally disables interrupts (always)
bool oC_MCS_ReadFreeRegionNumber(uint32_t *outFreeRegionNumber)
reads number of a free region
static bool oC_MCS_ExitCriticalSection(void)
Exits from critical section.
void oC_MCS_EnableInterrupts(void)
Globally enables interrupts (always)
The lowest value for priority.
oC_MCS_MemoryAccessMode_t oC_MCS_GetMemoryAccessMode(void)
reads memory access mode
bool Shareable
For a shareable memory region that is implemented, the memory system provides data synchronization be...
oC_Power_t Power
Power state for the region (enabled or disabled)
oC_StackData_t * oC_Stack_t
type for storing stack reference
bool oC_MCS_DisableInterrupt(IRQn_Type InterruptNumber)
disables interrupt with specified number
oC_Power_t
stores registers power state
bool AlignSize
True if the MCS should find the size nearest to the value given as the Size field.
uint32_t oC_MCS_GetMaximumNumberOfRegions(void)
returns maximum number of regions handled by the machine
The most important interrupt priority, that is possible in the machine.