本文根据AUTOSAR4.4(Classic Platform)(https://www.autosar.org/standards/classic-platform/classic-platform-440/)标准中的 :
AUTOSAR_SRS_MemoryServices.pdf
AUTOSAR_SWS_NVRAMManager.pdf
两篇文章整理。仅为个人理解,不当之处,还请指正,感谢!
目录
8.2.2.3 Configurable interfaces
8.3.1 Client-Server-Interfaces
8 API specification
8.1 About types
8.1.1 Imported types
从其他模块引入的类型包括:
8.1.2 Type Definitions
8.1.2.1 NvM_ConfigType
该类型仅用作合规(NvM_Init 有一个指向该类型的指针参数),它对NvM 模块没有任何作用。具体实现由开发人员自己定义,
8.1.2.2 NvM_MultiBlockRequestType
8.2 Function Definitions
8.2.1 API Overview
按照不同的分类方式,NvM 的API可以分为:
- Synchronous OR Asynchorous;
- Single-block OR Multi-block;;
从文档目录可以直观的看到NvM 模块的API的类型。
每个API的函数原型,入参,返回值及调用模块等标准文档中均有详细说明,这里不再赘述。
8.2.2 Expected Interface
本模块列明其他模块需要的接口。
8.2.2.1 Mandatory Interfaces
下面列明了 NvM 层会调用的MemIf层的所有接口。
| API function | Header File |
Description |
| MemIf_Cancel | MemIf.h | Invokes the "Cancel" function of the underlying memory abstraction module selected by the parameter DeviceIndex. |
| MemIf_EraseImmediateBlock | MemIf.h | Invokes the "EraseImmediateBlock" function of the underlying memory abstraction module selected by the parameter DeviceIndex. |
| MemIf_GetJobResult | MemIf.h | Invokes the "GetJobResult" function of the underlying memory abstraction module selected by the parameter DeviceIndex. |
| MemIf_GetStatus | MemIf.h | Invokes the "GetStatus" function of the underlying memory abstraction module selected by the parameter DeviceIndex. |
| MemIf_InvalidateBlock | MemIf.h | Invokes the "InvalidateBlock" function of the underlying memory abstraction module selected by the parameter DeviceIndex. |
| MemIf_Read | MemIf.h | Invokes the "Read" function of the underlying memory abstraction module selected by the parameter DeviceIndex. |
| MemIf_Write | MemIf.h | Invokes the "Write" function of the underlying memory abstraction module selected by the parameter DeviceIndex. |
8.2.2.2 Optional Interfaces
| API function | Header File |
Description |
| Crc_CalculateCRC16 | Crc.h | This service makes a CRC16 calculation on Crc_Length data bytes. |
| Crc_CalculateCRC32 | Crc.h | This service makes a CRC32 calculation on Crc_Length data bytes. |
| Crc_CalculateCRC8 | Crc.h | This service makes a CRC8 calculation on Crc_Length data bytes, with SAE J1850 parameters |
| Dem_SetEventStatus | Dem.h | Called by SW-Cs or BSW modules to report monitor status information to the Dem. BSW modules calling Dem_SetEventStatus can safely ignore the return value. |
| Det_ReportError | Det.h | Service to report development errors. |
| MemIf_SetMode | MemIf.h | Invokes the "SetMode" functions of all underlying memory abstraction modules. |
8.2.2.3 Configurable interfaces
配置接口主要是指NvM模块会用到的 callback 函数,这些callback都是可以配置。用户可以通过配置与否来决定是否使用这些callback。
这里的callback包括3类:
- 单块请求结果通知的callback:
- NvM_JobEndNotification();
- NvM_JobErrorNotification();
- 多块请求的callback;
- NvM_MultiBlockCallbackFunction():名称可以用户自定义;
- 用作NvM Bloc 恢复数据的 callback:也是一种单块callback;
- NvM_InitBlockCallbackFunction()
- 显示同步中的callback:
- NvM_WriteRamBlockToNvm();
- NvM_ReadRamBlockFromNvm();
8.3 Service Interfaces
BSW 和 RTE 之间的通信是通过Service port。本节主要描述NvM 模块的 service port。
8.3.1 Client-Server-Interfaces
- NvM_Admin:对应的操作为:SetBlockProtection;
- NvM_Mirror:对应的操作为:
- ReadRamBlockFromNvM;
- WriteRamBlockToNvM;
- NvM_NotifyInitBlock:对应的操作为:InitBlock
- NvM_NotifyJobFinished :对应的操作为:JobFinished
- NvM_Service:对应的操作为:除以上请求之外的其他单块请求。
8.3.2 Port
- NvM_PAdmin_{Block}
- NvM_PM_{Block}
- NvM_PNIB_{Block}
- NvM_PNJF_{Block}
- NvM_PS_{Block}