Memory Abstraction (MemIf) in AUTOSAR

Padmanabh
1
After reading this article you will understand
1. Functionalities of memory abstraction module of AUTOSAR.
2. How MemIf selects particular device i.e. FEE or EA.
3. Important APIs/Functions





1.  Introduction :

Memory abstraction interface (MemIf) module provides abstraction from underlying FEE or EA module and provides 32 bit linear address to NvM Module.  Below figure shows MeMIf module in AUTOSAR. MeMIf is present at hardware abstraction layer below NVRAM manager. 



Fig. 1 MeM Stack Architecture.


When request from NVRAM manager passes to MeMIf module, it will check for device index. The parameter DeviceIndex shall be used for selection of memory abstraction modules. What is device index ? Device index is a number assigned to each underlying devices. Using device index, MemIf selects particular device i.e. calls particular API from array of function pointers with respect to index.

e.g. if you have FEE and EA so, an index (e.g. 1) is assigned to FEE and another index (e.g. 2), based on device index MeMIf passes request to below module.

If only one device is present then DeviceIndex can be Ignored

Below lone of code shows,NVRAM manager calls MeMIf_Write and this write request is mapped to Fee_Write.

Case 1: If only one device is configured :
#define MemIf_Write(DeviceIndex, BlockNumber, DataPtr)  Fee_Write(BlockNumber, DataPtr)


Case 2: If more than one devices are configured.
#define MemIf_Write(DeviceIndex, BlockNumber, DataPtr)  \
             MemIf_WriteFctPtr[DeviceIndex](BlockNumber,DataPtr)

Below figure shows how call from NVM passes to MemIf module.


Fig.2 Call Stack




Functions / Important APIs : MemIf _Read and MemIf_Write 

SWC wants to write or read data from memory NvM_Read function is called and then NvM Module calls MemIf_Write  or MemIf_Read function and passes device ID. Based on Device ID MemIf selects undelying device e.g. FEE and passes call to FEE. You can read about FEE in AUTOSAR FEE blog.

To configure MemIf module important points to remember are :

It is very simple to configure MemIf module just remember two parameters

1. How many devices are present in system: MemIfNumberOfDevices
2. Device ID : DeviceIndex 


Post a Comment

1 Comments
Post a Comment
To Top