68 #define FRAM_DELAY_AFTER_WRITE_ENABLE_US (5u)
72 #define FRAM_WRITECOMMAND (0x02u)
73 #define FRAM_READCOMMAND (0x03u)
74 #define FRAM_WRITEENABLECOMMAND (0x06u)
78 #define FRAM_MAX_ADDRESS (0x3FFFFu)
91 uint32_t address = 0u;
131 if (crcRetVal ==
STD_OK) {
134 if (spiRetVal ==
STD_OK) {
151 write = (address & 0x3F0000u) >> 16u;
155 write = (address & 0xFF00u) >> 8u;
159 write = address & 0xFFu;
163 pWrite = (uint8_t *)(&crc);
165 write = (uint16_t)(*pWrite);
174 write = (uint16_t)(*pWrite);
204 if (spiRetVal ==
STD_OK) {
217 write = (address & 0x3F0000u) >> 16u;
221 write = (address & 0xFF00u) >> 8u;
225 write = address & 0xFFu;
229 uint64_t crcRead = 0u;
230 uint8_t *pRead = (uint8_t *)(&crcRead);
233 *pRead = (uint8_t)read;
243 *pRead = read & (uint8_t)UINT8_MAX;
255 uint64_t crcCalculated = 0u;
258 if (crcRetVal ==
STD_OK) {
259 if (crcRead != crcCalculated) {
STD_RETURN_TYPE_e CRC_CalculateCrc(uint64_t *pCrc, uint8_t *pData, uint32_t lengthInBytes)
Computes CRC of data flow.
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
@ DIAG_ID_FRAM_READ_CRC_ERROR
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
void FRAM_Initialize(void)
Initializes the addresses to be written in the FRAM.
#define FRAM_DELAY_AFTER_WRITE_ENABLE_US
STD_RETURN_TYPE_e FRAM_ReinitializeAllEntries(void)
Reinitialize all entries in the FRAM.
#define FRAM_WRITECOMMAND
FRAM_RETURN_TYPE_e FRAM_ReadData(FRAM_BLOCK_ID_e blockId)
Reads a variable from the FRAM.
FRAM_RETURN_TYPE_e FRAM_WriteData(FRAM_BLOCK_ID_e blockId)
Writes a variable to the FRAM.
#define FRAM_WRITEENABLECOMMAND
Header for the driver for the FRAM module.
FRAM_BASE_HEADER_s fram_base_header[]
#define FRAM_CRC_HEADER_SIZE
void IO_PinSet(volatile uint32_t *pRegisterAddress, uint32_t pin)
Set pin by writing in pin output register.
void IO_PinReset(volatile uint32_t *pRegisterAddress, uint32_t pin)
Reset pin by writing in pin output register.
Header for the driver for the IO module.
void MCU_Delay_us(uint32_t delay_us)
Wait blocking a certain time in microseconds.
Headers for the driver for the MCU module.
void SPI_FramTransmitReceiveData(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16 *pTxBuff, uint16 *pRxBuff, uint32 frameLength)
Transmits and receives data on SPI without DMA, wrappe for FRAM.
STD_RETURN_TYPE_e SPI_Lock(uint8_t spi)
Locks SPI interfaces.
void SPI_Unlock(uint8_t spi)
Unlocks SPI interfaces.
uint8_t SPI_GetSpiIndex(spiBASE_t *pNode)
Returns index of SPI node.
Headers for the driver for the SPI module.
SPI_INTERFACE_CONFIG_s spi_framInterface
@ SPI_CHIP_SELECT_SOFTWARE
SPI_CHIP_SELECT_TYPE_e csType
volatile uint32_t * pGioPort