AUTOSAR Classic Memory Services
Die Memory Services verwalten nicht-flüchtige Datenblöcke (NvM), abstrahieren Flash- und EEPROM-Technologien (MemIf, Fee, Ea) und gewährleisten Datenkonsistenz und Datensicherheit über ECU-Abschaltzyklen hinweg.
初始化与状态
BndM_InitEa_GetStatusEa_GetVersionInfoEa_InitEep_GetStatusEep_GetVersionInfoEep_InitFee_GetStatusFee_GetVersionInfoFee_InitFls_GetStatusFls_GetVersionInfoFls_InitFlsTst_DeInitFlsTst_GetVersionInfoFlsTst_InitMem_DeInitMem_GetVersionInfoMem_InitMemAcc_DeInitMemAcc_GetVersionInfoMemAcc_InitMemIf_GetStatusMemIf_GetVersionInfoNvM_GetVersionInfoNvM_InitRamTst_DeInitRamTst_GetVersionInfoRamTst_Init服务 · Job…
服务 · Get…
服务 · Write…
服务 · Read…
服务 · Set…
服务 · Test…
服务 · Cancel…
服务 · Erase…
服务 · Invalidate…
服务 · Blank…
服务 · Compare…
服务 · Resume…
服务 · Suspend…
服务 · 其他
FlsTst_AbortFlsTst_StartFgndMem_HwSpecificServiceMem_PropagateErrorMemAcc_ActivateMemMemAcc_DeactivateMemMemAcc_HwSpecificServiceMemAcc_ReleaseLockMemAcc_RequestLockNvM_FirstInitAllNvM_InitBlockCallbackFunctionNvM_MultiBlockCallbackFunctionNvM_RestoreBlockDefaultsNvM_RestorePRAMBlockDefaultsNvM_SingleBlockCallbackFunctionNvM_ValidateAllRamTst_AllowRamTst_ChangeNumberOfTestedCellsRamTst_ErrorNotificationRamTst_RunFullTestRamTst_RunPartialTestRamTst_SelectAlgParamsRamTst_StopTst_AlgorithmTypeRamTst_GetTestAlgorithmTst_AlgParamsIdTypeRamTst_GetAlgParamsTst_ErrorDetailsTypeFlsTst_GetErrorDetailsTst_ExecutionStatusTypeRamTst_GetExecutionStatusTst_NumberOfTestedCellsTypeRamTst_GetNumberOfTestedCellsTst_StateTypeFlsTst_GetCurrentStateCallout 与预期接口
<AddressAreaJobEndNotification><ApplicationLockNotification>周期性
BndM_MainFunctionEa_MainFunctionEep_MainFunctionFee_MainFunctionFls_MainFunctionFlsTst_MainFunctionMem_MainFunctionMemAcc_MainFunctionNvM_MainFunctionRamTst_MainFunction类型
BndM_BlockIdTypeBndM_Block{BlockId.Shortname}TypeBndM_ConfigTypeBndM_ResultTypeEa_ConfigTypeEep_AddressTypeEep_ConfigTypeEep_LengthTypeFee_ConfigTypeFls_AddressTypeFls_ConfigTypeFls_LengthTypeFlsTst_BlockIdFgndTypeFlsTst_ConfigTypeFlsTst_ErrorDetailsTypeFlsTst_StateTypeFlsTst_TestResultBgndTypeFlsTst_TestResultFgndTypeFlsTst_TestResultTypeFlsTst_TestSignatureBgndTypeFlsTst_TestSignatureFgndTypeMem_AddressTypeMem_ConfigTypeMem_DataTypeMem_HwServiceIdTypeMem_InstanceIdTypeMem_JobResultTypeMem_LengthTypeMemAcc_AddressAreaIdTypeMemAcc_AddressTypeMemAcc_ApplicationLockNotificationTypeMemAcc_ConfigTypeMemAcc_DataTypeMemAcc_HwIdTypeMemAcc_JobInfoTypeMemAcc_JobResultTypeMemAcc_JobStatusTypeMemAcc_JobTypeMemAcc_LengthTypeMemAcc_MemAddressTypeMemAcc_MemBinaryHeaderTypeMemAcc_MemBlankCheckFuncTypeMemAcc_MemConfigTypeMemAcc_MemDataTypeMemAcc_MemDeInitFuncTypeMemAcc_MemEraseFuncTypeMemAcc_MemGetJobResultFuncTypeMemAcc_MemHwServiceIdTypeMemAcc_MemHwSpecificServiceFuncTypeMemAcc_MemInitFuncTypeMemAcc_MemInstanceIdTypeMemAcc_MemJobResultTypeMemAcc_MemLengthTypeMemAcc_MemMainFuncTypeMemAcc_MemoryInfoTypeMemAcc_MemPropagateErrorFuncTypeMemAcc_MemReadFuncTypeMemAcc_MemResumeFuncTypeMemAcc_MemSuspendFuncTypeMemAcc_MemWriteFuncTypeMemIf_JobResultTypeMemIf_ModeTypeMemIf_StatusTypeNvM_BlockIdTypeNvM_BlockRequestTypeNvM_ConfigTypeNvM_InitBlockRequestTypeNvM_MultiBlockRequestTypeNvM_RequestResultTypeRamTst_AlgorithmTypeRamTst_AlgParamsIdTypeRamTst_ConfigTypeRamTst_ExecutionStatusTypeRamTst_NumberOfBlocksTypeRamTst_NumberOfTestedCellsTypeRamTst_TestResultType函数
<AddressAreaJobEndNotification><ApplicationLockNotification>BndM_InitBndM_JobEndNotificationBndM_JobErrorNotificationBndM_MainFunctionBndM_WriteCancelEa_CancelEa_EraseImmediateBlockEa_GetJobResultEa_GetStatusEa_GetVersionInfoEa_InitEa_InvalidateBlockEa_JobEndNotificationEa_JobErrorNotificationEa_MainFunctionEa_ReadEa_SetModeEa_WriteEep_CancelEep_CompareEep_EraseEep_GetJobResultEep_GetStatusEep_GetVersionInfoEep_InitEep_JobEndNotificationEep_JobErrorNotificationEep_MainFunctionEep_ReadEep_SetModeEep_WriteFee_CancelFee_EraseImmediateBlockFee_GetJobResultFee_GetStatusFee_GetVersionInfoFee_InitFee_InvalidateBlockFee_JobEndNotificationFee_JobEndNotification (Fls)Fee_JobErrorNotificationFee_JobErrorNotification (Fls)Fee_MainFunctionFee_ReadFee_SetModeFee_WriteFls_BlankCheckFls_CancelFls_CompareFls_EraseFls_GetJobResultFls_GetStatusFls_GetVersionInfoFls_InitFls_MainFunctionFls_ReadFls_SetModeFls_WriteFlsTst_AbortFlsTst_DeInitFlsTst_GetVersionInfoFlsTst_InitFlsTst_MainFunctionFlsTst_ResumeFlsTst_StartFgndFlsTst_SuspendFlsTst_TestCompletedNotificationFlsTst_TestEccMem_BlankCheckMem_DeInitMem_EraseMem_GetJobResultMem_GetVersionInfoMem_HwSpecificServiceMem_InitMem_MainFunctionMem_PropagateErrorMem_ReadMem_ResumeMem_SuspendMem_WriteMemAcc_ActivateMemMemAcc_BlankCheckMemAcc_CancelMemAcc_CompareMemAcc_DeactivateMemMemAcc_DeInitMemAcc_EraseMemAcc_GetJobInfoMemAcc_GetJobResultMemAcc_GetJobStatusMemAcc_GetMemoryInfoMemAcc_GetProcessedLengthMemAcc_GetVersionInfoMemAcc_HwSpecificServiceMemAcc_InitMemAcc_MainFunctionMemAcc_ReadMemAcc_ReleaseLockMemAcc_RequestLockMemAcc_WriteMemIf_CancelMemIf_EraseImmediateBlockMemIf_GetJobResultMemIf_GetStatusMemIf_GetVersionInfoMemIf_InvalidateBlockMemIf_ReadMemIf_SetModeMemIf_WriteNvM_CancelJobsNvM_CancelWriteAllNvM_EraseNvBlockNvM_FirstInitAllNvM_GetDataIndexNvM_GetErrorStatusNvM_GetVersionInfoNvM_InitNvM_InitBlockCallbackFunctionNvM_InvalidateNvBlockNvM_JobEndNotificationNvM_JobEndNotification (Fee)NvM_JobEndNotification (NvM)NvM_JobErrorNotificationNvM_JobErrorNotification (Fee)NvM_JobErrorNotification (NvM)NvM_MainFunctionNvM_MultiBlockCallbackFunctionNvM_ReadAllNvM_ReadBlockNvM_ReadPRAMBlockNvM_ReadRamBlockFromNvmNvM_RestoreBlockDefaultsNvM_RestorePRAMBlockDefaultsNvM_SetBlockLockStatusNvM_SetBlockProtectionNvM_SetDataIndexNvM_SetRamBlockStatusNvM_SingleBlockCallbackFunctionNvM_ValidateAllNvM_WriteAllNvM_WriteBlockNvM_WritePRAMBlockNvM_WriteRamBlockToNvmRamTst_AllowRamTst_ChangeNumberOfTestedCellsRamTst_DeInitRamTst_ErrorNotificationRamTst_GetVersionInfoRamTst_InitRamTst_MainFunctionRamTst_ResumeRamTst_RunFullTestRamTst_RunPartialTestRamTst_SelectAlgParamsRamTst_StopRamTst_SuspendRamTst_TestCompletedNotificationTst_AlgorithmTypeRamTst_GetTestAlgorithmTst_AlgParamsIdTypeRamTst_GetAlgParamsTst_ErrorDetailsTypeFlsTst_GetErrorDetailsTst_ExecutionStatusTypeRamTst_GetExecutionStatusTst_NumberOfTestedCellsTypeRamTst_GetNumberOfTestedCellsTst_StateTypeFlsTst_GetCurrentStateTst_TestResultBgndTypeFlsTst_GetTestResultBgndTst_TestResultFgndTypeFlsTst_GetTestResultFgndTst_TestResultTypeRamTst_GetTestResultTst_TestResultTypeRamTst_GetTestResultPerBlockTst_TestSignatureBgndTypeFlsTst_GetTestSignatureBgndTst_TestSignatureFgndTypeFlsTst_GetTestSignatureFgnd类型
BndM_BlockIdTypeBndM_Block{BlockId.Shortname}TypeBndM_ConfigTypeBndM_ResultTypeEa_ConfigTypeEep_AddressTypeEep_ConfigTypeEep_LengthTypeFee_ConfigTypeFls_AddressTypeFls_ConfigTypeFls_LengthTypeFlsTst_BlockIdFgndTypeFlsTst_ConfigTypeFlsTst_ErrorDetailsTypeFlsTst_StateTypeFlsTst_TestResultBgndTypeFlsTst_TestResultFgndTypeFlsTst_TestResultTypeFlsTst_TestSignatureBgndTypeFlsTst_TestSignatureFgndTypeMem_AddressTypeMem_ConfigTypeMem_DataTypeMem_HwServiceIdTypeMem_InstanceIdTypeMem_JobResultTypeMem_LengthTypeMemAcc_AddressAreaIdTypeMemAcc_AddressTypeMemAcc_ApplicationLockNotificationTypeMemAcc_ConfigTypeMemAcc_DataTypeMemAcc_HwIdTypeMemAcc_JobInfoTypeMemAcc_JobResultTypeMemAcc_JobStatusTypeMemAcc_JobTypeMemAcc_LengthTypeMemAcc_MemAddressTypeMemAcc_MemBinaryHeaderTypeMemAcc_MemBlankCheckFuncTypeMemAcc_MemConfigTypeMemAcc_MemDataTypeMemAcc_MemDeInitFuncTypeMemAcc_MemEraseFuncTypeMemAcc_MemGetJobResultFuncTypeMemAcc_MemHwServiceIdTypeMemAcc_MemHwSpecificServiceFuncTypeMemAcc_MemInitFuncTypeMemAcc_MemInstanceIdTypeMemAcc_MemJobResultTypeMemAcc_MemLengthTypeMemAcc_MemMainFuncTypeMemAcc_MemoryInfoTypeMemAcc_MemPropagateErrorFuncTypeMemAcc_MemReadFuncTypeMemAcc_MemResumeFuncTypeMemAcc_MemSuspendFuncTypeMemAcc_MemWriteFuncTypeMemIf_JobResultTypeMemIf_ModeTypeMemIf_StatusTypeNvM_BlockIdTypeNvM_BlockRequestTypeNvM_ConfigTypeNvM_InitBlockRequestTypeNvM_MultiBlockRequestTypeNvM_RequestResultTypeRamTst_AlgorithmTypeRamTst_AlgParamsIdTypeRamTst_ConfigTypeRamTst_ExecutionStatusTypeRamTst_NumberOfBlocksTypeRamTst_NumberOfTestedCellsTypeRamTst_TestResultType主题图
BndM
9Ea
16Eep
16Fee
16Fls
17FlsTst
25Mem
20MemAcc
54MemIf
12NvM
36RamTst
27此版本没有元素数据
BndM
Initializes or reinitializes this module.
void BndM_Init(const BndM_ConfigType* ConfigPtr);This callback function is called when a FLS job has been finished with positive result.
void BndM_JobEndNotification(void);This callback function is called when a FLS job has been canceled or finished with negative result.
void BndM_JobErrorNotification(void);Schedule function for the background processing.
void BndM_MainFunction(void);Cancels the writing
void BndM_WriteCancel(void);Unique identification of an bulk nv block. The BndM_BlockId is assigned by the BndM.
The elements of this structure data type is the C-structured representation of the configured ImplementationDataPrototype.
This type of the external data structure shall contain the post build initialization data for the BndM.
Result of the asynchronous job finish notifications
Ea
Cancels the ongoing asynchronous operation.
void Ea_Cancel (void);Erases the block Block Number.
Std_ReturnType Ea_EraseImmediateBlock (uint16 BlockNumber);Service to return the Job Result.
MemIf_JobResultType Ea_GetJobResult (void);Service to return the Status.
MemIf_StatusType Ea_GetStatus (void);Service to get the version information of this module.
void Ea_GetVersionInfo (Std_VersionInfoType* VersionInfoPtr);Initializes the EEPROM abstraction module.
void Ea_Init (const Ea_ConfigType* ConfigPtr);Invalidates the block Block Number.
Std_ReturnType Ea_InvalidateBlock (uint16 BlockNumber);Service to report to this module the successful end of an asynchronous operation.
void Ea_JobEndNotification (void);Service to report to this module the failure of an asynchronous operation.
void Ea_JobErrorNotification (void);Service to handle the requested jobs and the internal management operations.
void Ea_MainFunction (void);Reads Length bytes of block Blocknumber at offset Block Offset into the buffer Data Buffer Ptr.
Std_ReturnType Ea_Read (uint16 BlockNumber, uint16 BlockOffset, uint8* DataBufferPtr, uint16 Length);Function to switch the mode of the underlying EEPROM Driver
void Ea_SetMode (MemIf_ModeType Mode);Writes the contents of the Data Buffer Ptr to the block Block Number.
Std_ReturnType Ea_Write (uint16 BlockNumber, const uint8* DataBufferPtr);Function to be used by the underlying memory abstraction to signal end of job without error.
void NvM_JobEndNotification (void);Function to be used by the underlying memory abstraction to signal end of job with error.
void NvM_JobErrorNotification (void);Configuration data structure of the Ea module.
Eep
Cancels a running job.
void Eep_Cancel(void);Compares a data block in EEPROM with an EEPROM block in the memory.
Std_ReturnType Eep_Compare(Eep_AddressType EepromAddress, const uint8* DataBufferPtr, Eep_LengthType Length);Service for erasing EEPROM sections.
Std_ReturnType Eep_Erase(Eep_AddressType EepromAddress, Eep_LengthType Length);This service returns the result of the last job.
MemIf_JobResultType Eep_GetJobResult(void);Returns the EEPROM status.
MemIf_StatusType Eep_GetStatus(void);Service to get the version information of this module.
void Eep_GetVersionInfo(Std_VersionInfoType* versioninfo);Service for EEPROM initialization.
void Eep_Init(const Eep_ConfigType* ConfigPtr);This callback function provided by the module user is called when a job has been completed with a positive result.
void Eep_JobEndNotification(void);This callback function provided by the module user is called when a job has been canceled or finished with negative result.
void Eep_JobErrorNotification(void);Service to perform the processing of the EEPROM jobs (read/write/erase/compare) .
void Eep_MainFunction(void);Reads from EEPROM.
Std_ReturnType Eep_Read(Eep_AddressType EepromAddress, uint8* DataBufferPtr, Eep_LengthType Length);Sets the mode.
void Eep_SetMode(MemIf_ModeType Mode);Writes to EEPROM.
Std_ReturnType Eep_Write(Eep_AddressType EepromAddress, const uint8* DataBufferPtr, Eep_LengthType Length);Used as address offset from the configured EEPROM base address to access a certain EEPROM memory area.
This is the type of the external data structure containing the initialization data for the EEPROM driver.
Specifies the number of bytes to read/write/erase/compare.
Fee
Service to call the cancel function of the underlying flash driver.
void Fee_Cancel (void);Service to erase a logical block.
Std_ReturnType Fee_EraseImmediateBlock (uint16 BlockNumber);Service to query the result of the last accepted job issued by the upper layer software.
MemIf_JobResultType Fee_GetJobResult (void);Service to return the status. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_FlashEEPROMEmulation
MemIf_StatusType Fee_GetStatus (void);Service to return the version information of the FEE module.
void Fee_GetVersionInfo (Std_VersionInfoType* VersionInfoPtr);Service to initialize the FEE module.
void Fee_Init (const Fee_ConfigType* ConfigPtr);Service to invalidate a logical block.
Std_ReturnType Fee_InvalidateBlock (uint16 BlockNumber);Service to report to this module the successful end of an asynchronous operation. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_FlashEEPROMEmulation
void Fee_JobEndNotification (void);Service to report to this module the failure of an asynchronous operation.
void Fee_JobErrorNotification (void);Service to handle the requested read / write / erase jobs and the internal management operations.
void Fee_MainFunction (void);Service to initiate a read job.
Std_ReturnType Fee_Read (uint16 BlockNumber, uint16 BlockOffset, uint8* DataBufferPtr, uint16 Length);Function to switch the mode of the underlying Flash Driver
void Fee_SetMode (MemIf_ModeType Mode);Service to initiate a write job.
Std_ReturnType Fee_Write (uint16 BlockNumber, const uint8* DataBufferPtr);-
void NvM_JobEndNotification (void);-
void NvM_JobErrorNotification (void);Configuration data structure of the Fee module.
Fls
This callback function is called when a job has been completed with a positive result.
void Fee_JobEndNotification(void);This callback function is called when a job has been canceled or finished with negative result.
void Fee_JobErrorNotification(void);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.
Std_ReturnType Fls_BlankCheck(Fls_AddressType TargetAddress, Fls_LengthType Length);Cancels an ongoing job.
void Fls_Cancel(void);Compares the contents of an area of flash memory with that of an application data buffer.
Std_ReturnType Fls_Compare(Fls_AddressType SourceAddress, const uint8* TargetAddressPtr, Fls_LengthType Length);Erases flash sector(s).
Std_ReturnType Fls_Erase(Fls_AddressType TargetAddress, Fls_LengthType Length);Returns the result of the last job.
MemIf_JobResultType Fls_GetJobResult(void);Returns the driver state.
MemIf_StatusType Fls_GetStatus(void);Returns the version information of this module.
void Fls_GetVersionInfo(Std_VersionInfoType* VersioninfoPtr);Initializes the Flash Driver.
void Fls_Init(const Fls_ConfigType* ConfigPtr);Performs the processing of jobs.
void Fls_MainFunction(void);Reads from flash memory.
Std_ReturnType Fls_Read(Fls_AddressType SourceAddress, uint8* TargetAddressPtr, Fls_LengthType Length);Sets the flash driver's operation mode.
void Fls_SetMode(MemIf_ModeType Mode);Writes one or more complete flash pages.
Std_ReturnType Fls_Write(Fls_AddressType TargetAddress, const uint8* SourceAddressPtr, Fls_LengthType Length);Used as address offset from the configured flash base address to access a certain flash memory area.
A pointer to such a structure is provided to the flash driver initialization routine for configuration of the driver and flash memory hardware.
Specifies the number of bytes to read/write/erase/compare.
FlsTst
Service for aborting the Flash Test.
void FlsTst_Abort(void);Service for Flash Test De - Initialization.
void FlsTst_DeInit(void);Service returns the version information of this module.
void FlsTst_GetVersionInfo(Std_VersionInfoType* versioninfo);Service for Flash Test initialization.
void FlsTst_Init(const FlsTst_ConfigType* ConfigPtr);Service for executing the Flash Test in background mode.
void FlsTst_MainFunction(void);Service for continuing the Flash Test at the point it was suspended.
void FlsTst_Resume(void);Service for executing foreground Flash Test.
Std_ReturnType FlsTst_StartFgnd(FlsTst_BlockIdFgndType FgndBlockId);Service for suspending current operation of the Flash Test, until Fls Tst_ Resume is called.
void FlsTst_Suspend(void);The function Fls Tst_ Test Completed shall be called every time when a complete test cycle had been tested.
void FlsTst_TestCompletedNotification(void);Service executes a test of ECC hardware. This is only applicable in case the hardware provices such functionality.
Std_ReturnType FlsTst_TestEcc(void);Service returns error detais monitored from the Flash module.
FlsTst_ErrorDetailsType FlsTst_GetErrorDetails(void);Service returns the current Flash Test exection state.
FlsTst_StateType FlsTst_GetCurrentState(void);Service returns the Background Flash Test result.
FlsTst_TestResultBgndType FlsTst_GetTestResultBgnd(void);Service returns the Foreground Flash Test result.
FlsTst_TestResultFgndType FlsTst_GetTestResultFgnd(void);Service returns the Flash Test result in background mode.
FlsTst_TestSignatureBgndType FlsTst_GetTestSignatureBgnd(void);Service returns the Flash Test result in foreground mode.
FlsTst_TestSignatureFgndType FlsTst_GetTestSignatureFgnd(void);This type specifies the identification (ID) for a Flash block to be tested in foreground mode, which is configured in the configuration structure.
This type of external data structure shall contain the initialization data for the Flash Test.
This type shall specify implementation specific error information monitored in the Flash test module.
This is a state value returned by the API service Fls Tst_ Get Current State().
Return type of API service Fls Tst_ Get Test Result Bgnd().
Return type of API service Fls Tst_ Get Result Fgnd().
Type for test signature in background mode.
Type for test signature in foreground mode
Mem
Triggers a job to check the erased state of the page which is referenced by targetAddress. The result of this service can be retrieved using the Mem_GetJobResult API. If the checked page is blank, the result of the job is MEM_JOB_OK. Otherwise, if the page is not blank, the result is MEM_INCONSISTENT.
Std_ReturnType Mem_BlankCheck(Mem_InstanceIdType instanceId, Mem_AddressType targetAddress, Mem_LengthType length);De-initialize module. If there is still an access job pending, it is immediately terminated (using hardware cancel operation) and the Mem driver module state is set to unitialized. Therefore, Mem must be re-initialized before it will accept any new job requests after this service is processed.
void Mem_DeInit(void);Triggers an erase job of the given sector/sector batch defined by targetAddress and length. The result of this service can be retrieved using the Mem_GetJobResult API. If the erase operation was successful, the result of the job is MEM_JOB_OK. If the erase operation failed, e.g. due to a hardware issue, the result of the job is MEM_JOB_FAILED.
Std_ReturnType Mem_Erase(Mem_InstanceIdType instanceId, Mem_AddressType targetAddress, Mem_LengthType length);Service to return results of the most recent job.
Mem_JobResultType Mem_GetJobResult(Mem_InstanceIdType instanceId);Service to return the version information of the Mem module.
void Mem_GetVersionInfo(Std_VersionInfoType* versionInfoPtr);Triggers a hardware specific memory driver job. dataPtr can be used to pass and return data to/ from this service. This service is just a dispatcher to the hardware specific service implementation referenced by hwServiceId. The result of this service can be retrieved using the Mem_GetJobResult API. If the hardware specific operation was successful, the result of the job is MEM_JOB_OK. If the hardware specific operation failed, the result of the job is MEM_JOB_ FAILED. Tags: atp.Status=draft
Std_ReturnType Mem_HwSpecificService(Mem_InstanceIdType instanceId, Mem_HwServiceIdType hwServiceId, Mem_DataType* dataPtr, Mem_LengthType* lengthPtr);Initialization function - initializes all variables and sets the module state to initialized.
void Mem_Init(const Mem_ConfigType* configPtr);Service to handle the requested jobs and the internal management operations.
void Mem_MainFunction(void);This service can be used to report an access error in case the Mem driver cannot provide the access error information - typically for ECC faults. It is called by the system ECC handler to propagate an ECC error to the memory upper layers..
void Mem_PropagateError(Mem_InstanceIdType instanceId);Triggers a read job to copy the from the source address into the referenced destination data buffer. The result of this service can be retrieved using the Mem_GetJobResult API. If the read operation was successful, the result of the job is MEM_JOB_OK. If the read operation failed, the result of the job is either MEM_JOB_FAILED in case of a general error or MEM_ECC_ CORRECTED/MEM_ECC_UNCORRECTED in case of a correctable/uncorrectable ECC error.
Std_ReturnType Mem_Read(Mem_InstanceIdType instanceId, Mem_AddressType sourceAddress, Mem_DataType* destinationDataPtr, Mem_LengthType length);Resume suspended memory operation using hardware mechanism. Tags: atp.Status=draft
void Mem_Resume(Mem_InstanceIdType instanceId);Suspend active memory operation using hardware mechanism. Tags: atp.Status=draft
void Mem_Suspend(Mem_InstanceIdType instanceId);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 using the Mem_GetJobResult API. If the write operation was successful, the job result is MEM_JOB_OK. If there was an issue writing the data, the result is MEM_FAILED.
Std_ReturnType Mem_Write(Mem_InstanceIdType instanceId, Mem_AddressType targetAddress, const Mem_DataType* sourceDataPtr, Mem_LengthType length);Physical memory device address type
Postbuild configuration structure type
Read data user buffer type
Hardware specific service request identifier type
Job end notification function called by Mem in case the job processing is configured for job end notification.
Asynchronous job result type
Physical memory device length type
MemAcc
MemAcc application job end notification callback. The function name is configurable. Tags: atp.Status=draft
void <AddressAreaJobEndNotification>(MemAcc_AddressAreaIdType addressAreaId, MemAcc_JobResultType jobResult);Address area lock application callback. The function name is configurable. Tags: atp.Status=draft
void <ApplicationLockNotification>(void);Dynamic activation and initialization of a Mem driver referenced by hwId and headerAddress.
Std_ReturnType MemAcc_ActivateMem(MemAcc_AddressType headerAddress, MemAcc_HwIdType hwId);Checks if the passed address space is blank, i.e. erased and writeable. The result of this service can be retrieved using the MemAcc_GetJobResult API. If the address area defined by targetAddress and length is blank, the result is MEMACC_MEM_OK, otherwise the result is MEMACC_MEM_INCONSISTENT.
Std_ReturnType MemAcc_BlankCheck(MemAcc_AddressAreaIdType addressAreaId, MemAcc_AddressType targetAddress, MemAcc_LengthType length);Triggers a cancel operation of the pending job for the address area referenced by the address AreaId. Cancelling affects only jobs in pending state. For any other states, the request will be ignored.
void MemAcc_Cancel(MemAcc_AddressAreaIdType addressAreaId);Triggers a job to compare the passed data to the memory content of the provided address area. The job terminates, if all bytes matched or a difference was detected. The result of this service can be retrieved using the MemAcc_GetJobResult() API. If the compare operation determined a mismatch, the result code is MEMACC_MEM_INCONSISTENT. Tags: atp.Status=draft
Std_ReturnType MemAcc_Compare(MemAcc_AddressAreaIdType addressAreaId, MemAcc_AddressType sourceAddress, const MemAcc_DataType* dataPtr, MemAcc_LengthType length);Dynamic deactivation of a Mem driver referenced by hwId and headerAddress.
Std_ReturnType MemAcc_DeactivateMem(MemAcc_HwIdType hwId, MemAcc_AddressType headerAddress);Deinitialize module. If there are still access jobs pending, they are immediately terminated and the module state is set to unitialized. Therefore, MemAcc must be re-initialized before it will accept any new job requests after this service is processed.
void MemAcc_DeInit(void);Triggers an erase job of the given area. Triggers an erase job of the given area defined by targetAddress and length. The result of this service can be retrieved using the Mem_GetJobResult API. If the erase operation was successful, the result of the job is MEM_JOB_OK. If the erase operation failed, e.g. due to a hardware issue, the result of the job is MEM_JOB_FAILED.
Std_ReturnType MemAcc_Erase(MemAcc_AddressAreaIdType addressAreaId, MemAcc_AddressType targetAddress, MemAcc_LengthType length);Returns detailed information of the current memory job like memory device ID, job type, job processing state or job result, address area as well as address and length.
void MemAcc_GetJobInfo(MemAcc_AddressAreaIdType addressAreaId, MemAcc_JobInfoType* jobInfoPtr);Returns the consolidated job result of the address area referenced by addressAreaId.
MemAcc_JobResultType MemAcc_GetJobResult(MemAcc_AddressAreaIdType addressAreaId);Returns the status of the MemAcc job referenced by addressAreaId.
MemAcc_JobStatusType MemAcc_GetJobStatus(MemAcc_AddressAreaIdType addressAreaId);This service function retrieves the physical memory device information of a specific address area. It can be used by an upper layer to get all necessary information to align the start address and trim the length for erase/write jobs.
Std_ReturnType MemAcc_GetMemoryInfo(MemAcc_AddressAreaIdType addressAreaId, MemAcc_AddressType address, MemAcc_MemoryInfoType* memoryInfoPtr);Returns the accumulated number of bytes that have already been processed in the current job.
MemAcc_LengthType MemAcc_GetProcessedLength(MemAcc_AddressAreaIdType addressAreaId);Service to return the version information of the MemAcc module.
void MemAcc_GetVersionInfo(Std_VersionInfoType* versionInfoPtr);Triggers a hardware specific job request referenced by hwServiceId. Service specific data can be passed/retrieved by dataPtr. The result of this service can be retrieved using the MemAcc_GetJobResult API. If the hardware specific operation was successful, the result of the job is MEMACC_MEM_OK. If the hardware specific operation failed, the result of the job is MEMACC_MEM_FAILED.
Std_ReturnType MemAcc_HwSpecificService(MemAcc_AddressAreaIdType addressAreaId, MemAcc_HwIdType hwId, MemAcc_MemHwServiceIdType hwServiceId, MemAcc_DataType* dataPtr, MemAcc_LengthType* lengthPtr);Initialization function - initializes all variables and sets the module state to initialized.
void MemAcc_Init(const MemAcc_ConfigType* configPtr);Service to handle the requested jobs and the internal management operations. Depending on the configuration MemAcc will call the Mem driver main functions.
void MemAcc_MainFunction(void);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 successful, the result of the job is MEMACC_MEM_OK. If the read 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.
Std_ReturnType MemAcc_Read(MemAcc_AddressAreaIdType addressAreaId, MemAcc_AddressType sourceAddress, MemAcc_DataType* destinationDataPtr, MemAcc_LengthType length);Release access lock of provided address area. Tags: atp.Status=draft
Std_ReturnType MemAcc_ReleaseLock(MemAcc_AddressAreaIdType addressAreaId, MemAcc_AddressType address, MemAcc_LengthType length);Request lock of an address area for exclusive access. Once the lock is granted, the referenced lock notification function is called by MemAcc.
Std_ReturnType MemAcc_RequestLock(MemAcc_AddressAreaIdType addressAreaId, MemAcc_AddressType address, MemAcc_AddressType length, void* lockNotificationFctPtr);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 using the MemAcc_GetJobResult API. If the write operation was successful, the job result is MEMACC_MEM_OK. If there was an issue writing the data, the result is MEMACC_MEM_FAILED.
Std_ReturnType MemAcc_Write(MemAcc_AddressAreaIdType addressAreaId, MemAcc_AddressType targetAddress, const MemAcc_DataType* sourceDataPtr, MemAcc_LengthType length);Unique address area ID type.
Logical memory address type.
Type of the function pointer to register an application callback to be notified once the address area lock was successfully acquired.
Postbuild configuration structure type.
General data type.
Type for the unique numeric identifiers of all Mem hardware instances used for hardware specific requests.
This structure contains information the current processing state of the MemAcc module.
Asynchronous job result type.
Asynchronous job status type.
Type for asynchronous jobs.
Job length type.
Physical memory device address type
This structure contains elements for accessing the Mem driver service functions and consistency information. Tags: atp.Status=draft
Function pointer for the Mem_BlankCheck service for the invocation of the Mem driver API via function pointer interface. Tags: atp.Status=draft
Memory driver configuration structure type
General data type
Function pointer for the Mem_DeInit service for the invocation of the Mem driver API via function pointer interface.
Function pointer for the Mem_Erase service for the invocation of the Mem driver API via function pointer interface. Tags: atp.Status=draft
Function pointer for the Mem_JobResultType service for the invocation of the Mem driver API via function pointer interface.
Index type for Mem driver hardware specific service table.
Function pointer for the Mem_HwSpecificService function for the invocation of the Mem driver API via function pointer interface. Tags: atp.Status=draft
Function pointer for the Mem_Init service for the invocation of the Mem driver API via function pointer interface.
Memory driver instance ID type
Asynchronous job result type
Physical memory device length type
Function pointer for the Mem_MainFunction service for the invocation of the Mem driver API via function pointer interface.
This structure contains information of Mem device characteristics. It can be accessed via the MemAcc_GetMemoryInfo() service. Tags: atp.Status=draft
Function pointer for the Mem_PropagateError service for the invocation of the Mem driver API via function pointer interface.
Function pointer for the Mem_Read service for the invocation of the Mem driver API via function pointer interface. Tags: atp.Status=draft
Function pointer for the Mem_Resume service for the invocation of the Mem driver API via function pointer interface. Tags: atp.Status=draft
Function pointer for the Mem_Suspend service for the invocation of the Mem driver API via function pointer interface. Tags: atp.Status=draft
Function pointer for the Mem_Write service for the invocation of the Mem driver API via function pointer interface. Tags: atp.Status=draft
MemIf
Invokes the "Cancel" function of the underlying memory abstraction module selected by the parameter Device Index.
void MemIf_Cancel (uint8 DeviceIndex);Invokes the "Erase Immediate Block" function of the underlying memory abstraction module selected by the parameter Device Index.
Std_ReturnType MemIf_EraseImmediateBlock (uint8 DeviceIndex, uint16 BlockNumber);Invokes the "Get Job Result" function of the underlying memory abstraction module selected by the parameter Device Index. Available v ia Mem If.h
MemIf_JobResultType MemIf_GetJobResult (uint8 DeviceIndex);Invokes the "Get Status" function of the underlying memory abstraction module selected by the parameter Device Index.
MemIf_StatusType MemIf_GetStatus (uint8 DeviceIndex);Returns version information.
void MemIf_GetVersionInfo (Std_VersionInfoType* VersionInfoPtr);Invokes the "Invalidate Block" function of the underlying memory abstraction module AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_MemoryAbstractionInterface selected by the parameter Device Index.
Std_ReturnType MemIf_InvalidateBlock (uint8 DeviceIndex, uint16 BlockNumber);Invokes the "Set Mode" functions of all underlying memory abstraction modules.
void MemIf_SetMode (MemIf_ModeType Mode);Invokes the "Write" function of the underlying memory abstraction module selected by the parameter Device Index.
Std_ReturnType MemIf_Write (uint8 DeviceIndex, uint16 BlockNumber, const uint8* DataBufferPtr);Denotes the result of the last job.
Denotes the operation mode of the underlying abstraction mod ules and device drivers.
Denotes the current status of the underlying abstraction module and device drive. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_MemoryAbstractionInterface
NvM
Service to cancel all jobs pending for a NV block.
Std_ReturnType NvM_CancelJobs (NvM_BlockIdType BlockId);Service to cancel a running Nv M_ Write All request.
void NvM_CancelWriteAll (void);Service to erase a NV block.
Std_ReturnType NvM_EraseNvBlock (NvM_BlockIdType BlockId);The function initiates a multi block first initialization request. The job of the function does not care if a block exists in the non - volatile memory or not OR if it is valid (i.e. not corrupted) or not, when processing it.
void NvM_FirstInitAll (void);Service for getting the currently set Data Index of a datase t NVRAM block
Std_ReturnType NvM_GetDataIndex (NvM_BlockIdType BlockId, uint8* DataIndexPtr);Service to read the block dependent error/ status information.
Std_ReturnType NvM_GetErrorStatus (NvM_BlockIdType BlockId, NvM_RequestResultType* RequestResultPtr);Service to get the version information of the Nv M module.
void NvM_GetVersionInfo (Std_VersionInfoType* versioninfo);Service for resetting all internal variables.
void NvM_Init (const NvM_ConfigType* ConfigPtr);Per block callback routine which shall be called by the Nv M module when default data needs to be restored in RAM, and a RO M block is not configured. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_NVRAMManager
Std_ReturnType NvM_InitBlockCallbackFunction (NvM_InitBlockRequestType InitBlockRequest);Service to invalidate a NV block.
Std_ReturnType NvM_InvalidateNvBlock (NvM_BlockIdType BlockId);Function to be used by the underlying memory abstraction to signal end of job without error.
void NvM_JobEndNotification (void);Function to be used by the underlying memory abstraction to signal end of job with error.
void NvM_JobErrorNotification (void);Service for performing the processing of the Nv M jobs.
void NvM_MainFunction (void);Common callback routine to notify the upper layer that an asynchronous multi block request has been finished. Available v ia Nv M_ Externals.h
Std_ReturnType NvM_MultiBlockCallbackFunction (NvM_MultiBlockRequestType MultiBlockRequest, NvM_RequestResultType JobResult);Initiates a multi block read request.
void NvM_ReadAll (void);Service to copy the data of the NV block to its corresponding RAM block.
Std_ReturnType NvM_ReadBlock (NvM_BlockIdType BlockId, void* NvM_DstPtr);Service to copy the data of the NV block to its corresponding permanent RAM block.
Std_ReturnType NvM_ReadPRAMBlock (NvM_BlockIdType BlockId);Block specific callback routine which shall be called in order to let the application copy data from Nv M module's mirror to RAM block.
Std_ReturnType NvM_ReadRamBlockFromNvm (const void* NvMBuffer);Service to restore the default data to its corr esponding RAM block.
Std_ReturnType NvM_RestoreBlockDefaults (NvM_BlockIdType BlockId, void* NvM_DestPtr);Service to restore the default data to its corresponding permanent RAM block.
Std_ReturnType NvM_RestorePRAMBlockDefaults (NvM_BlockIdType BlockId);Service for setting the lock status of a permanent RAM block or of the explicit synchronization of a NVRAM block.
void NvM_SetBlockLockStatus (NvM_BlockIdType BlockId, boolean BlockLocked);Service for setting/ resetting the write protection for a NV block. Availabl e via Nv M.h
Std_ReturnType NvM_SetBlockProtection (NvM_BlockIdType BlockId, boolean ProtectionEnabled);Service for setting the Data Inde x of a dataset NVRAM block.
Std_ReturnType NvM_SetDataIndex (NvM_BlockIdType BlockId, uint8 DataIndex);Service for setting the RAM block status of a permanent RAM block or the status of the explicit synchronization of a NVRAM block.
Std_ReturnType NvM_SetRamBlockStatus (NvM_BlockIdType BlockId, boolean BlockChanged);Per block callback routine to notify the upper layer that an asynchronous single block request has been finished.
Std_ReturnType NvM_SingleBlockCallbackFunction (NvM_BlockRequestType BlockRequest, NvM_RequestResultType JobResult);Initiates a multi block validation request.
void NvM_ValidateAll (void);Initiates a multi block write request.
void NvM_WriteAll (void);Service to copy the data of the RAM block to its corresponding NV block. Available vi a Nv M.h
Std_ReturnType NvM_WriteBlock (NvM_BlockIdType BlockId, const void* NvM_SrcPtr);Service to copy the data of the permanent RAM block to its corresponding NV block.
Std_ReturnType NvM_WritePRAMBlock (NvM_BlockIdType BlockId);Block specific callback routine which shall be called in order to let the application copy data from RAM block to Nv M module's mirror.
Std_ReturnType NvM_WriteRamBlockToNvm (void* NvMBuffer);Identification of a NVRAM block via a unique block identifier. Reserved NVRAM block IDs: 0 - > to derive multi block request results via Nv M_ Get Error Status 1 - > redundant NVRAM block which holds the configuration ID
Identifies the type of reques t performed on a block when signaled via the callback function
Configuration data structure of the Nv M module.
Identifies the type of request performed on a block when signaled via the callback function
Identifies the type of request performed on multi block when signaled via the callback function or when reporting to Bsw M
Type NvM_RequestResultType.
RamTst
Service for continuing the RAM Test after calling 'Ram Tst_ Stop.
void RamTst_Allow(void);Service changes the current number of tested cells.
void RamTst_ChangeNumberOfTestedCells(RamTst_NumberOfTestedCellsType NewNumberOfTestedCells);Service for RAM Test deinitialization.
void RamTst_DeInit(void);The function Ram Tst_ Error shall be called every time when a RAM failure has been detected by the selected test algorithm in the background.
void RamTst_ErrorNotification(void);Service returns the version information of this module.
void RamTst_GetVersionInfo(Std_VersionInfoType* versioninfo);Service for RAM Test initialization.
void RamTst_Init(const RamTst_ConfigType* ConfigPtr);Scheduled function for executing the RAM Test in the background.
void RamTst_MainFunction(void);Service for allowing to continue the background RAM Test at the point is was suspended.
void RamTst_Resume(void);Service for executing the full RAM Test in the foreground.
void RamTst_RunFullTest(void);Service for testing one RAM block in the foreground.
void RamTst_RunPartialTest(RamTst_NumberOfBlocksType BlockId);Service used to set the test algorithm and its parameter set.
void RamTst_SelectAlgParams(RamTst_AlgParamsIdType NewAlgParamsId);Service for stopping the RAM Test.
void RamTst_Stop(void);Service for suspending current operation of background RAM Test, until RESUME is called.
void RamTst_Suspend(void);The function Ram Tst_ Test Completed shall be called every time when all RAM blocks of the current test configuration have been tested in the background.
void RamTst_TestCompletedNotification(void);Service returns the current RAM Test algorithm.
RamTst_AlgorithmType RamTst_GetTestAlgorithm(void);Service returns the ID of the current RAM Test algorithm parameter set.
RamTst_AlgParamsIdType RamTst_GetAlgParams(void);Service returns the current RAM Test execution status.
RamTst_ExecutionStatusType RamTst_GetExecutionStatus(void);Service returns the current number of tested cells per main - function cycle.
RamTst_NumberOfTestedCellsType RamTst_GetNumberOfTestedCells(void);Service returns the current RAM Test result.
RamTst_TestResultType RamTst_GetTestResult(void);Service returns the current RAM Test result for the specified block.
RamTst_TestResultType RamTst_GetTestResultPerBlock(RamTst_NumberOfBlocksType BlockID);This is a value returned by the API service Ram Tst_ Get Test Algorithm().
Data type used to identify a set of configuration parameters for a test algorithm.
Configuration data structure of the Ram Tst module.
This is a status value returned by the API service Ram Tst_ Get Execution Status().
Data type used to identify or count RAM blocks given in the test configuration parameters.
Data type of number of tested RAM cells
This is a status value returned by the API service Ram Tst_ Get Test Result().
集群指南人工智能生成
通过结构化 NVRAM 块和抽象驱动程序独立于硬件保存并管理持久性数据。
通过结构化 NVRAM 块和抽象驱动程序独立于硬件保存并管理持久性数据。
模块集群“Memory Services”通过 NVRAM Manager 以及硬件抽象模块 MemIf、Fee 和 Ea([SWS_NvM_00447]、[SWS_MemIf_00039])实现非易失性应用数据的独立于硬件的存储和一致性保证。异步读写操作通过周期性 MainFunctions 处理,并在控制器启动(NvM_ReadAll)以及关机(NvM_WriteAll)期间集中执行 ModemanagementGuide 第54页。发生硬件错误时,多级重试、冗余和 ROM 恢复机制会介入,并自动向 DEM 报告([SWS_NvM_00470])。
集群“Memory Services”在 AUTOSAR Classic BSW 栈中提供非易失性数据的持久存储和管理。它包含服务层的 NVRAM Manager([SWS_NvM_00447]),以及硬件抽象层上带有 Flash EEPROM Emulation([SWS_Fee_00085])和 EEPROM Abstraction([SWS_Ea_00083])模块的 Memory Abstraction Interface([SWS_MemIf_00039])AUTOSAR SWS NVRAMManager 第10页。
架构图:Memory Services 集群中的分层结构和模块关系。来源:[SWS_MemIf_00039]、AUTOSAR SWS NVRAMManager 第10页
数据交换通过同步控制 API 和异步读写作业进行。数据既可以通过永久 RAM 块隐式交换,也可以通过模块引导的 RAM 镜像显式交换([SWS_NvM_00455]、[SWS_NvM_00514])NVDataHandling 第12页。排队作业的周期性处理通过定期执行的 BSW 主函数(NvM_MainFunction、Fee_MainFunction)进行,而 MemIf 则无状态地将调用委托给下层驱动程序([SWS_MemIf_00040])AUTOSAR CP SWS FlashEEPROMEmulation 第42页。
在运行周期中,BswM 协调多块操作:在系统启动时,NvM_ReadAll 将持久数据从非易失性存储器读取到 RAM 中([SWS_NvM_00460]),而在关机时,NvM_WriteAll 保存已更改的数据([SWS_NvM_00461])ModemanagementGuide 第54页。错误的读写访问通过重试以及冗余副本或 ROM 回退值进行拦截;系统向 DEM 报告永久性错误([SWS_NvM_00470]、[SWS_NvM_00279])ErrorDescription 第62页。
系统架构 & 模块集群的角色
AUTOSAR Classic Platform 的存储服务(Memory Services)模块集群确保非易失性存储器中应用程序和基础软件数据的标准化、独立于硬件的管理与持久化。该集群在纵向上划分为 AUTOSAR 基础软件架构的两层:服务层(Services Layer)的 NVRAM Manager([SWS_NvM_00447]),以及存储硬件抽象层(Memory Hardware Abstraction Layer)上带有下层抽象模块 Flash EEPROM Emulation([SWS_Fee_00085])和 EEPROM Abstraction([SWS_Ea_00083])的 Memory Abstraction Interface([SWS_MemIf_00039])AUTOSAR SWS NVRAMManager 第10页。
NVRAM Manager(NvM)构成了软件组件(SW-C)以及 BSW 模块(例如诊断事件管理器模块 (Dem))的核心入口点 SWS DiagnosticEventManager 第238页。它管理逻辑存储块,这些存储块由非易失性存储器中的 NV 块、易失性存储器中的 RAM 块以及用于初始化数据的可选 ROM 块组成([SWS_NvM_00137]、[SWS_NvM_00128])。根据需求,支持原生(NVM_BLOCK_NATIVE)、冗余(NVM_BLOCK_REDUNDANT)或数据集(NVM_BLOCK_DATASET)等块管理类型 AUTOSAR CP RS MemoryServices 第10页。
模块 Fee 和 Ea 封装了各自物理存储介质(Flash 或 EEPROM)的特性,并将逻辑块号和地址偏移映射到各自 MCAL 驱动程序(Fls 或 Eep)的线性地址空间([SWS_Fee_00087]、[SWS_Ea_00086])AUTOSAR SWS EEPROMAbstraction 第23页。模块 MemIf 在此作为纯路由层,根据参数 DeviceIndex 将访问转发到目标模块,而不保留自身的缓冲区结构([SWS_MemIf_00040])。
架构图:Memory Services 集群中的分层结构和模块关系。来源:[SWS_MemIf_00039]、AUTOSAR SWS NVRAMManager 第10页
各模块之间的交互配合与交互路径
模块之间的交互通过严格标准化的同步和异步路径进行。用户通过 NvM_WriteBlock 发起写入操作时,请求首先在 NvM 的管理块中注册([SWS_NvM_00455])。在同步调用时,通过 MemIf_Write 转发到 MemIf([SWS_MemIf_00040]),再由其将调用传递给 Fee_Write 或 Ea_Write([SWS_Fee_00088]、[SWS_Ea_00087])AUTOSAR SWS NVRAMManager 第160页。
在应用程序与 NVRAM Manager 之间的数据保存和同步方面存在两个核心概念:通过永久 RAM 块的隐式同步(NvMRamBlockDataAddress)和通过基于镜像的缓冲区的显式同步(NvMBlockUseSyncMechanism)NVDataHandling 第12页。在显式同步中,NvM 通过配置的回调例程 NvMWriteRamBlockToNvCallback 或 NvMReadRamBlockFromNvCallback 在应用程序 RAM 和内部 RAM 镜像之间复制有效负载数据([SWS_NvM_00514]、[SWS_NvM_00515])EXP NVDataHandling 第30页。
使用数据集块(NVM_BLOCK_DATASET)时,调用方预先通过 NvM_SetDataIndex 选择所需的数据集索引([SWS_NvM_00448])。抽象模块随后根据逻辑块号和索引计算 MCAL 驱动程序的精确地址偏移([SWS_NvM_00123])AUTOSAR SWS Flash EEPROM Emulation 第21页。中止请求通过 MemIf_Cancel 直接透传给子模块 Fee_Cancel 或 Ea_Cancel([SWS_MemIf_00041]、[SWS_Fee_00089])。
时序图:带回调通知和轮询的异步写作业。来源:[SWS_NvM_00455]、AUTOSAR SWS NVRAMManager 第160页
同步、重入性与任务上下文
集群的大多数控制和状态 API(包括 NvM_GetErrorStatus ([SWS_NvM_00451])、NvM_SetBlockProtection ([SWS_NvM_00450]) 和 MemIf_GetVersionInfo ([SWS_MemIf_00045]))均同步执行,并可直接在调用方的任务上下文中处理 AUTOSAR SWS NVRAMManager 第157页。与此相反,数据传输函数(NvM_ReadBlock、NvM_WriteBlock、Ea_Write)设计为异步且不可重入([SWS_MemIf_00040]、[SWS_Ea_00087])。
正在运行作业的周期性推进由调度管理器(SchM)或 BSW 任务定期调用的主函数 NvM_MainFunction 和 Fee_MainFunction 负责 AUTOSAR CP SWS FlashEEPROMEmulation 第42页。对于来自 MCAL 驱动程序的异步消息,通知 Fee_JobEndNotification 或 Fee_JobErrorNotification 可以直接在中断级别进行([SWS_Fee_00095])。这会将状态设置为 MEMIF_JOB_OK 或调用配置的通知例程([SWS_Fee_00142]、[SWS_Fee_00194])SWS FlashEEPROMEmulation 第37页。
解读:为了杜绝任务级别的 API 调用方与 MainFunctions 中的分步进一步处理之间的竞态条件,内部队列和管理属性可能通过互斥区进行保护,而 MemIf 则充当无状态转发层 AUTOSAR SWS NVRAMManager 第160页。 问题 Q-a50c3362a14b9e6d (未决)
典型的生命周期和操作模式
该集群的生命周期由 Basic Software Mode Manager(BswM)和 ECU State Manager(EcuM)紧密编排。在控制器启动期间(启动阶段),在驱动程序之后首先通过 Fee_Init 或 Ea_Init 同步初始化抽象模块([SWS_Fee_00085]、[SWS_Ea_00083]),随后通过 NvM_Init 同步初始化 NVRAM Manager([SWS_NvM_00447])AUTOSAR SWS NVRAMManager 第156页。
初始化完成后,BswM 触发多块读取操作 NvM_ReadAll,以从非易失性存储器中恢复所有标记为持久的 RAM 块([SWS_NvM_00460])ModemanagementGuide 第54页。NvM 通过回调函数 BswM_NvM_CurrentJobMode 向 BswM 报告进度和最终结果([SWS_NvM_00745]、[SWS_NvM_00888])。单块状态通过 BswM_NvM_CurrentBlockMode 进行指示([SWS_NvM_00746]、[SWS_NvM_00890])ModemanagementGuide 第28页。
在关机阶段,系统通过 NvM_WriteAll 促使将所有已更改的 RAM 块持久写回非易失性存储器([SWS_NvM_00461])。为了优化 Flash 写入周期的次数,可以通过 NvM_SetRamBlockStatus 有针对性地标记某个块是否已被修改([SWS_NvM_00453])EXP NVDataHandling 第18页。在发生过早唤醒事件时,正在进行的写入过程可以通过 NvM_CancelWriteAll 中止([SWS_NvM_00238])AUTOSAR SWS NVRAMManager 第161页。
错误处理、DET 跟踪与降级
该集群具有多级错误检测和降级概念。驱动层和抽象层出现的错误通过返回状态 MEMIF_JOB_FAILED 借助 MemIf_GetJobResult 查询,或通过 NvM_JobErrorNotification 报告([SWS_Fee_00091]、[SWS_Ea_00095])ErrorDescription 第49页。
发生读取错误时,NvM 会采用配置的恢复机制:首先执行重试(Read Retries)([SWS_NvM_00390])。如果重试失败,对于冗余块(NVM_BLOCK_REDUNDANT)将读取冗余副本([SWS_NvM_00171]、[SWS_NvM_00531])。如果在此过程中检测到冗余丢失,NvM 会将作业结果设置为 NVM_REQ_REDUNDANCY_FAILED 并向 DEM 报告生产错误 NVM_E_LOSS_OF_REDUNDANCY([SWS_NvM_00470]、[SWS_NvM_00546])ErrorDescription 第62页。
如果通过 ROM 默认值恢复成功,NvM 会报告结果 NVM_REQ_RESTORED_FROM_ROM([SWS_NvM_00470])。如果所有恢复措施均告失败,则向 DEM 报告 NVM_E_REQ_FAILED([SWS_NvM_00279]、[SWS_NvM_00288])并将查询结果设置为 NVM_REQ_NOT_OK([SWS_NvM_00451])。发生写入错误时,NvM 在中止请求之前控制写入重试(NvMMaxNumOfWriteRetries)([SWS_NvM_00168]、[SWS_NvM_00213])ErrorDescription 第56页。
本指南总结了 Memory Services 集群的核心架构、模块交互和错误机制。所有陈述均基于 AUTOSAR Classic Platform 的规范性标准。
为汽车电子控制单元提供独立于底层物理介质的非易失性数据持久化管理、完整性校验及故障恢复服务。
存储服务模块集群(NvM、MemIf、Fee、Ea)在 AUTOSAR Classic 架构中统一向上屏蔽物理存储介质差异,提供高可靠的非易失性数据读写、校验与模式管理服务MemoryAbstractionInterface 第18页[SWS_MemIf_00039]。集群在启动阶段执行 NvM_ReadAll 恢复数据,并在关机时通过 NvM_WriteAll 针对标记为修改的块进行持久化存储[SWS_NvM_00460][SWS_NvM_00461]。当遭遇物理损坏时,集群依次调用重试、冗余切换和 ROM 恢复机制,并在不可恢复故障时向 DEM 报告错误ErrorDescription 第62页[SWS_NvM_00171]。
存储服务(Memory Services)模块集群在 AUTOSAR Classic Platform 中统筹管理非易失性数据的持久化、块完整性校验与设备访问路由。该集群包含服务层的 NvM 以及硬件抽象层的 MemIf、Fee 与 Ea。NvM 为上层 SW-C 与诊断模块(如 DEM)抽象出原生块、冗余块及数据集块三种逻辑存储形态,而 MemIf 依据 DeviceIndex 将读写请求透明映射至物理 Flash 模拟层 Fee 或物理 EEPROM 抽象层 EaSWS_DiagnosticEventManager 第238页[SWS_MemIf_00039][SWS_NvM_00557]。
架构图: 存储服务模块集群分层架构及模块间调用关系。 来源: MemoryAbstractionInterface 第18页, [SWS_MemIf_00039], [SWS_Fee_00087], [SWS_Ea_00086]
各模块间的协同高度依赖排队与异步推进。用户发起异步读写(如 NvM_WriteBlock)后,NvM 在调度任务 NvM_MainFunction 中将其转化为 MemIf_Write 同步调用并转交 Fee 或 Ea 执行[SWS_NvM_00455][SWS_MemIf_00040]。执行结果可通过 MemIf_GetJobResult 轮询感知,亦可通过 Fee_JobEndNotification 等中断/底层回调通知 NvM,最终触发用户的单块或多块完成回调函数ErrorDescription 第49页[SWS_Fee_00095][SWS_NvM_00113]。
时序图: NvM异步写作业在MemIf与Fee/Ea间的调度、轮询及回调通知流程。 来源: NVDataHandling 第12页, ErrorDescription 第49页, [SWS_NvM_00455], [SWS_MemIf_00040], [SWS_Fee_00095]
在生命周期与容错恢复方面,ECU 上电由 BswM 协调启动 Fee_Init/Ea_Init 与 NvM_Init,并由 NvM_ReadAll 恢复数据;下电前触发 NvM_WriteAll 刷写变更数据ModeManagementGuide 第36页[SWS_NvM_00447][SWS_NvM_00460][SWS_NvM_00461]。若发生硬件读写失败,NvM 会自动激活重试、冗余副本回退或恢复 ROM 默认数据;针对冗余丢失上报 NVM_E_LOSS_OF_REDUNDANCY,所有降级尝试均告失败时上报 NVM_E_REQ_FAILED 至 DEMErrorDescription 第62页[SWS_NvM_00171][SWS_NvM_00470][SWS_NvM_00546]。
1. 系统架构与模块集群定位
在 AUTOSAR Classic Platform 架构中,存储服务(Memory Services)模块集群负责为应用层软件组件(SW-C)以及基础软件模块(如 DEM、BswM 等)提供统一、可靠且与底层物理存储介质无关的非易失性数据管理能力。该集群横跨服务层(Services Layer)与硬件抽象层(Hardware Abstraction Layer),由 NVRAM 管理器(NvM)、内存抽象接口(MemIf)、Flash EEPROM 模拟(Fee)以及 EEPROM 抽象(Ea)四个核心 BSW 模块协同构成,为整车电子电气架构中的配置参数、标定数据、安全密钥以及 ISO 14229(UDS)诊断事件提供持久化存储支撑SWS_DiagnosticEventManager 第238页。
各模块在分层架构中承担明确职责:位于服务层的 NvM 负责向上抽象出逻辑 NVRAM 块,管理块的生命周期、数据完整性校验(CRC)及多级恢复策略,并支持原生块(Native)、冗余块(Redundant)和数据集块(Dataset)三种存储管理类型[SWS_NvM_00557][SWS_NvM_00558][SWS_NvM_00559]。位于硬件抽象层的 MemIf 作为统一转发路由,向下屏蔽了多个底层物理驱动的存在差异,使 NvM 无需感知物理存储类型即可调用统一接口[SWS_MemIf_00039]。Fee 则在片上或片外 Flash 存储器(Fls 驱动)之上模拟出按扇区擦写的逻辑 EEPROM 块机制并管理扇区垃圾回收[SWS_Fee_00085][SWS_Fee_00095];而 Ea 则针对物理 EEPROM 设备(Eep 驱动)提供逻辑块到物理分页的线性地址映射服务[SWS_Ea_00086][SWS_Ea_00087]。
架构图: 存储服务模块集群分层架构及模块间调用关系。 来源: MemoryAbstractionInterface 第18页, [SWS_MemIf_00039], [SWS_Fee_00087], [SWS_Ea_00086]
2. 模块间协同交互与数据流路径
存储服务集群的运行时交互遵循严格的分层调用链。上层实体发起读写请求(如调用 NvM_ReadBlock 或 NvM_WriteBlock)后,NvM 在内部队列排队作业并向调用者立即返回状态[SWS_NvM_00454][SWS_NvM_00455]。随后在周期性主函数调度中,NvM 将该作业解构并调用 MemIf_Read、MemIf_Write、MemIf_Cancel 或 MemIf_InvalidateBlock 等同步分发接口[SWS_MemIf_00039][SWS_MemIf_00040][SWS_MemIf_00041][SWS_MemIf_00044]。MemIf 依据传入的 DeviceIndex 参数(推测在多驱动配置下由工具链预编译固化映射),将调用直接路由至对应的 Fee_Write 或 Ea_Write,底层模块校验当前状态为 MEMIF_IDLE 或 MEMIF_BUSY_INTERNAL 后接纳作业并转入物理驱动执行[SWS_Ea_00025][SWS_Fee_00088]。 问题 (未决)
在底层硬件驱动异步执行期间,作业完成情况的感知支持两种模式:状态轮询(Polling)机制与回调通知(Notification)机制。在轮询模式下,NvM 周期性调用 MemIf_GetJobResult 查询底层执行状态,该接口透传调用 Fee_GetJobResult 或 Eep_GetJobResult,返回 MEMIF_JOB_OK、MEMIF_JOB_PENDING、MEMIF_JOB_FAILED 等标准状态枚举SWS_FlashEEPROMEmulation 第31页[SWS_Fee_00091][SWS_MemIf_00065]。在通知模式下,硬件驱动完成操作后触发 Fee_JobEndNotification 或 Ea 的回调,进而通过 NvM_JobErrorNotification 或成功回调通知 NvM[SWS_Fee_00095][SWS_Ea_00095]ErrorDescription 第49页。最终,NvM 通过配置的 SingleBlockCallbackFunction、MultiBlockCallbackFunction 或更新 NvM_GetErrorStatus 结果通知上层用户[SWS_NvM_00113][SWS_NvM_00451]。
时序图: NvM异步写作业在MemIf与Fee/Ea间的调度、轮询及回调通知流程。 来源: NVDataHandling 第12页, ErrorDescription 第49页, [SWS_NvM_00455], [SWS_MemIf_00040], [SWS_Fee_00095]
3. 同步机制、重入性与任务上下文
为兼顾多任务访问安全性与内存资源开销,NvM 提供了两种核心 RAM 缓冲同步机制:隐式同步(Implicit Synchronization)与显式同步(Explicit Synchronization)。在隐式同步下,用户直接绑定永久 RAM 块(NvMRamBlockDataAddress,且 NvMBlockUseSyncMechanism == FALSE),读写操作直接在该应用缓冲区进行,应用层在发起作业后至作业完成通知前严禁修改该缓冲区,以杜绝数据不一致风险NVDataHandling 第32页EXP_NVDataHandling 第27页。在显式同步下(NvMBlockUseSyncMechanism == TRUE),NvM 分配一个全局 RAM Mirror 缓冲区;应用层可以在作业排队期间自由修改本地数据,仅当 NvM_MainFunction 执行到具体写入阶段时,通过调用 NvMWriteRamBlockToNvCallback 快速复制数据至 Mirror,或在读操作时通过 NvMReadRamBlockFromNvCallback 拷回应用区,大幅缩短互斥锁定窗口NVDataHandling 第12页[SWS_NvM_00455][SWS_NvM_00705]。
在任务上下文与并发控制层面,各模块的主要调度逻辑高度依赖 BSW 调度器(SchM)周期性触发的主函数:NvM_MainFunction、Fee_MainFunction 以及 Ea_MainFunction[SWS_Fee_00097]。除获取版本信息的接口(如 MemIf_GetVersionInfo、NvM_GetVersionInfo)声明为可重入外,集群中绝大多数核心数据交换与状态转换 API(如 MemIf_Read、MemIf_Write、Fee_GetJobResult、Ea_GetStatus)均为非重入(Non Reentrant)[SWS_MemIf_00039][SWS_MemIf_00045][SWS_Fee_00091][SWS_Ea_00089]。值得注意的是,驱动层的通知例程 Fee_JobEndNotification 明确允许在中断上下文(Interrupt Level)中被调用,其内部完成最小化的块状态流转后,复杂的块管理与错误处理可延后在主任务循环中展开SWS_FlashEEPROMEmulation 第37页[SWS_Fee_00095]。
4. 典型生命周期与工作模式
存储服务集群的生命周期紧密受制于 ECU 状态管理(EcuM)与模式管理(BswM)的编排。在 ECU 启动阶段(Startup Phase),BswM 规则首先确保硬件级驱动(Fls/Eep)完成初始化,随后由 EcuM 或 BswM 按顺序调用 Ea_Init 与 Fee_Init 建立抽象层状态机,最后执行 NvM_Init 将 NvM 状态由 NVM_UNINIT 迁移至 NVM_IDLEModeManagementGuide 第36页[SWS_NvM_00447][SWS_Fee_00085][SWS_Ea_00083]。紧接着,BswM 触发全局多块读取命令 NvM_ReadAll,将所有配置了启动恢复属性的 NV 块数据加载至对应的 RAM 块中[SWS_NvM_00460]。在此期间,NvM 通过 BswM_NvM_CurrentJobMode 同步作业进度,BswM 监测到 NvM_ReadAll 成功结束(NVM_REQ_OK)后,方推进 ECU 模式切换至 ECU_RUN 并启动应用层通信与 RTESWS_BSWModeManager 第75页[SWS_NvM_00888]。
在 ECU 关机与休眠准备阶段(Shutdown Phase),BswM 会调度执行 NvM_WriteAll 多块持久化写入EXP_NVDataHandling 第18页[SWS_NvM_00461]。为了显著优化关机耗时并延长物理存储介质的写入寿命,AUTOSAR 提供了脏标志检查机制:当启用 NvMSetRamBlockStatusApi 时,仅当应用层或 RTE 通过 NvM_SetRamBlockStatus 显式将块标记为 BlockChanged == TRUE 时,该块才会在 NvM_WriteAll 过程中真正触发底层物理写入NVDataHandling 第41页[SWS_NvM_00453]。若关机过程中发生唤醒事件,EcuM 可下发 NvM_CancelWriteAll 请求,NvM 与底层 MemIf_Cancel/Fee_Cancel 将协同在保障当前扇区或数据单元完整性的前提下安全中止后续排队作业,使系统迅速恢复响应能力[SWS_NvM_00019][SWS_MemIf_00041][SWS_Fee_00089]。
5. 错误处理、DEM报告与降级恢复
存储服务集群建立了自底向上的分层异常检测与多级容错恢复机制。在底层抽象层,当 Fee 或 Ea 遇到物理校验和错误、未对齐写入或硬件总线故障时,将内部作业结果置为 MEMIF_JOB_FAILED,并通过状态轮询或 NvM_JobErrorNotification 上报至 NvMErrorDescription 第40页ErrorDescription 第48页[SWS_Fee_00091][SWS_Ea_00095]。同时,在块安全校验维度,通过静态块标识检查(Static Block ID)特性可在块头部强制核对 16 位 Static Block ID,防止由于地址映射错位读取到错误的物理数据AUTOSAR_CP_SWS_NVRAMManager 第29页[SWS_NvM_00522][SWS_NvM_00523]。
当读操作发生异常时,NvM 依据配置激活分级恢复链:首先进行读取重试(Read Retry);若重试依然失败且当前块为冗余块(NVM_BLOCK_REDUNDANT),则切换读取第二份副本(Read Redundant Block)ErrorDescription 第62页[SWS_NvM_00171][SWS_NvM_00390]。一旦冗余丢失被确认(主块损坏但备用块成功),作业状态被置为 NVM_REQ_REDUNDANCY_FAILED,同时向诊断事件管理器(DEM)上报 NVM_E_LOSS_OF_REDUNDANCY 诊断事件[SWS_NvM_00470][SWS_NvM_00546]。若冗余副本亦无法读取或为原生块,NvM 尝试从 ROM/Flash 中恢复出厂默认值(Read ROM Block),作业状态标记为 NVM_REQ_RESTORED_FROM_ROM[SWS_NvM_00470]。若全部恢复手段均宣告失败,NvM 最终向 DEM 报告 NVM_E_REQ_FAILED 严重生产故障,并将块状态置为 NVM_REQ_NOT_OK 供用户查询ErrorDescription 第62页[SWS_NvM_00279][SWS_NvM_00288][SWS_NvM_00451]。而在写入失败路径中,NvM 会自增重试计数器并在不超过 NvMMaxNumOfWriteRetries 的前提下重新尝试写入,超出限额后同样向 DEM 报送 NVM_E_REQ_FAILED 终止请求ErrorDescription 第56页[SWS_NvM_00168][SWS_NvM_00213]。
本指南由人工智能基于 AUTOSAR R20-11 规范库生成,用于指导 Memory Services 模块集群的工程集成与架构设计,不可替代针对具体 ECU 硬件与功能安全等级的合规性审查。
Module im Cluster
Bulk NvData Manager (BndM)
AUTOSAR Classic Memory Services-Modul Bulk NvData Manager (BndM, Spezifikation: AUTOSAR_CP_SWS_BulkNvDataManager.pdf, AUTOSAR_SWS_BulkNvDataManager.pdf).
EEPROM Abstraction (Ea)
Provides uniform access to external and internal EEPROM devices.
EEPROM Driver (Eep)
AUTOSAR Classic Memory Drivers-Modul EEPROM Driver (Eep, Spezifikation: AUTOSAR_CP_SWS_EEPROMDriver.pdf, AUTOSAR_SWS_EEPROMDriver.pdf, AUTOSAR_SWS_EEPROM_Driver.pdf).
Flash EEPROM Emulation (Fee)
Provides emulation of EEPROM-like data blocks on Flash memory devices.
Flash Driver (Fls)
AUTOSAR Classic Memory Drivers-Modul Flash Driver (Fls, Spezifikation: AUTOSAR_CP_SWS_FlashDriver.pdf, AUTOSAR_SWS_FlashDriver.pdf).
Flash Test (FlsTst)
AUTOSAR Classic Memory Drivers-Modul Flash Test (FlsTst, Spezifikation: AUTOSAR_CP_SWS_FlashTest.pdf, AUTOSAR_SWS_FlashTest.pdf).
Memory Driver (Mem)
AUTOSAR Classic Memory Drivers-Modul Memory Driver (Mem, Spezifikation: AUTOSAR_CP_SWS_MemoryDriver.pdf, AUTOSAR_SWS_MemoryDriver.pdf).
Memory Access (MemAcc)
AUTOSAR Classic Memory HW Abstraction-Modul Memory Access (MemAcc, Spezifikation: AUTOSAR_CP_SWS_MemoryAccess.pdf, AUTOSAR_SWS_MemoryAccess.pdf).
Memory Abstraction Interface (MemIf)
Abstracts underlying Flash and EEPROM memory drivers.
NVRAM Manager (NvM)
Provides synchronous and asynchronous block-based data management for non-volatile storage (EEPROM, Flash).
RAM Test (RamTst)
AUTOSAR Classic Memory Drivers-Modul RAM Test (RamTst, Spezifikation: AUTOSAR_CP_SWS_RAMTest.pdf, AUTOSAR_SWS_RAMTest.pdf, AUTOSAR_SWS_RAM_Test.pdf).
gemini-3.8-flash-low· 2026-10-13 · 德文原文