L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
flash_if.h File Reference

This file contains definitions for FLASH Interface functionalities. More...

#include "platform.h"
Include dependency graph for flash_if.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FLASH_IF_BUFFER_SIZE   0x00000800U

Enumerations

enum  FLASH_IF_StatusTypedef {
  FLASH_IF_PARAM_ERROR = -6 , FLASH_IF_LOCK_ERROR = -5 , FLASH_IF_WRITE_ERROR = -4 , FLASH_IF_READ_ERROR = -3 ,
  FLASH_IF_ERASE_ERROR = -2 , FLASH_IF_ERROR = -1 , FLASH_IF_OK = 0 , FLASH_IF_BUSY = 1
}
 Flash status. More...

Functions

FLASH_IF_StatusTypedef FLASH_IF_Init (void *pAllocRamBuffer)
 This function initializes the internal and external flash interface.
FLASH_IF_StatusTypedef FLASH_IF_DeInit (void)
 This function de-initializes the internal and external flash interface.
FLASH_IF_StatusTypedef FLASH_IF_Write (void *pDestination, const void *pSource, uint32_t uLength)
 This function writes a data buffer in internal or external flash.
FLASH_IF_StatusTypedef FLASH_IF_Read (void *pDestination, const void *pSource, uint32_t uLength)
 This function reads a amount of data from flash and copy into the output data buffer.
FLASH_IF_StatusTypedef FLASH_IF_Erase (void *pStart, uint32_t uLength)
 This function erases a amount of internal or external flash pages depending of the length.

Detailed Description

This file contains definitions for FLASH Interface functionalities.

Author
MCD Application Team
Attention

Copyright (c) 2026 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file flash_if.h.

Macro Definition Documentation

◆ FLASH_IF_BUFFER_SIZE

#define FLASH_IF_BUFFER_SIZE   0x00000800U

FLASH Page Size, 2 KBytes

Definition at line 57 of file flash_if.h.

Enumeration Type Documentation

◆ FLASH_IF_StatusTypedef

Flash status.

Enumerator
FLASH_IF_PARAM_ERROR 

Error Flash invalid parameter

FLASH_IF_LOCK_ERROR 

Error Flash not locked

FLASH_IF_WRITE_ERROR 

Error Flash write not possible

FLASH_IF_READ_ERROR 

Error Flash read not possible

FLASH_IF_ERASE_ERROR 

Error Flash erase not possible

FLASH_IF_ERROR 

Error Flash generic

FLASH_IF_OK 

Flash Success

FLASH_IF_BUSY 

Flash not available

Definition at line 40 of file flash_if.h.

Function Documentation

◆ FLASH_IF_DeInit()

FLASH_IF_StatusTypedef FLASH_IF_DeInit ( void )

This function de-initializes the internal and external flash interface.

Returns
FLASH_IF_StatusTypedef status

Definition at line 129 of file flash_if.c.

References FLASH_IF_OK, and pAllocatedBuffer.

◆ FLASH_IF_Erase()

FLASH_IF_StatusTypedef FLASH_IF_Erase ( void * pStart,
uint32_t uLength )

This function erases a amount of internal or external flash pages depending of the length.

Parameters
pStartpointer of flash address to erase
uLengthnumber of bytes to erase
Returns
FLASH_IF_StatusTypedef status

Definition at line 175 of file flash_if.c.

References FLASH_IF_ERROR, and FLASH_IF_INT_Erase().

Here is the call graph for this function:

◆ FLASH_IF_Init()

FLASH_IF_StatusTypedef FLASH_IF_Init ( void * pAllocRamBuffer)

This function initializes the internal and external flash interface.

Parameters
pAllocRamBufferpointer used to store a FLASH page in RAM when partial replacement is needed
Returns
FLASH_IF_StatusTypedef status

Definition at line 115 of file flash_if.c.

References FLASH_IF_OK, and pAllocatedBuffer.

◆ FLASH_IF_Read()

FLASH_IF_StatusTypedef FLASH_IF_Read ( void * pDestination,
const void * pSource,
uint32_t uLength )

This function reads a amount of data from flash and copy into the output data buffer.

Parameters
pDestinationpointer of target location to copy the flash sector
pSourcepointer of flash address to read
uLengthnumber of bytes to read
Returns
FLASH_IF_StatusTypedef status

Definition at line 159 of file flash_if.c.

References FLASH_IF_ERROR, and FLASH_IF_INT_Read().

Referenced by OnRestoreContextRequest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FLASH_IF_Write()

FLASH_IF_StatusTypedef FLASH_IF_Write ( void * pDestination,
const void * pSource,
uint32_t uLength )

This function writes a data buffer in internal or external flash.

Parameters
pDestinationpointer of flash address to write. It has to be 8 bytes aligned.
pSourcepointer on buffer with data to write
uLengthlength of data buffer in bytes. It has to be 8 bytes aligned.
Returns
FLASH_IF_StatusTypedef status

Definition at line 143 of file flash_if.c.

References FLASH_IF_ERROR, and FLASH_IF_INT_Write().

Referenced by OnStoreContextRequest().

Here is the call graph for this function:
Here is the caller graph for this function: