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

Flash Architecture Driver More...

#include "Std_Types.h"
#include "Fls_Cfg.h"
#include "Fls_Arch.h"

Functions

void Fls_Arch_Init (Fls_HwUnit *HwUnit, const Fls_ConfigType *ConfigPtr)
 FLS_Init Low Level Initialization
 
Std_ReturnType Fls_Arch_Erase (Fls_HwUnit *HwUnit, Fls_AddressType TargetAddress, Fls_LengthType Length)
 Fls_Erase Low Level Initialization
 
Std_ReturnType Fls_Arch_Write (Fls_HwUnit *HwUnit, Fls_AddressType TargetAddress, const uint8 *SourceAddressPtr, Fls_LengthType Length)
 Fls_Write Low Level Initialization
 
void Fls_Arch_Cancel (Fls_HwUnit *HwUnit)
 Fls_Cancel Low Level Initialization
 
MemIf_StatusType Fls_Arch_GetStatus (Fls_HwUnit *HwUnit)
 Fls_GetStatus Low Level Initialization
 
MemIf_JobResultType Fls_Arch_GetJobResult (Fls_HwUnit *HwUnit)
 Fls_GetJobResult Low Level Initialization
 
Std_ReturnType Fls_Arch_Read (Fls_HwUnit *HwUnit, Fls_AddressType SourceAddress, uint8 *TargetAddressPtr, Fls_LengthType Length)
 Fls_Read Low Level Initialization
 
Std_ReturnType Fls_Arch_Compare (Fls_HwUnit *HwUnit, Fls_AddressType SourceAddress, const uint8 *TargetAddressPtr, Fls_LengthType Length)
 Fls_Compare Low Level Initialization
 
void Fls_Arch_SetMode (Fls_HwUnit *HwUnit, MemIf_ModeType Mode)
 Fls_SetMode Low Level Initialization
 
Std_ReturnType Fls_Arch_BlankCheck (Fls_HwUnit *HwUnit, Fls_AddressType TargetAddress, Fls_LengthType Length)
 Fls_BlankCheck Low Level Initialization
 

Detailed Description

Flash Architecture Driver

Author
Christopher Bogarin

Mcu driver implementation for the STM32G0xx family of microcontrollers. This file contains the hardware specific implementation of the Mcu driver. The file is implemented as a means of abstraction from the hardware, this way we can avoid to include Arch headers in the actual driver header, making the low level interfaces available only for the inmediate upper layer.

Function Documentation

◆ Fls_Arch_BlankCheck()

Std_ReturnType Fls_Arch_BlankCheck ( Fls_HwUnit * HwUnit,
Fls_AddressType TargetAddress,
Fls_LengthType Length )

Fls_BlankCheck Low Level Initialization

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
HwUnitPointer to the hardware unit configuration.
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.

◆ Fls_Arch_Cancel()

void Fls_Arch_Cancel ( Fls_HwUnit * HwUnit)

Fls_Cancel Low Level Initialization

Cancels an ongoing job.

Parameters
HwUnitPointer to the hardware unit configuration.

◆ Fls_Arch_Compare()

Std_ReturnType Fls_Arch_Compare ( Fls_HwUnit * HwUnit,
Fls_AddressType SourceAddress,
const uint8 * TargetAddressPtr,
Fls_LengthType Length )

Fls_Compare Low Level Initialization

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

Parameters
HwUnitPointer to the hardware unit configuration.
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.

◆ Fls_Arch_Erase()

Std_ReturnType Fls_Arch_Erase ( Fls_HwUnit * HwUnit,
Fls_AddressType TargetAddress,
Fls_LengthType Length )

Fls_Erase Low Level Initialization

Erases flash sector(s).

Parameters
HwUnitPointer to the hardware unit configuration.
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.

◆ Fls_Arch_GetJobResult()

MemIf_JobResultType Fls_Arch_GetJobResult ( Fls_HwUnit * HwUnit)

Fls_GetJobResult Low Level Initialization

Returns the result of the last job.

Parameters
HwUnitPointer to the hardware unit configuration.
Return values
MemIf_JobResultType

< dummy element for the moment

◆ Fls_Arch_GetStatus()

MemIf_StatusType Fls_Arch_GetStatus ( Fls_HwUnit * HwUnit)

Fls_GetStatus Low Level Initialization

Returns the driver state.

Parameters
HwUnitPointer to the hardware unit configuration.
Return values
MemIf_StatusType

< dummy element for the moment

◆ Fls_Arch_Init()

void Fls_Arch_Init ( Fls_HwUnit * HwUnit,
const Fls_ConfigType * ConfigPtr )

FLS_Init Low Level Initialization

Initializes the Flash Driver.

Parameters
HwUnitPointer to the hardware unit configuration.
ConfigPtrPointer to flash driver configuration set.

◆ Fls_Arch_Read()

Std_ReturnType Fls_Arch_Read ( Fls_HwUnit * HwUnit,
Fls_AddressType SourceAddress,
uint8 * TargetAddressPtr,
Fls_LengthType Length )

Fls_Read Low Level Initialization

Reads from flash memory.

Parameters
HwUnitPointer to the hardware unit configuration.
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.

◆ Fls_Arch_SetMode()

void Fls_Arch_SetMode ( Fls_HwUnit * HwUnit,
MemIf_ModeType Mode )

Fls_SetMode Low Level Initialization

Sets the flash driver’s operation mode.

Parameters
HwUnitPointer to the hardware unit configuration.
ModeMEMIF_MODE_SLOW: Slow read access / normal SPI access. MEMIF_MODE_FAST: Fast read access / SPI burst access.

◆ Fls_Arch_Write()

Std_ReturnType Fls_Arch_Write ( Fls_HwUnit * HwUnit,
Fls_AddressType TargetAddress,
const uint8 * SourceAddressPtr,
Fls_LengthType Length )

Fls_Write Low Level Initialization

Writes one or more complete flash pages.

Parameters
HwUnitPointer to the hardware unit configuration.
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.