58 lines
954 B
C
58 lines
954 B
C
|
#ifndef _UDS_NVM_H
|
||
|
#define _UDS_NVM_H
|
||
|
|
||
|
#include "sys.h"
|
||
|
#include "uds_did.h"
|
||
|
#include "uds_dtc.h"
|
||
|
|
||
|
|
||
|
|
||
|
#define NVM_SIZE (512u)
|
||
|
#define NVM_ADDR_STR ((u32)&NvmImage)
|
||
|
#define NVM_ADDR_END (NVM_ADDR_STR+NVM_SIZE)
|
||
|
|
||
|
#define SIZE_UDS (NVM_SIZE)
|
||
|
#define NVM_IMAGE_DTC_ADDR ((uint8_t*)&NvmImage.UDS.DTCs)
|
||
|
#define NVM_IMAGE_DID_ADDR ((uint8_t*)&NvmImage.UDS.DIDs)
|
||
|
|
||
|
#define NVM_ADDRESS_START 0
|
||
|
|
||
|
|
||
|
typedef struct {
|
||
|
DTC_StatusType DTC_Status;
|
||
|
}DTCS_NvmType;
|
||
|
|
||
|
typedef union
|
||
|
{
|
||
|
struct {
|
||
|
DIDS_NvmType DIDs;
|
||
|
DTCS_NvmType DTCs;
|
||
|
uint8_t reverse;
|
||
|
};
|
||
|
uint8_t UDS_Data[SIZE_UDS];
|
||
|
|
||
|
}NvmData_UDS_t;
|
||
|
|
||
|
typedef union
|
||
|
{
|
||
|
u8 D8[NVM_SIZE];
|
||
|
u32 D32[NVM_SIZE>>2];
|
||
|
|
||
|
struct
|
||
|
{
|
||
|
NvmData_UDS_t UDS;
|
||
|
};
|
||
|
|
||
|
}NvmImage_t;
|
||
|
|
||
|
|
||
|
extern NvmImage_t NvmImage;
|
||
|
#define pNvmImage ((NvmImage_t *)&NvmImage)
|
||
|
|
||
|
void NVM_Init(void);
|
||
|
int32_t uds_service_nvm_write(u8 *pImage, const u8 *pData, u32 Len, void (*pCbFn)(u32));
|
||
|
|
||
|
|
||
|
#endif
|
||
|
|