38 #define _________________________________________LOCAL_VARIABLES_SECTION____________________________________________________________________ 42 static bool BusFaultInterruptEnabledFlag =
false;
43 static bool MemoryFaultInterruptEnabledFlag =
false;
47 #undef _________________________________________LOCAL_VARIABLES_SECTION____________________________________________________________________ 54 #define _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________ 68 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
73 BusFaultInterruptHandler =
NULL;
74 MemoryFaultInterruptHandler =
NULL;
75 BusFaultInterruptEnabledFlag =
false;
76 MemoryFaultInterruptEnabledFlag =
false;
81 errorCode = oC_ErrorCode_None;
85 errorCode = oC_ErrorCode_ModuleIsTurnedOn;
97 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
103 MemoryFaultInterruptEnabledFlag =
false;
104 BusFaultInterruptEnabledFlag =
false;
107 oC_AssignErrorCodeIfFalse(&errorCode ,
oC_MCS_DisableInterrupt(BusFault_IRQn) , oC_ErrorCode_CannotTurnOffInterruptInMachineModule) &&
108 oC_AssignErrorCodeIfFalse(&errorCode ,
oC_MCS_DisableInterrupt(MemoryManagement_IRQn) , oC_ErrorCode_CannotTurnOffInterruptInMachineModule)
111 errorCode = oC_ErrorCode_None;
117 errorCode = oC_ErrorCode_ModuleNotStartedYet;
394 return oC_MCS_MEMORY_ALIGNMENT;
405 return oC_LSF_IsRamAddress(Address);
416 return oC_LSF_IsExternalAddress(Address);
427 return oC_LSF_IsRomAddress(Address);
460 return oC_LSF_IsDmaAddress(Address);
471 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
477 oC_AssignErrorCodeIfFalse( &errorCode , MemoryFaultInterruptHandler ==
NULL , oC_ErrorCode_InterruptHandlerAlreadySet)
482 MemoryFaultInterruptHandler = Interrupt;
483 errorCode = oC_ErrorCode_None;
488 errorCode = oC_ErrorCode_WrongAddress;
503 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
509 oC_AssignErrorCodeIfFalse( &errorCode , BusFaultInterruptHandler ==
NULL , oC_ErrorCode_InterruptHandlerAlreadySet)
514 BusFaultInterruptHandler = Interrupt;
515 errorCode = oC_ErrorCode_None;
520 errorCode = oC_ErrorCode_WrongAddress;
534 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
538 oC_AssignErrorCodeIfFalse(&errorCode , MemoryFaultInterruptHandler !=
NULL , oC_ErrorCode_InterruptHandlerNotSet)
543 errorCode = oC_ErrorCode_None;
547 errorCode = oC_ErrorCode_CannotTurnOnInterruptInMachineModule;
562 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
566 errorCode = oC_ErrorCode_None;
570 errorCode = oC_ErrorCode_CannotTurnOnInterruptInMachineModule;
583 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
587 oC_AssignErrorCodeIfFalse(&errorCode , BusFaultInterruptHandler !=
NULL , oC_ErrorCode_InterruptHandlerNotSet)
592 errorCode = oC_ErrorCode_None;
596 errorCode = oC_ErrorCode_CannotTurnOnInterruptInMachineModule;
611 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
615 errorCode = oC_ErrorCode_None;
619 errorCode = oC_ErrorCode_CannotTurnOnInterruptInMachineModule;
633 bool interruptTurnedOn =
false;
635 if( MemoryFaultInterruptEnabledFlag )
640 return interruptTurnedOn;
651 bool interruptTurnedOn =
false;
653 if( BusFaultInterruptEnabledFlag )
658 return interruptTurnedOn;
669 oC_ErrorCode_t errorCode = oC_ErrorCode_ImplementError;
674 ErrorCondition( oC_LSF_IsCorrectAddress(Config) , oC_ErrorCode_WrongAddress)
693 && ErrorCondition( oC_LSF_IsRamAddress(Config) || oC_LSF_IsExternalAddress(Config) , oC_ErrorCode_OutputAddressNotInRAM )
698 errorCode = oC_ErrorCode_None;
728 #undef _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________ 736 #define _________________________________________INTERRUPTS_SECTION_________________________________________________________________________ 745 if(BusFaultInterruptHandler && BusFaultInterruptEnabledFlag)
747 BusFaultInterruptHandler();
758 if(MemoryFaultInterruptHandler && MemoryFaultInterruptEnabledFlag)
760 MemoryFaultInterruptHandler();
764 #undef _________________________________________INTERRUPTS_SECTION_________________________________________________________________________ #define oC_InterruptHandler(BASE_NAME, TYPE_NAME)
Define handler for interrupt.
static void * oC_LSF_GetHeapStart(void)
returns heap start address
static void * oC_LSF_GetDmaStart(void)
returns start address of DMA section
void * oC_MEM_LLD_GetFlashEndAddress(void)
returns end address of the flash
bool oC_MEM_LLD_SetMemoryAccessMode(oC_MEM_LLD_MemoryAccessMode_t Mode)
Change current memory access mode.
bool oC_MEM_LLD_IsMemoryFaultInterruptTurnedOn(void)
checks if memory fault interrupt is turned on
void * oC_MEM_LLD_GetStackEndAddress(void)
returns end address of the stack
bool oC_MEM_LLD_IsUsedFlashAddress(const void *Address)
checks if the pointer is in used flash section
bool Cacheable
True if the region should be cacheable - If you set a region to be cacheable: When you load from that...
static void * oC_LSF_GetRamEnd(void)
returns ram end address
oC_ErrorCode_t oC_MEM_LLD_TurnOffBusFaultInterrupt(void)
turns off bus fault interrupt
oC_MEM_LLD_Size_t oC_MEM_LLD_GetDataSize(void)
returns size of the data section
void * oC_MEM_LLD_GetDataEndAddress(void)
returns end address of the data section
oC_ErrorCode_t oC_MEM_LLD_SetBusFaultInterrupt(oC_MEM_LLD_Interrupt_t Interrupt)
sets interrupt handler for bus fault
oC_MemorySize_t Size
Size of the region.
bool oC_MCS_SetMemoryAccessMode(oC_MCS_MemoryAccessMode_t Mode)
sets the memory access mode
void * oC_MEM_LLD_GetFlashStartAddress(void)
returns start address of the flash
oC_ErrorCode_t oC_MEM_LLD_TurnOffDriver(void)
release the driver
stores configuration of the memory region
bool oC_MEM_LLD_IsExternalAddress(const void *Address)
checks if the pointer is in external section
void * oC_MEM_LLD_GetDmaRamStartAddress(void)
returns start address of the DMA RAM
static oC_UInt_t oC_LSF_GetDmaSize(void)
returns size of the section in linkage
const void * BaseAddress
Base address of the region - this must point to the start of the region.
static void * oC_LSF_GetRomEnd(void)
returns rom end address
The file with interface for LSF module.
static void * oC_LSF_GetTextStart(void)
returns text start address
oC_ErrorCode_t oC_MEM_LLD_ConfigureMemoryRegion(oC_MEM_LLD_MemoryRegionConfig_t *Config)
configures memory region
bool oC_MEM_LLD_IsFlashAddress(const void *Address)
checks if the pointer is in flash section
static oC_UInt_t oC_LSF_GetRomSize(void)
returns size of the section in linkage
oC_ErrorCode_t oC_MEM_LLD_TurnOnBusFaultInterrupt(void)
turns on bus fault interrupt
The file with LLD interface for the MEM driver.
void * oC_MEM_LLD_GetUsedFlashEndAddress(void)
returns used flash end address
const void * BaseAddress
Base address of the region - this must point to the start of the region.
oC_ErrorCode_t oC_MEM_LLD_TurnOnDriver(void)
initializes the driver to work
void * oC_MEM_LLD_GetHeapEndAddress(void)
returns end address of the heap
bool oC_MEM_LLD_IsBusFaultInterruptTurnedOn(void)
checks if bus fault interrupt is turned on
void * oC_MEM_LLD_GetBssEndAddress(void)
returns end address of the Bss section
oC_MEM_LLD_Size_t oC_MEM_LLD_GetUsedFlashSize(void)
returns size of the used flash section
static void * oC_LSF_GetTextEnd(void)
returns text end address
oC_MEM_LLD_Size_t oC_MEM_LLD_GetDmaRamSize(void)
returns size of the DMA ram
bool oC_MCS_EnableInterrupt(IRQn_Type InterruptNumber)
enables interrupt with specified number
static void * oC_LSF_GetRamStart(void)
returns ram start address
uint32_t RegionNumber
Number of the region to configure.
oC_Access_t UserAccess
Definition of access for user space.
oC_ErrorCode_t oC_MCS_ConfigureMemoryRegion(const oC_MCS_MemoryRegionConfig_t *Config)
configures memory region
bool Cachable
True if the region should be cacheable - If you set a region to be cacheable: When you load from that...
static void * oC_LSF_GetBssStart(void)
returns bss start address
The file with interface for the module library.
oC_Access_t PrivilegedAccess
Definition of access for privileged space (portable or core)
bool Bufforable
True if the region should be bufforable - Bufferable means whether a write to the address can be buff...
static oC_UInt_t oC_LSF_GetDataSize(void)
returns size of the section in linkage
static void * oC_LSF_GetDmaEnd(void)
returns end address of DMA section
static void * oC_LSF_GetDataStart(void)
returns data start address
bool oC_MEM_LLD_IsHeapAddress(const void *Address)
checks if the pointer is in heap section
bool oC_MCS_IsInterruptEnabled(IRQn_Type InterruptNumber)
checks if interrupt is enabled
oC_Access_t UserAccess
Definition of access for user space.
static void * oC_LSF_GetStackEnd(void)
returns stack end address
oC_MemorySize_t Size
Size of the region.
uint32_t RegionNumber
(optional) Number of the region to configure.
static oC_UInt_t oC_LSF_GetTextSize(void)
returns size of the section in linkage
oC_MEM_LLD_MemoryAccessMode_t
stores access memory mode
oC_MEM_LLD_Size_t oC_MEM_LLD_GetRamSize(void)
returns size of the ram
oC_MEM_LLD_Size_t oC_MEM_LLD_GetHeapSize(void)
returns size of the heap
static void oC_Module_TurnOn(oC_Module_t Module)
sets module as turned on
Contains machine core specific functions.
oC_MEM_LLD_Size_t oC_MEM_LLD_GetFlashSize(void)
returns size of the flash section
void * oC_MEM_LLD_GetRamEndAddress(void)
returns end address of the RAM
void * oC_MEM_LLD_GetUsedFlashStartAddress(void)
returns start address of the used flash section
static void oC_MCS_EnterCriticalSection(void)
Enters to critical section.
oC_UInt_t oC_MEM_LLD_Size_t
type for storing size of memory
void * oC_MEM_LLD_GetBssStartAddress(void)
returns start address of the Bss section
void * oC_MEM_LLD_GetHeapStartAddress(void)
returns start address of the heap
bool Bufforable
True if the region should be bufforable - Bufferable means whether a write to the address can be buff...
configuration structure for the memory region
oC_Access_t PrivilegedAccess
Definition of access for privileged space (portable or core)
The file with interface interrupt module.
bool FindFreeRegion
If true, the RegionNumber field is ignored and filled with the new value after configuration.
void * oC_MEM_LLD_GetStackStartAddress(void)
returns start address of the stack
bool oC_MCS_ReadFreeRegionNumber(uint32_t *outFreeRegionNumber)
reads number of a free region
oC_MEM_LLD_MemoryAccessMode_t oC_MEM_LLD_GetMemoryAccessMode(void)
returns currently configured memory access mode
static oC_UInt_t oC_LSF_GetBssSize(void)
returns size of the section in linkage
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.
oC_ErrorCode_t oC_MEM_LLD_SetMemoryFaultInterrupt(oC_MEM_LLD_Interrupt_t Interrupt)
sets interrupt handler for memory fault
static bool oC_Module_TurnOnVerification(oC_ErrorCode_t *outErrorCode, oC_Module_t Module)
verify if module is turned on
oC_MEM_LLD_Size_t oC_MEM_LLD_GetBssSize(void)
returns size of the Bss section
bool oC_MEM_LLD_IsDmaRamAddress(const void *Address)
checks if the pointer is in DMA RAM section
oC_MEM_LLD_Size_t oC_MEM_LLD_GetAlignmentSize(void)
returns size of alignment
oC_ErrorCode_t oC_MEM_LLD_TurnOffMemoryFaultInterrupt(void)
turns off memory fault interrupt
oC_ErrorCode_t oC_MEM_LLD_TurnOnMemoryFaultInterrupt(void)
turns on memory fault interrupt
void(* oC_MEM_LLD_Interrupt_t)(void)
type for storing memory interrupt pointers
void * oC_MEM_LLD_GetRamStartAddress(void)
returns start address of the RAM
void * oC_MEM_LLD_GetDmaRamEndAddress(void)
returns end address of the DMA RAM
oC_Power_t Power
Power state for the region (enabled or disabled)
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_MEM_LLD_Size_t oC_MEM_LLD_GetStackSize(void)
returns size of the stack
static void * oC_LSF_GetDataEnd(void)
returns data end address
oC_Power_t Power
Power state for the region (enabled or disabled)
static void * oC_LSF_GetRomStart(void)
returns rom start address
static void * oC_LSF_GetBssEnd(void)
returns bss end address
static void * oC_LSF_GetStackStart(void)
returns stack start address
static void * oC_LSF_GetHeapEnd(void)
returns heap end address
static oC_UInt_t oC_LSF_GetStackSize(void)
returns size of the section in linkage
bool oC_MCS_DisableInterrupt(IRQn_Type InterruptNumber)
disables interrupt with specified number
static oC_UInt_t oC_LSF_GetHeapSize(void)
returns size of the section in linkage
static oC_UInt_t oC_LSF_GetRamSize(void)
returns size of the section in linkage
bool AlignSize
True if the MCS should find the size nearest to the value given as the Size field.
bool oC_MEM_LLD_IsRamAddress(const void *Address)
checks if the pointer is in ram section
#define NULL
pointer to a zero
void * oC_MEM_LLD_GetDataStartAddress(void)
returns start address of the data section
static void oC_Module_TurnOff(oC_Module_t Module)
sets module as turned off