AUTOSAR —— NVM 4

本文根據AUTOSAR4.4(Classic Platform)(https://www.autosar.org/standards/classic-platform/classic-platform-440/)標準中的 :

AUTOSAR_SRS_MemoryServices.pdf

AUTOSAR_SWS_NVRAMManager.pdf

兩篇文章整理。僅爲個人理解,不當之處,還請指正,感謝!

 

目錄

8 API specification

8.1 About types

8.1.1 Imported types

8.1.2 Type Definitions

8.2 Function Definitions

8.2.1 API Overview

8.2.2 Expected Interface

         8.2.2.1 Mandatory Interfaces

         8.2.2.2 Optional Interfaces

         8.2.2.3 Configurable interfaces

8.3 Service Interfaces

8.3.1 Client-Server-Interfaces

8.3.2 Port


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可以分爲:

  1. Synchronous OR Asynchorous;
  2. 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類:

  1. 單塊請求結果通知的callback:
    • NvM_JobEndNotification();
    • NvM_JobErrorNotification(); 
  2. 多塊請求的callback;
    • NvM_MultiBlockCallbackFunction():名稱可以用戶自定義;
  3. 用作NvM Bloc 恢復數據的 callback:也是一種單塊callback;
    • NvM_InitBlockCallbackFunction()
  4. 顯示同步中的callback:
    • NvM_WriteRamBlockToNvm();
    • NvM_ReadRamBlockFromNvm();

 

8.3 Service Interfaces
 

BSW 和 RTE 之間的通信是通過Service port。本節主要描述NvM 模塊的 service port。

8.3.1 Client-Server-Interfaces

  1. NvM_Admin:對應的操作爲:SetBlockProtection;
  2. NvM_Mirror:對應的操作爲:
    1. ReadRamBlockFromNvM;   
    2. WriteRamBlockToNvM;
  3. NvM_NotifyInitBlock:對應的操作爲:InitBlock
  4. NvM_NotifyJobFinished :對應的操作爲:JobFinished
  5. NvM_Service:對應的操作爲:除以上請求之外的其他單塊請求。

8.3.2 Port

  1. NvM_PAdmin_{Block}
  2. NvM_PM_{Block}
  3. NvM_PNIB_{Block}
  4. NvM_PNJF_{Block}
  5. NvM_PS_{Block}
     

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章