STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
Loading...
Searching...
No Matches
Fls.c File Reference

Flash Driver More...

#include "Std_Types.h"
#include "Fls.h"
#include "Fls_Arch.h"

Macros

#define Det_ReportError(ModuleId, InstanceId, ApiId, ErrorId)
 

Functions

void Fls_Init (const Fls_ConfigType *ConfigPtr)
 Fls_Init
 
Std_ReturnType Fls_Erase (Fls_AddressType TargetAddress, Fls_LengthType Length)
 Fls_Erase
 
Std_ReturnType Fls_Write (Fls_AddressType TargetAddress, const uint8 *SourceAddressPtr, Fls_LengthType Length)
 Fls_Write
 
void Fls_Cancel (void)
 Fls_Cancel
 
MemIf_StatusType Fls_GetStatus (void)
 Fls_GetStatus
 
MemIf_JobResultType Fls_GetJobResult (void)
 Fls_GetJobResult
 
Std_ReturnType Fls_Read (Fls_AddressType SourceAddress, uint8 *TargetAddressPtr, Fls_LengthType Length)
 Fls_Read
 
Std_ReturnType Fls_Compare (Fls_AddressType SourceAddress, const uint8 *TargetAddressPtr, Fls_LengthType Length)
 Fls_Compare
 
void Fls_SetMode (MemIf_ModeType Mode)
 Fls_SetMode
 
void Fls_GetVersionInfo (Std_VersionInfoType *VersioninfoPtr)
 Fls_GetVersionInfo
 
Std_ReturnType Fls_BlankCheck (Fls_AddressType TargetAddress, Fls_LengthType Length)
 Fls_BlankCheck
 

Variables

static Fls_HwUnit HwUnit_Fls
 Variable for the initial value of the port configuration array.
 

Detailed Description

Flash Driver

Author
Christopher Bogarin

The flash driver provides services for reading, writing and erasing flash memory and a configuration interface for setting / resetting the write / erase protection if supported by the underlying hardware. In application mode of the ECU, the flash driver is only to be used by the Flash EEPROM emulation module for writing data. It is not intended to write program code to flash memory in application mode.

Macro Definition Documentation

◆ Det_ReportError

#define Det_ReportError ( ModuleId,
InstanceId,
ApiId,
ErrorId )
Value:
(void)0
Parameters
ModuleIdModule ID number
InstanceIdInstance Id
ApiIdApi id
ErrorIdError code

Function Documentation

◆ Fls_BlankCheck()

Std_ReturnType Fls_BlankCheck ( Fls_AddressType TargetAddress,
Fls_LengthType Length )

Fls_BlankCheck

The function Fls_BlankCheck shall verify, whether a given memory area has been erased but not (yet) programmed. The function shall limit the maximum number of checked flash cells per main function cycle to the configured value FlsMaxReadNormalMode or FlsMaxReadFastMode respectively.

Parameters
TargetAddressAddress in flash memory from which the blank check should be started. Min.: 0 Max.: FLS_SIZE - 1.
LengthNumber of bytes to be checked for erase pattern. Min.: 1 Max.: FLS_SIZE - TargetAddress.
Return values
Std_ReturnTypeE_OK: request for blank checking has been accepted by the module E_NOT_OK: request for blank checking has not been accepted by the module.
Requirement
SWS_Fls_00371, SWS_Fls_00380, SWS_Fls_00381, SWS_Fls_00382

◆ Fls_Cancel()

void Fls_Cancel ( void )

Fls_Cancel

Cancels an ongoing job.

Requirement
SWS_Fls_00252, SWS_Fls_00183, SWS_Fls_00356

◆ Fls_Compare()

Std_ReturnType Fls_Compare ( Fls_AddressType SourceAddress,
const uint8 * TargetAddressPtr,
Fls_LengthType Length )

Fls_Compare

Compares the contents of an area of flash memory with that of an application data buffer.

Parameters
SourceAddressSource address in flash memory. This address offset will be added to the flash memory base address. Min.: 0 Max.: FLS_ SIZE - 1.
TargetAddressPtrPointer to target data buffer.
LengthNumber of bytes to compare Min.: 1 Max.: FLS_SIZE - Source Address.
Return values
Std_ReturnTypeE_OK: read command has been accepted E_NOT_OK: read command has not been accepted.
Requirement
SWS_Fls_00257, SWS_Fls_00150, SWS_Fls_00151, SWS_Fls_00152, SWS_Fls_00273, SWS_Fls_00186

◆ Fls_Erase()

Std_ReturnType Fls_Erase ( Fls_AddressType TargetAddress,
Fls_LengthType Length )

Fls_Erase

Erases flash sector(s).

Parameters
TargetAddressTarget address in flash memory. This address offset will be added to the flash memory base address. Min.: 0 Max.: FLS_SIZE - 1.
LengthNumber of bytes to erase Min.: 1 Max.: FLS_SIZE - Target Address.
Return values
Std_ReturnTypeE_OK: erase command has been accepted E_NOT_OK: erase command has not been accepted.
Requirement
SWS_Fls_00250, SWS_Fls_00020, SWS_Fls_00021, SWS_Fls_00065

◆ Fls_GetJobResult()

MemIf_JobResultType Fls_GetJobResult ( void )

Fls_GetJobResult

Returns the result of the last job.

Return values
MemIf_JobResultType
Requirement
SWS_Fls_00254, SWS_Fls_00185, SWS_Fls_00358

◆ Fls_GetStatus()

MemIf_StatusType Fls_GetStatus ( void )

Fls_GetStatus

Returns the driver state.

Return values
MemIf_StatusType
Requirement
SWS_Fls_00253, SWS_Fls_00184

◆ Fls_GetVersionInfo()

void Fls_GetVersionInfo ( Std_VersionInfoType * VersioninfoPtr)

Fls_GetVersionInfo

Returns the version information of this module.

Parameters
VersioninfoPtrPointer to where to store the version information of this module.
Requirement
SWS_Fls_00259, SWS_Fls_00363

◆ Fls_Init()

void Fls_Init ( const Fls_ConfigType * ConfigPtr)

Fls_Init

Initializes the Flash Driver.

Parameters
ConfigPtrPointer to flash driver configuration set.
Requirement
SWS_Fls_00249, SWS_Fls_00015, SWS_Fls_00323

◆ Fls_Read()

Std_ReturnType Fls_Read ( Fls_AddressType SourceAddress,
uint8 * TargetAddressPtr,
Fls_LengthType Length )

Fls_Read

Reads from flash memory.

Parameters
SourceAddressSource address in flash memory. This address offset will be added to the flash memory base address. Min.: 0 Max.: FLS_ SIZE - 1.
LengthNumber of bytes to read Min.: 1 Max.: FLS_SIZE - Source Address.
TargetAddressPtrPointer to target data buffer.
Return values
Std_ReturnTypeE_OK: read command has been accepted E_NOT_OK: read command has not been accepted.
Requirement
SWS_Fls_00256, SWS_Fls_00097, SWS_Fls_00098, SWS_Fls_00099, SWS_Fls_00158

◆ Fls_SetMode()

void Fls_SetMode ( MemIf_ModeType Mode)

Fls_SetMode

Sets the flash driver’s operation mode.

Parameters
ModeMEMIF_MODE_SLOW: Slow read access / normal SPI access. MEMIF_MODE_FAST: Fast read access / SPI burst access.
Requirement
SWS_Fls_00258, SWS_Fls_00187, SWS_Fls_00156

◆ Fls_Write()

Std_ReturnType Fls_Write ( Fls_AddressType TargetAddress,
const uint8 * SourceAddressPtr,
Fls_LengthType Length )

Fls_Write

Writes one or more complete flash pages.

Parameters
TargetAddressTarget address in flash memory. This address offset will be added to the flash memory base address. Min.: 0 Max.: FLS_SIZE - 1.
SourceAddressPtrPointer to source data buffer.
LengthNumber of bytes to write Min.: 1 Max.: FLS_SIZE - TargetAddress.
Return values
Std_ReturnTypeE_OK: write command has been accepted E_NOT_OK: write command has not been accepted.
Requirement
SWS_Fls_00251, SWS_Fls_00026, SWS_Fls_00027, SWS_Fls_00066, SWS_Fls_00157

Variable Documentation

◆ HwUnit_Fls

Fls_HwUnit HwUnit_Fls
static
Initial value:
=
{
.HwUnitState = MEMIF_UNINIT,
.Config = NULL_PTR,
}
@ MEMIF_UNINIT
Definition MemIf.h:30
#define NULL_PTR
null pointer definition
Definition Std_Types.h:165

Variable for the initial value of the port configuration array.