SmartSnippets DA1459x SDK
ad_nvparam_defs.h
Go to the documentation of this file.
1 
34 /*
35  * DO NOT MODIFY THIS FILE!!!
36  *
37  * NV-Parameters configuration shall be done in platform_nvparam.h!!!
38  *
39  */
40 
41 #ifndef AD_NVPARAM_DEFS_H_
42 #define AD_NVPARAM_DEFS_H_
43 
44 #ifndef IN_AD_NVPARAM_C
45 
46 /*
47  * If this is included outside of ad_nvparam.c, we just define empty macros so nothing but tag
48  * definitions are created from platform_nvparam.h
49  */
50 
51 #define NVPARAM_AREA(NAME, PARTITION, OFFSET)
52 #define NVPARAM_PARAM(TAG, OFFSET, LENGTH)
53 #define NVPARAM_VARPARAM(TAG, OFFSET, LENGTH)
54 #define NVPARAM_AREA_END()
55 
56 #else
57 
58 /*
59  * If this is included inside of ad_nvparam.c, we will create proper configuration structure.
60  */
61 
62 /*
63  * First we create configurations of each area - this will create "area_XXX" symbol for each defined
64  * area in platform_nvparam.h. It contains all parameters defined for given area.
65  */
66 
67 #define NVPARAM_AREA(NAME, PARTITION, OFFSET) \
68  static const parameter_t area_ ## NAME[] = {
69 #define NVPARAM_PARAM(TAG, OFFSET, LENGTH) \
70  { \
71  .tag = TAG, \
72  .offset = OFFSET, \
73  .length = LENGTH, \
74  },
75 #define NVPARAM_VARPARAM(TAG, OFFSET, LENGTH) \
76  { \
77  .tag = TAG, \
78  .flags = FLAG_VARIABLE_LEN, \
79  .offset = OFFSET, \
80  .length = LENGTH, \
81  },
82 #define NVPARAM_AREA_END() \
83  };
84 
85 #undef PLATFORM_NVPARAM_H_
86 #if (dg_configNVPARAM_APP_AREA == 1)
87  #undef APP_NVPARAM_H_
88  #include "app_nvparam.h"
89 #else
90  #include "platform_nvparam.h"
91 #endif
92 
93 /*
94  * Next, using the same platform_nvparam.h, we define list of areas. Each has proper attributes set
95  * and pointer to corresponding area structure.
96  */
97 
98 #undef NVPARAM_AREA
99 #undef NVPARAM_PARAM
100 #undef NVPARAM_VARPARAM
101 #undef NVPARAM_AREA_END
102 #define NVPARAM_AREA(NAME, PARTITION, OFFSET) \
103  { \
104  .name = #NAME, \
105  .partition = PARTITION, \
106  .offset = OFFSET, \
107  .parameters = area_ ## NAME, \
108  .num_parameters = sizeof(area_ ## NAME) / sizeof(area_ ## NAME[0]), \
109  },
110 #define NVPARAM_PARAM(TAG, OFFSET, LENGTH)
111 #define NVPARAM_VARPARAM(TAG, OFFSET, LENGTH)
112 #define NVPARAM_AREA_END()
113 
114 static const area_t areas[] = {
115 #undef PLATFORM_NVPARAM_H_
116 #if (dg_configNVPARAM_APP_AREA == 1)
117  #undef APP_NVPARAM_H_
118  #include "app_nvparam.h"
119 #else
120  #include "platform_nvparam.h"
121 #endif
122 };
123 
124 #define num_areas (sizeof(areas) / sizeof(areas[0]))
125 
126 #endif /* IN_AD_NVPARAM_C */
127 
128 #endif /* AD_NVPARAM_DEFS_H_ */
platform_nvparam.h
Configuration of non-volatile parameters on platform.