AUTOSAR SWS MemoryAbstractionInterface
AUTOSAR SWS MemoryAbstractionInterface
AUTOSAR SWS MemoryAbstractionInterface
AUTOSAR CP R22-11
Disclaimer
This work (specification and/or software implementation) and the material contained
in it, as released by AUTOSAR, is for the purpose of information only. AUTOSAR
and the companies that have contributed to it shall not be liable for any use of the
work.
The material contained in this work is protected by copyright and other types of
intellectual property rights. The commercial exploitation of the material contained in
this work requires a license to such intellectual property rights.
This work may be utilized or reproduced without any modification, in any form or by
any means, for informational purposes only. For any other purpose, no part of the
work may be utilized or reproduced, in any form or by any means, without permission
in writing from the publisher.
The work has been developed for automotive applications only. It has neither been
developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Table of Contents
MemServices
«module»
NvM
«use»
MemHwA
«module»
MemIf
«use» «use»
«module» «module»
Fee Ea
«use» «use»
MemAcc
«module»
MemAcc
«module» «module»
Mem_Fls Mem_Eep
«use» «use»
Hardware
«Peripheral» «Peripheral»
Flash Memory EEPROM
The Memory Abstraction Interface (MemIf) shall abstract from the number of
underlying FEE or EA modules and provide upper layers with a virtual segmentation
on a uniform linear address space.
Abbreviation / Description:
Acronym:
EA EEPROM Abstraction
EEPROM Electrically Erasable and Programmable ROM (Read Only Memory)
FEE Flash EEPROM Emulation
LSB Least significant bit / byte (depending on context). Here it’s bit.
Mem AUTOSAR Basic Software Module Memory Driver
MemAcc AUTOSAR Basic Software Module Memory Access
MemIf Memory Abstraction Interface
MSB Most significant bit / byte (depending on context). Here it’s bit.
NvM NVRAM Manager
NVRAM Non-volatile RAM (Random Access Memory)
Address area Contiguous memory area in the logical address space. Typically, multiple physical
memory sectors are combined to one logical address area.
Fast Mode E.g. during startup / shutdown the underlying driver may be switched into fast mode
in order to allow for fast reading / writing in those phases.
Note: Whether this is possible depends on the implementation of the driver and the
capabilities of the underlying device. Whether it is done depends on the
configuration of the NVRAM manager and thus on the needs of a specific project.
Slow Mode During normal operation the underlying driver may be used in slow mode in order to
reduce the resource usage in terms of runtime or blocking time of the underlying
device / communication media.
Note: Whether this is possible depends on the implementation of the driver and the
capabilities of the underlying device. Whether it is done depends on the
configuration of the NVRAM manager and thus on the needs of a specific project.
Vendor specific A vendor specific library is an ICC-2 implementation of the FEE/FLS and EA/EEP
library modules respectively. It provides the same upper layer interface (API) and
functionality as the corresponding ICC-3 implementation.
3 Related documentation
4.1 Limitations
No limitations.
No restrictions.
6 Requirements traceability
modules
SRS_BSW_00168 SW components shall be SWS_MemIf_NA_00999
tested by a function defined in
a common API in the Basis-
SW
SRS_BSW_00170 The AUTOSAR SW SWS_MemIf_NA_00999
Components shall provide
information about their
dependency from faults, signal
qualities, driver demands
SRS_BSW_00172 The scheduling strategy that is SWS_MemIf_NA_00999
built inside the Basic Software
Modules shall be compatible
with the strategy used in the
system
SRS_BSW_00300 All AUTOSAR Basic Software SWS_MemIf_NA_00999
Modules shall be identified by
an unambiguous name
SRS_BSW_00302 All AUTOSAR Basic Software SWS_MemIf_NA_00999
Modules shall only export
information needed by other
modules
SRS_BSW_00304 All AUTOSAR Basic Software SWS_MemIf_NA_00999
Modules shall use only
AUTOSAR data types instead
of native C data types
SRS_BSW_00306 AUTOSAR Basic Software SWS_MemIf_NA_00999
Modules shall be compiler and
platform independent
SRS_BSW_00307 Global variables naming SWS_MemIf_NA_00999
convention
SRS_BSW_00308 AUTOSAR Basic Software SWS_MemIf_NA_00999
Modules shall not define global
data in their header files, but in
the C file
SRS_BSW_00309 All AUTOSAR Basic Software SWS_MemIf_NA_00999
Modules shall indicate all
global data with read-only
purposes by explicitly
assigning the const keyword
SRS_BSW_00312 Shared code shall be reentrant SWS_MemIf_NA_00999
SRS_BSW_00314 All internal driver modules SWS_MemIf_NA_00999
shall separate the interrupt
frame definition from the
service routine
SRS_BSW_00321 The version numbers of SWS_MemIf_NA_00999
AUTOSAR Basic Software
Modules shall be enumerated
according specific rules
SRS_BSW_00323 All AUTOSAR Basic Software SWS_MemIf_00022
Modules shall check passed
API parameters for validity
7 Functional specification
The section 7.2 "Error Handling" of the document "General Specification of Basic
Software Modules" describes the error handling of the Basic Software in detail.
Above all, it constitutes a classification scheme consisting of five error types which
may occur in BSW modules.
Based on this foundation, the following section specifies particular errors arranged in
the respective subsections below.
[SWS_MemIf_00006]⌈
Type of error Related error code Error value
API service called with wrong device index parameter MEMIF_E_PARAM_DEVICE 0x01
8 API specification
In this chapter, all types included from the following modules are listed:
[SWS_MemIf_00037]⌈
Module Header File Imported Type
MemAcc_GeneralTypes.h MemAcc_AddressAreaIdType
MemAcc_GeneralTypes.h MemAcc_AddressType
MemAcc_GeneralTypes.h MemAcc_JobResultType
MemAcc_GeneralTypes.h MemAcc_LengthType
Std_Types.h Std_ReturnType
Std
Std_Types.h Std_VersionInfoType
⌋(SRS_BSW_00392)
8.2 Type definitions
[SWS_MemIf_00011] ⌈The data type for the memory device index shall be uint8. The
lowest value to be used for this device index shall be 0. The allowed range of indices
thus shall be 0..MEMIF_NUMBER_OF_DEVICES-1. ⌋ (SRS_MemHwAb_14020)
8.2.1 MemIf_StatusType
[SWS_MemIf_00064]⌈
Name MemIf_StatusType
Kind Enumeration
Description Denotes the current status of the underlying abstraction module and device drive.
Available
MemIf.h
via
⌋(SRS_BSW_00392)
8.2.2 MemIf_JobResultType
[SWS_MemIf_00065]{OBSOLETE} ⌈
Name MemIf_JobResultType (obsolete)
Kind Enumeration
MEMIF_JOB_
Range -- The job has been canceled.
CANCELED
Available
MemIf.h
via
⌋(SRS_BSW_00392)
8.3 Function definitions
[SWS_MemIf_00017] ⌈The API specified in this chapter shall be mapped to the API
of the underlying memory abstraction modules. For functional behavior refer to the
specification of those modules respectively to that of the underlying memory drivers. ⌋
(SRS_MemHwAb_14019, SRS_MemHwAb_14022)
Example:
#define MemIf_Write(DeviceIndex, BlockNumber, DataPtr) \
Fee_Write(BlockNumber, DataPtr)
Note: One solution is to use tables of pointers to functions where the parameter
DeviceIndex is used as array index.
Example:
#define MemIf_Write(DeviceIndex, BlockNumber, DataPtr) \
MemIf_WriteFctPtr[DeviceIndex](BlockNumber,DataPtr)
Note: The service IDs given in this interface specification are related to the service
IDs of the underlying memory abstraction module(s). For that reason, they may not
start with 0.
8.3.1 MemIf_Read
[SWS_MemIf_00039]⌈
Service
MemIf_Read
Name
Std_ReturnType MemIf_Read (
Syntax
uint16 DeviceIndex,
24 of 37 Document ID 285: AUTOSAR_SWS_MemoryAbstractionInterface
Specification of Memory Abstraction Interface
AUTOSAR CP R22-11
uint16 BlockNumber,
uint16 BlockOffset,
uint8* DataBufferPtr,
uint16 Length
)
Service ID
0x02
[hex]
Sync/Async Synchronous
Device
--
Index
Block
--
Parameters Number
(in)
Block
--
Offset
Length --
Parameters
None
(inout)
Parameters Data
--
(out) BufferPtr
Invokes the "Read" function of the underlying memory abstraction module selected
Description
by the parameter DeviceIndex.
⌋(SRS_MemHwAb_14029, SRS_MemHwAb_14022)
8.3.2 MemIf_Write
[SWS_MemIf_00040]⌈
Service
MemIf_Write
Name
Std_ReturnType MemIf_Write (
uint16 DeviceIndex,
Syntax uint16 BlockNumber,
const uint8* DataBufferPtr
)
Service ID
0x03
[hex]
Sync/Async Synchronous
Device
--
Index
Parameters Block
--
(in) Number
Data
--
BufferPtr
Parameters
None
(inout)
Parameters
None
(out)
Invokes the "Write" function of the underlying memory abstraction module selected
Description
by the parameter DeviceIndex.
⌋(SRS_MemHwAb_14010, SRS_MemHwAb_14022)
8.3.3 MemIf_Cancel
[SWS_MemIf_00041]⌈
Service Name MemIf_Cancel
void MemIf_Cancel (
Syntax uint16 DeviceIndex
)
Sync/Async Synchronous
Parameters
None
(inout)
Parameters
None
(out)
⌋(SRS_MemHwAb_14031, SRS_MemHwAb_14022)
8.3.4 MemIf_GetStatus
[SWS_MemIf_00042]⌈
Service Name MemIf_GetStatus
MemIf_StatusType MemIf_GetStatus (
Syntax uint16 DeviceIndex
)
Sync/Async Synchronous
Parameters
None
(inout)
Parameters
None
(out)
⌋(RS_BRF_02272, SRS_MemHwAb_14022)
[SWS_MemIf_00035] ⌈If the function MemIf_GetStatus is called with the device
index denoting a broadcast to all configured devices (MEMIF_BROADCAST_ID), the
Memory Abstraction Interface module shall call the “GetStatus” functions of all
underlying devices in turn. It shall return the value
MEMIF_IDLE – if all underlying devices have returned this state
MEMIF_UNINIT – if at least one device returned this state, all other returned
states shall be ignored
MEMIF_BUSY – if at least one configured device returned this state and no
other device returned MEMIF_UNINIT
MEMIF_BUSY_INTERNAL – if at least one configured device returned this
state and no other device returned MEMIF_BUSY or MEMIF_UNINIT ⌋
(SRS_MemHwAb_14020)
8.3.5 MemIf_GetJobResult
[SWS_MemIf_00043]⌈
27 of 37 Document ID 285: AUTOSAR_SWS_MemoryAbstractionInterface
Specification of Memory Abstraction Interface
AUTOSAR CP R22-11
Service
MemIf_GetJobResult
Name
MemIf_JobResultType MemIf_GetJobResult (
Syntax uint16 DeviceIndex
)
Service ID
0x06
[hex]
Sync/Async Synchronous
Parameters Device
--
(in) Index
Parameters
None
(inout)
Parameters
None
(out)
⌋(SRS_MemHwAb_14022)
8.3.6 MemIf_InvalidateBlock
[SWS_MemIf_00044]⌈
Service
MemIf_InvalidateBlock
Name
Std_ReturnType MemIf_InvalidateBlock (
uint16 DeviceIndex,
Syntax
uint16 BlockNumber
)
Service ID
0x07
[hex]
Sync/Async Synchronous
Device
--
Index
Parameters
(in)
Block
--
Number
Parameters None
28 of 37 Document ID 285: AUTOSAR_SWS_MemoryAbstractionInterface
Specification of Memory Abstraction Interface
AUTOSAR CP R22-11
(inout)
Parameters
None
(out)
⌋(SRS_MemHwAb_14028, SRS_MemHwAb_14022)
8.3.7 MemIf_GetVersionInfo
[SWS_MemIf_00045]⌈
Service Name MemIf_GetVersionInfo
void MemIf_GetVersionInfo (
Syntax Std_VersionInfoType* VersionInfoPtr
)
Sync/Async Synchronous
Reentrancy Reentrant
⌋(SRS_BSW_00407)
8.3.8 MemIf_EraseImmediateBlock
[SWS_MemIf_00046]⌈
Service
MemIf_EraseImmediateBlock
Name
Std_ReturnType MemIf_EraseImmediateBlock (
uint16 DeviceIndex,
Syntax uint16 BlockNumber
)
Service ID
0x09
[hex]
Sync/Async Synchronous
Device
--
Index
Parameters
(in)
Block
--
Number
Parameters
None
(inout)
Parameters
None
(out)
⌋(SRS_MemHwAb_14032, SRS_MemHwAb_14022)
8.4 Call-back notifications
None, the NVRAM manager shall provide the callback routines for the underlying
memory abstraction modules.
This chapter defines all interfaces which are required to fulfill the core functionality of
the module.
[SWS_MemIf_00047]⌈
Header
API Function Description
File
Immediate-
Block
Ea_Get-
Ea.h Service to return the Status.
Status
Ea_-
Invalidate- Ea.h Invalidates the block BlockNumber.
Block
Fee_Erase-
Immediate- Fee.h Service to erase a logical block.
Block
Fee_Get-
Fee.h Service to return the status.
Status
Fee_-
Invalidate- Fee.h Service to invalidate a logical block.
Block
Triggers a cancel operation of the pending job for the address area
MemAcc_- Mem
referenced by the addressAreaId. Cancelling affects only jobs in pending
Cancel Acc.h
state. For any other states, the request will be ignored.
MemAcc_- Mem Returns the consolidated job result of the address area referenced by
GetJobResult Acc.h addressAreaId.
Triggers a read job to copy data from the source address into the
referenced destination data buffer. The result of this service can be
retrieved using the MemAcc_GetJobResult API. If the read operation was
MemAcc_- Mem successful, the result of the job is MEMACC_MEM_OK. If the read
Read Acc.h operation failed, the result of the job is either MEMACC_MEM_FAILED in
case of a general error or MEMACC_MEM_ECC_CORRECTED/
MEMACC_MEM_ECC_UNCORRECTED in case of a correctable/
uncorrectable ECC error.
Triggers a write job to store the passed data to the provided address area
with given address and length. The result of this service can be retrieved
MemAcc_- Mem
using the MemAcc_GetJobResult API. If the write operation was
Write Acc.h
successful, the job result is MEMACC_MEM_OK. If there was an issue
writing the data, the result is MEMACC_MEM_FAILED.
⌋(SRS_BSW_00384)
8.6.2 Optional Interfaces
This chapter defines all interfaces which are required to fulfill an optional functionality
of the module.
[SWS_MemIf_00048]⌈
API Function Header File Description
⌋(SRS_BSW_00385)
8.6.3 Configurable interfaces
In this chapter all interfaces are listed where the target function could be configured.
The target function is usually a call-back function. The names of these kind of
interfaces is not fixed because they are configurable.
9 Sequence diagrams
Refer to the specifications of the memory abstraction modules.
10 Configuration specification
10.1.1 MemIf
Included Containers
MemIfNumberOfDevices: EcucIntegerParamDef
defaultValue = false
10.1.2 MemIfGeneral
Configuration Parameters
Multiplicity 1
Type EcucBooleanParamDef
Post-build time --
Multiplicity 1
Type EcucIntegerParamDef
Range 1 .. 2
Default value --
Pre-processor switch to enable / disable the API to read out the modules
Description version information.
true: Version info API enabled. false: Version info API disabled.
Multiplicity 1
Type EcucBooleanParamDef
Post-Build Variant
false
Value
No Included Containers