blob: b75a563ffeeac2d696c36547eb8bf93225352c14 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/***********************************************************************
2* Copyright (C) 2016, ZTE Corporation.
3*
4* File Name: nvparam_drv.h
5* File Mark:
6* Description:
7* Others:
8* Version: v1.0
9* Author: wangxia
10* Date: 2016-03-12
11*
12* History 1:
13* Date:
14* Version:
15* Author:
16* Modification:
17* History 2:
18**********************************************************************/
19#ifndef NVPARAM_DRV_H
20#define NVPARAM_DRV_H
21
22/**************************************************************************
23 * Include files *
24 **************************************************************************/
25#include "RWNvConfig.h"
26#include "NvParam_tsc.h"
27/**************************************************************************
28 * Macro *
29 **************************************************************************/
30#define DRV_NV_ADDR OS_FLASH_DRV_RW_NONFAC_BASE_ADDR
31#define DRV_NV_SIZE OS_FLASH_DRV_RW_NONFAC_SIZE /*16K*/
32
33/*=====================================================================================================================
34|----------------|----------------|---------------|--------------|----------------|-----------------|-----------------|
35| public(256B) | system(3K) | platfor(3K) | highspeed(4K)| peripheral(3K) | audio(1K) | reserved(1.75K) |
36|----------------|----------------|---------------|--------------|----------------|-----------------|-----------------|
37=======================================================================================================================*/
38
39#define DRV_PUB_NV_ADDR DRV_NV_ADDR
40#define DRV_PUB_NV_SIZE (256)
41#define DRV_SYS_NV_ADDR (DRV_PUB_NV_ADDR + DRV_PUB_NV_SIZE)
42#define DRV_SYS_NV_SIZE (3 * 1024)
43#define DRV_PLAT_NV_ADDR (DRV_SYS_NV_ADDR + DRV_SYS_NV_SIZE)
44#define DRV_PLAT_NV_SIZE (3 * 1024)
45#define DRV_HS_PERI_NV_ADDR (DRV_PLAT_NV_ADDR + DRV_PLAT_NV_SIZE)
46#define DRV_HS_PERI_NV_SIZE (4 * 1024)
47#define DRV_PERI_NV_ADDR (DRV_HS_PERI_NV_ADDR + DRV_HS_PERI_NV_SIZE)
48#define DRV_PERI_NV_SIZE (3 * 1024)
49#define DRV_AUDIO_NV_ADDR (DRV_PERI_NV_ADDR + DRV_PERI_NV_SIZE)
50#define DRV_AUDIO_NV_SIZE (1 * 1024)
51#define DRV_RSVD_NV_ADDR (DRV_AUDIO_NV_ADDR + DRV_AUDIO_NV_SIZE)
52#define DRV_RSVD_NV_SIZE (1 * 1024 + 768)
53
54#define DRV_TOTAL_NV_SIZE (DRV_PUB_NV_SIZE+DRV_SYS_NV_SIZE+DRV_PLAT_NV_SIZE+DRV_HS_PERI_NV_SIZE+DRV_PERI_NV_SIZE+DRV_AUDIO_NV_SIZE+DRV_RSVD_NV_SIZE)
55
56/* user interface */
57#define DRV_PUB_NV_ITEM_ADDR(x) (DRV_PUB_NV_ADDR + (UINT32)(&(((T_ZDrvNv_PubData*)(0x0))->x)))
58#define DRV_PUB_NV_ITEM_SIZE(x) (sizeof(((T_ZDrvNv_PubData*)(0x0))->x))
59
60#define DRV_SYS_NV_ITEM_ADDR(x) (DRV_SYS_NV_ADDR + (UINT32)(&(((T_ZDrvNv_SysData*)(0x0))->x)))
61#define DRV_SYS_NV_ITEM_SIZE(x) (sizeof(((T_ZDrvNv_SysData*)(0x0))->x))
62
63#define DRV_PLAT_NV_ITEM_ADDR(x) (DRV_PLAT_NV_ADDR + (UINT32)(&(((T_ZDrvNv_PlatData*)(0x0))->x)))
64#define DRV_PLAT_NV_ITEM_SIZE(x) (sizeof(((T_ZDrvNv_PlatData*)(0x0))->x))
65
66#define DRV_HS_PERI_NV_ITEM_ADDR(x) (DRV_HS_PERI_NV_ADDR + (UINT32)(&(((T_ZDrvNv_HSPeriData*)(0x0))->x)))
67#define DDRV_HS_PER_NV_ITEM_SIZE(x) (sizeof(((T_ZDrvNv_HSPeriData*)(0x0))->x))
68
69#define DRV_PER_NV_ITEM_ADDR(x) (DRV_PERI_NV_ADDR + (UINT32)(&(((T_ZDrvNv_PeriData*)(0x0))->x)))
70#define DRV_PER_NV_ITEM_SIZE(x) (sizeof(((T_ZDrvNv_PeriData*)(0x0))->x))
71
72#define DRV_AUDIO_NV_ITEM_ADDR(x) (DRV_AUDIO_NV_ADDR + (UINT32)(&(((T_ZDrvNv_AudioData*)(0x0))->x)))
73#define DRV_AUDIO_NV_ITEM_SIZE(x) (sizeof(((T_ZDrvNv_AudioData*)(0x0))->x))
74
75#define OS_FLASH_VOICE_DRV_RW_NONFAC_BASE_ADDR (OS_FLASH_DRV_RW_NONFAC_BASE_ADDR + 15360)
76#define OS_FLASH_VOICE_DRV_NONFAC_SIZE 1024
77
78#if DRV_TOTAL_NV_SIZE > (OS_FLASH_DRV_RW_NONFAC_SIZE)
79#error "error drv nv config!!!"
80#endif
81
82/****************************************************************************
83* Types
84****************************************************************************/
85
86
87/******************************************************
88* Drv NV Config
89******************************************************/
90/***********************************
911. public nv_data
92************************************/
93typedef struct _T_ZDrvNv_PubData
94{
95 /* 0x00 */ CHAR chipName[16];
96 /* 0x10 */ CHAR prjName[16];
97 /* 0x20 */ CHAR externalVer[16];
98 /* 0x30 */ CHAR internalVer[16];
99 /* 0x40 */ CHAR releaseTime[16];
100 /* 0x50 */ UINT8 productType;
101 /* 0x51 */ UINT8 reserved[DRV_PUB_NV_SIZE - 0x51];
102} __attribute__ ((packed)) T_ZDrvNv_PubData;
103
104/***********************************
1052. system group nv_data
106************************************/
107typedef struct _T_ZDrvNv_SysData
108{
109 /* 0x000 */ T_SYS_NV_TSC_CONFIG tsc_config;
110 UINT8 reserved0[12];
111 /* 0x70 */ UINT32 buck1OnoffFlag;
112 /* 0x74 */ UINT32 wdtSwitch;
113 /* 0x78 */ UINT32 wdtPriority;
114 /* 0x7C */ UINT8 uiccmodeSwitch;
115 /* 0x7D */ UINT8 uiccPreSwitch;
116 /* 0x7E */ UINT8 uicc1modeSwitch;
117 /* 0x7F */ UINT8 uicc1PreSwitch;
118 UINT8 reserved[DRV_SYS_NV_SIZE - 124 - 4];
119} __attribute__ ((packed)) T_ZDrvNv_SysData;
120
121/***********************************
1223. platform group nv_data
123************************************/
124typedef struct _T_ZDrvNv_PlatData
125{
126 UINT8 reserved[DRV_PLAT_NV_SIZE];
127} __attribute__ ((packed)) T_ZDrvNv_PlatData;
128
129/***********************************
1304. hign-speed peripheral group nv_data
131************************************/
132typedef struct _T_ZDrvNv_HSPeriData
133{
134 UINT8 reserved[DRV_HS_PERI_NV_SIZE];
135} __attribute__ ((packed)) T_ZDrvNv_HSPeriData;
136
137/***********************************
1385. common peripheral group nv_data
139************************************/
140typedef struct _T_ZDrvNv_PeriData
141{
142 UINT8 bat_det;
143 UINT8 reserved[DRV_PERI_NV_SIZE-1];
144} __attribute__ ((packed)) T_ZDrvNv_PeriData;
145
146/***********************************
1476. audio group nv_data
148************************************/
149typedef struct _T_ZDrvNv_AudioData
150{
151 UINT8 reserved[DRV_AUDIO_NV_SIZE];
152} __attribute__ ((packed)) T_ZDrvNv_AudioData;
153
154/***********************************
1557. all driver_used nv_data
156************************************/
157typedef struct _T_ZDrv_NvData
158{
159 /* 0x0000 */ T_ZDrvNv_PubData pubData;
160 /* 0x0100 */ T_ZDrvNv_SysData sysData;
161 /* 0x0D00 */ T_ZDrvNv_PlatData platData;
162 /* 0x1900 */ T_ZDrvNv_HSPeriData HSPeriData;
163 /* 0x2900 */ T_ZDrvNv_PeriData periData;
164 /* 0x3500 */ T_ZDrvNv_AudioData audioData;
165 /* 0x3900 */ UINT8 reserved[DRV_RSVD_NV_SIZE];
166} T_ZDrv_NvData;
167
168
169/******************************************************
170* check struct size
171******************************************************/
172static inline CHAR zDrvNv_CheckTypeSize(void)
173{ \
174 CHAR __dummy1[(sizeof(T_ZDrv_NvData)==DRV_NV_SIZE)?1:-1]={0}; \
175 CHAR __dummy2[(sizeof(T_ZDrvNv_PubData)==DRV_PUB_NV_SIZE)?1:-1]={0}; \
176 CHAR __dummy3[(sizeof(T_ZDrvNv_SysData)==DRV_SYS_NV_SIZE)?1:-1]={0}; \
177 CHAR __dummy4[(sizeof(T_ZDrvNv_PlatData)==DRV_PLAT_NV_SIZE)?1:-1]={0}; \
178 CHAR __dummy5[(sizeof(T_ZDrvNv_HSPeriData)==DRV_HS_PERI_NV_SIZE)?1:-1]={0}; \
179 CHAR __dummy6[(sizeof(T_ZDrvNv_PeriData)==DRV_PERI_NV_SIZE)?1:-1]={0}; \
180 CHAR __dummy7[(sizeof(T_ZDrvNv_AudioData)==DRV_AUDIO_NV_SIZE)?1:-1]={0}; \
181 return (__dummy1[0]+__dummy2[0]+__dummy3[0]+__dummy4[0]+__dummy5[0]+__dummy6[0]+__dummy7[0]); \
182}
183
184/******************************************************
185* old struct
186******************************************************/
187#if 0
188typedef struct _T_Sys_Drv_Nv_Data
189{
190 T_SYS_NV_TSC_CONFIG tsc_config;
191 UINT8 reserved[6];
192 UINT32 wdtSwitch;
193}T_Sys_Drv_Nv_Data;
194#endif
195typedef struct _T_Drv_Nv_Data
196{
197 UINT32 VpData[1024];//add by lvwenhua for voice 2013.12.6
198}T_Drv_Nv_Data;
199
200#define DRV_NV_ITEM_ADDRESS(x) (DRV_AUDIO_NV_ADDR + (UINT32)(&(((T_Drv_Nv_Data*)(0x0))->x)))
201//flag use 32byte
202typedef struct _T_Audio_NvFlag
203{
204 UINT8 isVpConfigInitOn;
205 UINT8 isVpParamInNv;
206 UINT8 isUseSlicCodec;
207 UINT8 isUseVoiceProc;//UINT8 isUseNXP;
208 UINT8 isUseCodecDsp;
209 UINT8 isUseNvWrite;
210 UINT8 isCloseVpBufferBak;
211 UINT8 isUseTdm;
212 UINT8 isUseRxDtmfDet;
213 UINT8 isUseTxDtmfDet;
214 UINT8 isUseRxMixData;
215 UINT8 isUseTxMixData;//12¸öflag
216 UINT8 reserved[20];//32-12
217
218} T_Audio_NvFlag;
219
220#endif
221