MCUSW
FLS Driver API

Introduction

The flash driver provides services for reading, writing and erasing flash memory.
The Flash Driver implements a standardized interface specified in the AUTOSAR_SWS_FlashDriver document.

Only the following combinations of modes are supported:

Following combinations of modes are not supported:

See also
FLS Configuration

Sub Modules

 FLS Configuration
 

Functions

void Fls_SwitchMode (boolean dacEnable, boolean xipEnable)
 Switch Mode of the OSPI Driver Parameters (in) : boolean dacEnable - should DAC mode be enaled or disabled Parameters (in) : boolean xipEnable - should XIP mode be enaled or disabled Mode : Supervisor Mode (Privileged Mode) More...
 
void Fls_Init (const Fls_ConfigType *ConfigPtr)
 Initializes the Flash Driver. More...
 
Std_ReturnType Fls_Erase (Fls_AddressType TargetAddress, Fls_LengthType Length)
 Erases flash sector(s). More...
 
Std_ReturnType Fls_Write (Fls_AddressType TargetAddress, const uint8 *SourceAddressPtr, Fls_LengthType Length)
 Writes one or more complete flash pages. More...
 
Std_ReturnType Fls_Read (Fls_AddressType SourceAddress, uint8 *TargetAddressPtr, Fls_LengthType Length)
 Reads from flash memory.. More...
 
Std_ReturnType Fls_Compare (Fls_AddressType SourceAddress, const uint8 *TargetAddressPtr, Fls_LengthType Length)
 Compares the contents of an area of flash memory with that of an application data buffer. More...
 
Std_ReturnType Fls_BlankCheck (Fls_AddressType Address, Fls_LengthType Length)
 The function Fls_BlankCheck shall verify, whether a given memory area has been erased but not (yet) programmed. More...
 
MemIf_StatusType Fls_GetStatus (void)
 Returns the driver state. More...
 
Std_ReturnType Fls_GetVersionInfo (Std_VersionInfoType *versioninfo)
 This service returns the version information of this module. More...
 
MemIf_JobResultType Fls_GetJobResult (void)
 Returns the result of the last job. More...
 
void Fls_MainFunction (void)
 Performs the processing of jobs. More...
 
void Fls_Cancel (void)
 Cancels an ongoing job. More...
 

Typedefs

typedef uint32 Fls_AddressType
 Type of address type. More...
 
typedef uint32 Fls_LengthType
 

FLS Driver ISR category level

Defines for FLS Driver ISR ISR category level

#define FLS_ISR_VOID   (0x00U)
 void ISR type More...
 
#define FLS_ISR_CAT1   (0x01U)
 Category 1 ISR type. More...
 
#define FLS_ISR_CAT2   (0x02U)
 Category 2 ISR type. More...
 

FLS Driver Module SW Version Info

Defines for FLS Driver version used for compatibility checks

#define FLS_SW_MAJOR_VERSION   (10U)
 Driver Implementation Major Version. More...
 
#define FLS_SW_MINOR_VERSION   (1U)
 Driver Implementation Minor Version. More...
 
#define FLS_SW_PATCH_VERSION   (0U)
 Driver Implementation Patch Version. More...
 

FLS Driver Module AUTOSAR Version Info

Defines for FLS Driver AUTOSAR version used for compatibility checks

#define FLS_AR_RELEASE_MAJOR_VERSION   (4U)
 AUTOSAR Major version specification implemented by FLS Driver. More...
 
#define FLS_AR_RELEASE_MINOR_VERSION   (3U)
 AUTOSAR Minor version specification implemented by FLS Driver. More...
 
#define FLS_AR_RELEASE_REVISION_VERSION   (1U)
 AUTOSAR Patch version specification implemented by FLS Driver. More...
 

FLS Driver ID Info

#define FLS_VENDOR_ID   ((uint16) 44U)
 Texas Instruments Vendor ID. More...
 
#define FLS_MODULE_ID   ((uint16) 92U)
 FLS Driver Module ID. More...
 
#define FLS_INSTANCE_ID   ((uint8) 0U)
 FLS Driver Instance ID. More...
 

FLS Error Codes

Error codes returned by FLS functions

#define FLS_E_PARAM_CONFIG   ((uint8) 0x01U)
 API service called with wrong parameter. More...
 
#define FLS_E_PARAM_ADDRESS   ((uint8) 0x02U)
 API service called with wrong parameter. More...
 
#define FLS_E_PARAM_LENGTH   ((uint8) 0x03U)
 API service called with wrong parameter. More...
 
#define FLS_E_PARAM_DATA   ((uint8) 0x04U)
 API service called with wrong parameter. More...
 
#define FLS_E_UNINIT   ((uint8) 0x05U)
 API service used without module initiali-zation. More...
 
#define FLS_E_BUSY   ((uint8) 0x06U)
 APIs called when module is busy. More...
 
#define FLS_E_PARAM_POINTER   ((uint8) 0x0AU)
 APIs called with a Null Pointer. More...
 
#define FLS_E_VERIFY_ERASE_FAILED   ((uint8) 0x07U)
 APIs service Erase Verification (BlankCheck) failed. More...
 
#define FLS_E_VERIFY_WRITE_FAILED   ((uint8) 0x08U)
 APIs serice Write Verification (Compare) failed. More...
 
#define FLS_E_TIMEOUT   ((uint8) 0x09U)
 APIs Timeout Exceeded. More...
 
#define FLS_E_ERASE_FAILED   ((uint8) 0x01U)
 Flash Erase Failed in HW. More...
 
#define FLS_E_WRITE_FAILED   ((uint8) 0x02U)
 Flash Write Failed in HW. More...
 
#define FLS_E_READ_FAILED   ((uint8) 0x03U)
 Flash Read Failed in HW. More...
 
#define FLS_E_COMPARE_FAILED   ((uint8) 0x04U)
 Flash Compare Failediin HW. More...
 
#define FLS_E_UNEXPECTED_FLASH_ID   ((uint8) 0x05U)
 Expected HW ID not matched. More...
 

FLS Service Ids

The Service Id is one of the argument to Det_ReportError function and is used to identify the source of the error

#define FLS_SID_INIT   ((uint8) 0x00U)
 FLS_Init() API Service ID. More...
 
#define FLS_SID_ERASE   ((uint8) 0x01U)
 FLS_Erase() API Service ID. More...
 
#define FLS_SID_WRITE   ((uint8) 0x02U)
 FLS_Write() API Service ID. More...
 
#define FLS_SID_CANCEL   ((uint8) 0x03U)
 FLS_Cancel() API Service ID. More...
 
#define FLS_SID_GET_STATUS   ((uint8) 0x04U)
 FLS_GetStatus() API Service ID. More...
 
#define FLS_SID_GET_JOB_RESULT   ((uint8) 0x05U)
 Fls_GetJobResult() API Service ID. More...
 
#define FLS_SID_READ   ((uint8) 0x07U)
 FLS_Read() API Service ID. More...
 
#define FLS_SID_COMPARE   ((uint8) 0x08U)
 FLS_Compare() API Service ID. More...
 
#define FLS_SID_SET_MODE   ((uint8) 0x09U)
 FLS_SetMode() API Service ID. More...
 
#define FLS_SID_GET_VERSION_INFO   ((uint8) 0x10U)
 Fls_GetVersionInfo() API Service ID. More...
 
#define FLS_SID_BLANK_CHECK   ((uint8) 0x0AU)
 FLS_BlankCheck() API Service ID. More...
 
#define FLS_SID_MAIN_FUNCTION   ((uint8) 0x06U)
 FLS_MainFunction() API Service ID. More...
 

Macro Definition Documentation

◆ FLS_ISR_VOID

#define FLS_ISR_VOID   (0x00U)

void ISR type

◆ FLS_ISR_CAT1

#define FLS_ISR_CAT1   (0x01U)

Category 1 ISR type.

◆ FLS_ISR_CAT2

#define FLS_ISR_CAT2   (0x02U)

Category 2 ISR type.

◆ FLS_SW_MAJOR_VERSION

#define FLS_SW_MAJOR_VERSION   (10U)

Driver Implementation Major Version.

◆ FLS_SW_MINOR_VERSION

#define FLS_SW_MINOR_VERSION   (1U)

Driver Implementation Minor Version.

◆ FLS_SW_PATCH_VERSION

#define FLS_SW_PATCH_VERSION   (0U)

Driver Implementation Patch Version.

◆ FLS_AR_RELEASE_MAJOR_VERSION

#define FLS_AR_RELEASE_MAJOR_VERSION   (4U)

AUTOSAR Major version specification implemented by FLS Driver.

◆ FLS_AR_RELEASE_MINOR_VERSION

#define FLS_AR_RELEASE_MINOR_VERSION   (3U)

AUTOSAR Minor version specification implemented by FLS Driver.

◆ FLS_AR_RELEASE_REVISION_VERSION

#define FLS_AR_RELEASE_REVISION_VERSION   (1U)

AUTOSAR Patch version specification implemented by FLS Driver.

◆ FLS_VENDOR_ID

#define FLS_VENDOR_ID   ((uint16) 44U)

Texas Instruments Vendor ID.

◆ FLS_MODULE_ID

#define FLS_MODULE_ID   ((uint16) 92U)

FLS Driver Module ID.

◆ FLS_INSTANCE_ID

#define FLS_INSTANCE_ID   ((uint8) 0U)

FLS Driver Instance ID.

◆ FLS_E_PARAM_CONFIG

#define FLS_E_PARAM_CONFIG   ((uint8) 0x01U)

API service called with wrong parameter.

◆ FLS_E_PARAM_ADDRESS

#define FLS_E_PARAM_ADDRESS   ((uint8) 0x02U)

API service called with wrong parameter.

◆ FLS_E_PARAM_LENGTH

#define FLS_E_PARAM_LENGTH   ((uint8) 0x03U)

API service called with wrong parameter.

◆ FLS_E_PARAM_DATA

#define FLS_E_PARAM_DATA   ((uint8) 0x04U)

API service called with wrong parameter.

◆ FLS_E_UNINIT

#define FLS_E_UNINIT   ((uint8) 0x05U)

API service used without module initiali-zation.

◆ FLS_E_BUSY

#define FLS_E_BUSY   ((uint8) 0x06U)

APIs called when module is busy.

◆ FLS_E_PARAM_POINTER

#define FLS_E_PARAM_POINTER   ((uint8) 0x0AU)

APIs called with a Null Pointer.

◆ FLS_E_VERIFY_ERASE_FAILED

#define FLS_E_VERIFY_ERASE_FAILED   ((uint8) 0x07U)

APIs service Erase Verification (BlankCheck) failed.

◆ FLS_E_VERIFY_WRITE_FAILED

#define FLS_E_VERIFY_WRITE_FAILED   ((uint8) 0x08U)

APIs serice Write Verification (Compare) failed.

◆ FLS_E_TIMEOUT

#define FLS_E_TIMEOUT   ((uint8) 0x09U)

APIs Timeout Exceeded.

◆ FLS_E_ERASE_FAILED

#define FLS_E_ERASE_FAILED   ((uint8) 0x01U)

Flash Erase Failed in HW.

◆ FLS_E_WRITE_FAILED

#define FLS_E_WRITE_FAILED   ((uint8) 0x02U)

Flash Write Failed in HW.

◆ FLS_E_READ_FAILED

#define FLS_E_READ_FAILED   ((uint8) 0x03U)

Flash Read Failed in HW.

◆ FLS_E_COMPARE_FAILED

#define FLS_E_COMPARE_FAILED   ((uint8) 0x04U)

Flash Compare Failediin HW.

◆ FLS_E_UNEXPECTED_FLASH_ID

#define FLS_E_UNEXPECTED_FLASH_ID   ((uint8) 0x05U)

Expected HW ID not matched.

◆ FLS_SID_INIT

#define FLS_SID_INIT   ((uint8) 0x00U)

FLS_Init() API Service ID.

◆ FLS_SID_ERASE

#define FLS_SID_ERASE   ((uint8) 0x01U)

FLS_Erase() API Service ID.

◆ FLS_SID_WRITE

#define FLS_SID_WRITE   ((uint8) 0x02U)

FLS_Write() API Service ID.

◆ FLS_SID_CANCEL

#define FLS_SID_CANCEL   ((uint8) 0x03U)

FLS_Cancel() API Service ID.

◆ FLS_SID_GET_STATUS

#define FLS_SID_GET_STATUS   ((uint8) 0x04U)

FLS_GetStatus() API Service ID.

◆ FLS_SID_GET_JOB_RESULT

#define FLS_SID_GET_JOB_RESULT   ((uint8) 0x05U)

Fls_GetJobResult() API Service ID.

◆ FLS_SID_READ

#define FLS_SID_READ   ((uint8) 0x07U)

FLS_Read() API Service ID.

◆ FLS_SID_COMPARE

#define FLS_SID_COMPARE   ((uint8) 0x08U)

FLS_Compare() API Service ID.

◆ FLS_SID_SET_MODE

#define FLS_SID_SET_MODE   ((uint8) 0x09U)

FLS_SetMode() API Service ID.

◆ FLS_SID_GET_VERSION_INFO

#define FLS_SID_GET_VERSION_INFO   ((uint8) 0x10U)

Fls_GetVersionInfo() API Service ID.

◆ FLS_SID_BLANK_CHECK

#define FLS_SID_BLANK_CHECK   ((uint8) 0x0AU)

FLS_BlankCheck() API Service ID.

◆ FLS_SID_MAIN_FUNCTION

#define FLS_SID_MAIN_FUNCTION   ((uint8) 0x06U)

FLS_MainFunction() API Service ID.

Typedef Documentation

◆ Fls_AddressType

typedef uint32 Fls_AddressType

Type of address type.

◆ Fls_LengthType

typedef uint32 Fls_LengthType

Function Documentation

◆ Fls_SwitchMode()

void Fls_SwitchMode ( boolean  dacEnable,
boolean  xipEnable 
)

Switch Mode of the OSPI Driver Parameters (in) : boolean dacEnable - should DAC mode be enaled or disabled Parameters (in) : boolean xipEnable - should XIP mode be enaled or disabled Mode : Supervisor Mode (Privileged Mode)

◆ Fls_Init()

void Fls_Init ( const Fls_ConfigType ConfigPtr)

Initializes the Flash Driver.

*  Service name        : Fls_Init
*  Syntax              : void Fls_Init( const Fls_ConfigType* ConfigPtr )
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x00
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : ConfigPtr - Pointer to flash driver configuration set
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Initializes the Flash Driver
*  

◆ Fls_Erase()

Std_ReturnType Fls_Erase ( Fls_AddressType  TargetAddress,
Fls_LengthType  Length 
)

Erases flash sector(s).

*  Service name        : Fls_Erase
*  Syntax              : Std_ReturnType Fls_Erase(Fls_AddressType TargetAddress
*                        ,Fls_LengthType Length)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x01
*  Sync/Async          : Asynchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : TargetAddress - Target address in flash memory.
*                        This address offset will be added to the flash memory
*                        base address.
*                        Length - Number of bytes to erase
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType -
*                        E_OK: erase command has been accepted
*                        E_NOT_OK: erase command has not been accepted
*  Description         : Erases flash sector(s).
*  

◆ Fls_Write()

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

Writes one or more complete flash pages.

*  Service name        : Fls_Write
*  Syntax              : Std_ReturnType Fls_Write(Fls_AddressType TargetAddress
*                        ,const uint8* SourceAddressPtr,
*                        Fls_LengthType Length)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x02
*  Sync/Async          : Asynchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : TargetAddress - Target address in flash memory.
*                        This address offset will be added to the flash memory
*                        base address.
*                        SourceAddressPtr - Pointer to source data buffer
*                        Length - Number of bytes to erase
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType -
*                        E_OK: write command has been accepted
*                        E_NOT_OK: write command has not been accepted
*  Description         : Writes one or more complete flash pages.
*  

◆ Fls_Read()

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

Reads from flash memory..

*  Service name        : Fls_Read
*  Syntax              : Std_ReturnType Fls_Read((Fls_AddressType SourceAddress
*                        ,const uint8* TargetAddressPtr,
*                        Fls_LengthType Length)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x07
*  Sync/Async          : Asynchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : SourceAddress - source address in flash memory.
*                        This address offset will be added to the flash memory
*                        base address.
*                        TargetAddressPtr - Pointer to source data buffer
*                        Length - Number of bytes to erase
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType -
*                        E_OK: read command has been accepted
*                        E_NOT_OK: read command has not been accepted
*  Description         : Reads from flash memory.
*  

◆ Fls_Compare()

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

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

*  Service name        : Fls_Compare
*  Syntax              : Std_ReturnType Fls_Compare
*                        (Fls_AddressType SourceAddress,
*                        const uint8* TargetAddressPtr,
*                        Fls_LengthType Length)
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x08
*  Sync/Async          : Asynchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : SourceAddress - Target address in flash memory.
*                        This address offset will be added to the flash memory
*                        base address.
*                        TargetAddressPtr - Pointer to source data buffer
*                        Length - Number of bytes to erase
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType -
*                        E_OK: compare command has been accepted
*                        E_NOT_OK: compare command has not been accepted
*  Description         : Compares the contents of an area of flash memory
*                        with that of an application data buffer.
*  

◆ Fls_BlankCheck()

Std_ReturnType Fls_BlankCheck ( Fls_AddressType  Address,
Fls_LengthType  Length 
)

The function Fls_BlankCheck shall verify, whether a given memory area has been erased but not (yet) programmed.

*  Service name        : Fls_BlankCheck
*  Syntax              : Std_ReturnType Fls_Compare
*                        (Fls_AddressType TargetAddress,,
*                        Fls_LengthType Length)
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x0a
*  Sync/Async          : Asynchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : TargetAddress - Target address in flash memory.
*                        This address offset will be added to the flash memory
*                        base address.
*                        SourceAddressPtr - Pointer to source data buffer
*                        Length - Number of bytes to erase
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Std_ReturnType -
*                        E_OK: BlankCheck command has been accepted
*                        E_NOT_OK: BlankCheck command has not been accepted
*  Description         : The function Fls_BlankCheck shall verify,
*                        whether a given memory area has been
*                        erased but not (yet) programmed.
*  

◆ Fls_GetStatus()

MemIf_StatusType Fls_GetStatus ( void  )

Returns the driver state.

*  Service name        : Fls_GetStatus
*  Syntax              : MemIf_StatusType Fls_GetStatus( void )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x04
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : MemIf_StatusType
*  Description         : Returns the driver state.
*  

◆ Fls_GetVersionInfo()

Std_ReturnType Fls_GetVersionInfo ( Std_VersionInfoType *  versioninfo)

This service returns the version information of this module.

*  Service name        : Fls_GetVersionInfo
*  Syntax              : void Fls_GetVersionInfo( Std_VersionInfoType*
*                                                                 versioninfo )
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x10
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : versioninfo - Pointer to where to store the version
*                        information of this module
*  Parameters (out)    : None
*  Return value        : None
*  Description         : This service returns the version information of this
*                        module
*  

◆ Fls_GetJobResult()

MemIf_JobResultType Fls_GetJobResult ( void  )

Returns the result of the last job.

*  Service name        : Fls_GetJobResult
*  Syntax              : MemIf_JobResultType Fls_GetJobResult(void)
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x05
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : MemIf_JobResultType
*  Description         : Returns the result of the last job.
*  

◆ Fls_MainFunction()

void Fls_MainFunction ( void  )

Performs the processing of jobs.

*  Service name        : Fls_MainFunction
*  Syntax              : void Fls_MainFunction(void)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x06
*  Description         : Performs the processing of jobs.
*  

◆ Fls_Cancel()

void Fls_Cancel ( void  )

Cancels an ongoing job.

*  Service name        : Fls_Cancel
*  Syntax              : void Fls_Cancel(void)
*  Mode                : User Mode (Non-Privileged Mode)
*  Service ID[hex]     : 0x03
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : None
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Cancels an ongoing job.
*