File: nvm.h.html

package info (click to toggle)
open-plc-utils 0.0.6%2Bgit20230504.1ba7d5a0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,212 kB
  • sloc: ansic: 60,875; xml: 16,179; sh: 1,216; makefile: 698
file content (303 lines) | stat: -rw-r--r-- 11,051 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<?xml version='1.0' encoding='iso-8859-1'?>
<!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
	<head>
		<title>
			nvm.h
			</title>
		<meta http-equiv='content-type' content='text/html;iso-8859-1'/>
		<meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
		<meta name='author' content='cmaier@cmassoc.net'/>
		<meta name='robots' content='noindex,nofollow'/>
		<link href='toolkit.css' rel='stylesheet' type='text/css'/>
		</head>
	<body>
		<div class='headerlink'>
			[<a href='number.h.html' title=' number.h '>PREV</a>]
			[<a href='toolkit.html' title=' Index '>HOME</a>]
			[<a href='nvram.h.html' title=' nvram.h '>NEXT</a>]
			</div>
<pre>
/*====================================================================*
 *
 *   Copyright (c) 2013 Qualcomm Atheros, Inc.
 *
 *   All rights reserved.
 *
 *   Redistribution and use in source and binary forms, with or 
 *   without modification, are permitted (subject to the limitations 
 *   in the disclaimer below) provided that the following conditions 
 *   are met:
 *
 *   * Redistributions of source code must retain the above copyright 
 *     notice, this list of conditions and the following disclaimer.
 *
 *   * Redistributions in binary form must reproduce the above 
 *     copyright notice, this list of conditions and the following 
 *     disclaimer in the documentation and/or other materials 
 *     provided with the distribution.
 *
 *   * Neither the name of Qualcomm Atheros nor the names of 
 *     its contributors may be used to endorse or promote products 
 *     derived from this software without specific prior written 
 *     permission.
 *
 *   NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE 
 *   GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE 
 *   COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY EXPRESS OR 
 *   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 *   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
 *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 
 *   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
 *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 *   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
 *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 *   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
 *   OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 *   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
 *
 *--------------------------------------------------------------------*/

/*====================================================================*
 *
 *   nvm.h - nvm file format definitions and declarations;
 *
 *   Contributor(s):
 *      Charles Maier &lt;cmaier@qca.qualcomm.com&gt;
 *
 *--------------------------------------------------------------------*/

#ifndef NVM_HEADER
#define NVM_HEADER

/*====================================================================*
 *   system header files;
 *--------------------------------------------------------------------*/

#include &lt;unistd.h&gt;

/*====================================================================*
 *   custom header files;
 *--------------------------------------------------------------------*/

#include &quot;../tools/types.h&quot;

/*====================================================================*
 *   nvm program constants;
 *--------------------------------------------------------------------*/

#define NVM_IMAGETYPES 18
#define NVM_PLATFORMS 5

/*====================================================================*
 *   nvm program flags;
 *--------------------------------------------------------------------*/

#define NVM_SILENCE     (1 &lt;&lt; 0)
#define NVM_VERBOSE     (1 &lt;&lt; 1)
#define NVM_MANIFEST    (1 &lt;&lt; 2)
#define NVM_FIRMWARE    (1 &lt;&lt; 3)
#define NVM_IDENTITY    (1 &lt;&lt; 4)
#define NVM_SDRAM       (1 &lt;&lt; 5)

/*====================================================================*
 *   nvm header execute masks;
 *--------------------------------------------------------------------*/

#define NVM_IGNORE_MASK_INT6000         (1 &lt;&lt; 0)
#define NVM_IGNORE_MASK_INT6300         (1 &lt;&lt; 1)
#define NVM_IGNORE_MASK_INT6400         (1 &lt;&lt; 2)
#define NVM_IGNORE_MASK_AR7400          (1 &lt;&lt; 4)
#define NVM_IGNORE_MASK_QCA7420         (1 &lt;&lt; 8)

/*====================================================================*
 *   image chain types;
 *--------------------------------------------------------------------*/

#define NVM_CHAIN_SOFTLOADER            0
#define NVM_CHAIN_FIRMWARE              1
#define NVM_CHAIN_PIB                   2
#define NVM_CHAIN_CUSTOM_MODULE         3
#define NVM_CHAIN_MODULE_OP_SESSION     4

/*====================================================================*
 *   nvm build types;
 *--------------------------------------------------------------------*/

#define NVM_BUILD_NIGHTLY               0
#define NVM_BUILD_RELEASE               1
#define NVM_BUILD_CUSTOM                2

/*====================================================================*
 *   nvm image types;
 *--------------------------------------------------------------------*/

#define NVM_IMAGE_GENERIC               0x0000
#define NVM_IMAGE_CONFIG_SYNOPSIS       0x0001
#define NVM_IMAGE_CONFIG_DENALI         0x0002
#define NVM_IMAGE_APPLET_DENALI         0x0003
#define NVM_IMAGE_FIRMWARE              0x0004
#define NVM_IMAGE_OASCLIENT             0x0005
#define NVM_IMAGE_CUSTOM                0x0006
#define NVM_IMAGE_MEMCTL                0x0007
#define NVM_IMAGE_ADVPWRMGMT            0x0008
#define NVM_IMAGE_OAS_CLIENT_IP_STK     0x0009
#define NVM_IMAGE_OAS_CLIENT_TR069      0x000A
#define NVM_IMAGE_NVM_SOFTLOADER        0x000B
#define NVM_IMAGE_FLASH_LAYOUT          0x000C
#define NVM_IMAGE_MANIFEST              0x000E
#define NVM_IMAGE_PIB                   0x000F

/*====================================================================*
 *   manifest field types;
 *--------------------------------------------------------------------*/

#define NVM_FIELD_SIGNATURE             0
#define NVM_FIELD_HARDWARE_COMPAT       1
#define NVM_FIELD_CHAIN_MAJOR_VERSION   2
#define NVM_FIELD_CHAIN_MINOR_VERSION   3
#define NVM_FIELD_CHAIN_TYPE            4
#define NVM_FIELD_BUILD_MAJOR_VERSION   5
#define NVM_FIELD_BUILD_MINOR_VERSION   6
#define NVM_FIELD_BUILD_TYPE            7
#define NVM_FIELD_MANIFEST_VERSION      8
#define NVM_FIELD_BUILD_NUMBER          9
#define NVM_FIELD_BUILD_DATE            10
#define NVM_FIELD_BUILD_TIME            11
#define NVM_FIELD_DEVICE_TYPE           12
#define NVM_FIELD_BUILD_HOSTNAME        13
#define NVM_FIELD_BUILD_USERNAME        14
#define NVM_FIELD_BUILD_DESCRIPTION     15
#define NVM_FIELD_BUILD_VERSION_STRING  16
#define NVM_FIELD_BUILD_SUSTAINING_RELEASE 17
#define NVM_FIELD_BUILD_MAJOR_SUBVERSION 18
#define NVM_FIELD_GENERIC_ID0           19
#define NVM_FIELD_GENERIC_ID1           20
#define NVM_FIELD_SL_MAJOR_VERSION      21
#define NVM_FIELD_SL_MINOR_VERSION      22
#define NVM_FIELD_FREE_SPACE            23

/*====================================================================*
 *   toolkit nvm error messages;
 *--------------------------------------------------------------------*/

#define NVM_HDR_VERSION &quot;%s found bad NVM header version in %s module %d&quot;, __func__
#define NVM_HDR_CHECKSUM &quot;%s found bad NVM header checksum in %s module %d&quot;, __func__
#define NVM_HDR_LINK &quot;%s found bad NVM header link in %s module %d&quot;, __func__
#define NVM_IMG_CHECKSUM &quot;%s found bad image checksum in %s module %d&quot;, __func__
#define NVM_HDR_CANTREAD &quot;%s can't read image header in %s module %d&quot;, __func__
#define NVM_HDR_CANTSAVE &quot;%s can't save image header in %s module %d&quot;, __func__
#define NVM_IMG_CANTREAD &quot;%s can't read image in %s module %d&quot;, __func__
#define NVM_IMG_CANTSAVE &quot;%s can't save image in %s module %d&quot;, __func__
#define NVM_IMG_RUN &quot;%s applet %d is still running&quot;

/*====================================================================*
 *   old nvm image header (44 bytes);
 *--------------------------------------------------------------------*/

#ifndef __GNUC__
#pragma pack (push,1)
#endif

typedef struct __packed nvm_header1

{
	uint32_t HEADERVERSION;
	uint32_t IMAGEROMADDR;
	uint32_t IMAGEADDRESS;
	uint32_t IMAGELENGTH;
	uint32_t IMAGECHECKSUM;
	uint32_t ENTRYPOINT;
	uint8_t HEADERMINORVERSION;
	uint8_t IMAGETYPE;
	uint16_t IGNOREMASK;
	uint32_t MODULEID;
	uint32_t MODULESUBID;
	uint32_t NEXTHEADER;
	uint32_t HEADERCHECKSUM;
}

nvm_header1;

#ifndef __GNUC__
#pragma pack (pop)
#endif

/*====================================================================*
 *   new nvm image header (96 bytes);
 *--------------------------------------------------------------------*/

#ifndef __GNUC__
#pragma pack (push,1)
#endif

typedef struct __packed nvm_header2

{
	uint16_t MajorVersion;
	uint16_t MinorVersion;
	uint32_t ExecuteMask;
	uint32_t ImageNvmAddress;
	uint32_t ImageAddress;
	uint32_t ImageLength;
	uint32_t ImageChecksum;
	uint32_t EntryPoint;
	uint32_t NextHeader;
	uint32_t PrevHeader;
	uint32_t ImageType;
	uint16_t ModuleID;
	uint16_t ModuleSubID;
	uint16_t AppletEntryVersion;
	uint16_t Reserved0;
	uint32_t Reserved1;
	uint32_t Reserved2;
	uint32_t Reserved3;
	uint32_t Reserved4;
	uint32_t Reserved5;
	uint32_t Reserved6;
	uint32_t Reserved7;
	uint32_t Reserved8;
	uint32_t Reserved9;
	uint32_t Reserved10;
	uint32_t Reserved11;
	uint32_t HeaderChecksum;
}

nvm_header2;

#ifndef __GNUC__
#pragma pack (pop)
#endif

/*====================================================================*
 *   nvm functions;
 *--------------------------------------------------------------------*/

signed manifest (void const * memory, size_t extent);
void * manifetch (void const * memory, size_t extent, uint32_t type);
signed nvmfile (struct _file_ const *);
signed nvmfile1 (struct _file_ const *);
signed nvmfile2 (struct _file_ const *);
signed fdmanifest (signed fd, char const * filename, struct nvm_header2 *, unsigned module);
signed nvmseek1 (signed fd, char const * filename, struct nvm_header1 *, uint32_t imagetype);
signed nvmseek2 (signed fd, char const * filename, struct nvm_header2 *, uint32_t imagetype);
void nvmpeek (void const *);
void nvmpeek1 (void const *);
void nvmpeek2 (void const *);

/*====================================================================*
 *
 *--------------------------------------------------------------------*/

#endif


</pre>
		<div class='footerlink'>
			[<a href='number.h.html' title=' number.h '>PREV</a>]
			[<a href='toolkit.html' title=' Index '>HOME</a>]
			[<a href='nvram.h.html' title=' nvram.h '>NEXT</a>]
			</div>
		</body>
	</html>