Blame view

HDFwear/3rd/RTKOTASDK/RTKOTASDK.framework/Headers/RTKOTAFormat.h 8.01 KB
75d24c15   yangbin   123
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
  
  //
  //  RTKOTAFormat.h
  //  RTKLEFoundation
  //
  //  Created by jerome_gu on 2019/1/28.
  //  Copyright © 2019 Realtek. All rights reserved.
  //
  
  #ifndef RTKOTAFileFormat_h
  #define RTKOTAFileFormat_h
  
  
  typedef NS_ENUM(NSUInteger, RTKOTAImageType) {
      RTKOTAImageType_Unknown = 0,
      
      // Bee
      RTKOTAImageType_Bee_Patch                       = 0x01<<0,
      RTKOTAImageType_Bee_AppBank0                    = 0x01<<1,
      RTKOTAImageType_Bee_AppBank1                    = 0x01<<2,
      RTKOTAImageType_Bee_Data                        = 0x01<<3,
      RTKOTAImageType_Bee_PatchExt                    = 0x01<<4,
      RTKOTAImageType_Bee_Config                      = 0x01<<6,
      
      // Bee 2
      RTKOTAImageType_Bee2_SOCV_CFG                   = 0x01<<0,
      RTKOTAImageType_Bee2_SystemConfig               = 0x01<<1,
      RTKOTAImageType_Bee2_OTAHeader                  = 0x01<<2,
      RTKOTAImageType_Bee2_Secure_Boot_Loader         = 0x01<<3,
      RTKOTAImageType_Bee2_ROM_PATCH                  = 0x01<<4,
      RTKOTAImageType_Bee2_APP_IMG                    = 0x01<<5,
      RTKOTAImageType_Bee2_APP_DATA1                  = 0x01<<6,
      RTKOTAImageType_Bee2_APP_DATA2                  = 0x01<<7,
      RTKOTAImageType_Bee2_APP_DATA3                  = 0x01<<8,
      RTKOTAImageType_Bee2_APP_DATA4                  = 0x01<<9,
      RTKOTAImageType_Bee2_APP_DATA5                  = 0x01<<10,
      RTKOTAImageType_Bee2_APP_DATA6                  = 0x01<<11,
      RTKOTAImageType_Bee2_APP_DATA7                  = 0x01<<12,
      RTKOTAImageType_Bee2_APP_DATA8                  = 0x01<<13,
      RTKOTAImageType_Bee2_APP_DATA9                  = 0x01<<14,
      RTKOTAImageType_Bee2_APP_DATA10                 = 0x01<<15,
      
      // SBee 2 (Bee3)
      RTKOTAImageType_SBee2_SOCV_CFG                   = 0x01<<0,
      RTKOTAImageType_SBee2_SystemConfig               = 0x01<<1,
      RTKOTAImageType_SBee2_OTAHeader                  = 0x01<<2,
      RTKOTAImageType_SBee2_Secure_Boot_Loader         = 0x01<<3,
      RTKOTAImageType_SBee2_ROM_PATCH                  = 0x01<<4,
      RTKOTAImageType_SBee2_APP_IMG                    = 0x01<<5,
      RTKOTAImageType_SBee2_APP_DATA1                  = 0x01<<6,
      RTKOTAImageType_SBee2_APP_DATA2                  = 0x01<<7,
      RTKOTAImageType_SBee2_APP_DATA3                  = 0x01<<8,
      RTKOTAImageType_SBee2_APP_DATA4                  = 0x01<<9,
      RTKOTAImageType_SBee2_APP_DATA5                  = 0x01<<10,
      RTKOTAImageType_SBee2_APP_DATA6                  = 0x01<<11,
      RTKOTAImageType_SBee2_UPPERSTACK                 = 0x01<<12,
      RTKOTAImageType_SBee2_APP_DATA8                  = 0x01<<13,
      RTKOTAImageType_SBee2_APP_DATA9                  = 0x01<<14,
      RTKOTAImageType_SBee2_APP_DATA10                 = 0x01<<15,
      
      // BBpro (BBLite, BBpro 2 including)
      RTKOTAImageType_BBpro_SOCV_CFG                  = 0x01<<0,
      RTKOTAImageType_BBpro_SystemConfig              = 0x01<<1,
      RTKOTAImageType_BBpro_OTAHeader                 = 0x01<<2,
      RTKOTAImageType_BBpro_Secure_Boot_Loader        = 0x01<<3,
      RTKOTAImageType_BBpro_ROM_PATCH                 = 0x01<<4,
      RTKOTAImageType_BBpro_APP_IMG                   = 0x01<<5,
      RTKOTAImageType_BBpro_DSP_System                = 0x01<<6,
      RTKOTAImageType_BBpro_DSP_APP                   = 0x01<<7,
      RTKOTAImageType_BBpro_DSP_UI_PARAMETER          = 0x01<<8,
      RTKOTAImageType_BBpro_APP_UI_PARAMETER          = 0x01<<9,
      RTKOTAImageType_BBpro_EXT_IMAGE0                = 0x01<<10,
      RTKOTAImageType_BBpro_EXT_IMAGE1                = 0x01<<11,
      RTKOTAImageType_BBpro_EXT_IMAGE2                = 0x01<<12,
      RTKOTAImageType_BBpro_EXT_IMAGE3                = 0x01<<13,
      RTKOTAImageType_BBpro_FACTORY_IMAGE             = 0x01<<14,
      RTKOTAImageType_BBpro_BACKUP_DATA               = 0x01<<15,
      RTKOTAImageType_BBpro_BACKUP_DATA2              = 0x01<<16,
      RTKOTAImageType_BBpro_Platform_Img              = 0x01<<17,
      RTKOTAImageType_BBpro_Lower_Stack_Img           = 0x01<<18,
      RTKOTAImageType_BBpro_Upper_Stack_Img           = 0x01<<19,
      RTKOTAImageType_BBpro_Framework_Img             = 0x01<<20,
  };
  
  typedef NS_ENUM(uint16_t, RTKSubBinHeaderType)
  {
      RTKSubBinHeaderType_BinID           = 0x0001,
      RTKSubBinHeaderType_Version         = 0x0002,
      RTKSubBinHeaderType_PartNumber      = 0x0003,
      RTKSubBinHeaderType_Length          = 0x0004,
      RTKSubBinHeaderType_OTAVersion      = 0x0011,
      RTKSubBinHeaderType_ImageID         = 0x0012,
      RTKSubBinHeaderType_FlashAddr       = 0x0013,
      RTKSubBinHeaderType_ImageSize       = 0x0014,
      RTKSubBinHeaderType_SecVersion      = 0x0015,
      RTKSubBinHeaderType_ImageVersion    = 0x0016,
  };
  
  
  #pragma pack(push, 1)
  
  typedef struct {
      RTKSubBinHeaderType    type;
      uint8_t    length;
      void*       dataAt;
  } RTKOTAMPSubBinHeader;
  
  typedef struct {
      uint32_t    flashOffset;
      uint32_t    size;
      uint32_t    reserved;
  } RTKOTAMPSubFileIndicator;
  
  typedef struct {
      uint16_t    signature;
      uint32_t    size;
      uint8_t     checkSum[32];
      union {
          uint16_t value;
          struct {
              uint8_t packVersion : 4;
              uint8_t reserved : 3;
              uint8_t isDualBank : 1;
              uint8_t icType;
          } components;
      } extension;
      union {
          uint32_t    value;
          struct {
              uint16_t bank0;
              uint16_t bank1;
          } components;
      } indicator;
      RTKOTAMPSubFileIndicator subFileIndicator;
  } RTKOTAMPPackHeader;
  
  typedef struct {
      uint16_t    signature;
      uint32_t    size;
      uint8_t     checkSum[32];
      union {
          uint16_t value;
          struct {
              uint8_t packVersion : 4;
              uint8_t reserved : 3;
              uint8_t isDualBank : 1;
              uint8_t icType;
          } components;
      } extension;
      union {
          uint32_t    value[8];
          struct {
              uint64_t bank0[2];
              uint64_t bank1[2];
          } components;
      } indicator;
      RTKOTAMPSubFileIndicator subFileIndicator;
  } RTKOTAMPPackHeaderNew;
  
  
  typedef struct {
      uint8_t    ic_type;
      uint8_t    ota_flag;
      uint16_t   signature;
      uint16_t   version;
      uint16_t   crc16;
      uint32_t   length;
  } RTKOTAImageHeader;
  
  
  /* Image Version Format */
  /*
   * https://wiki.realtek.com/pages/viewpage.action?pageId=109786831
   *
   *
   */
  
  union VersionFormatNormal {
      uint32_t numberValue;
      struct {
          uint32_t major: 8;
          uint32_t minor: 8;
          uint32_t revision: 8;
          uint32_t build: 8;
      } component;
  };
  
  union VersionFormatBee2 {
      uint32_t numberValue;
      struct {
          uint32_t major: 4;
          uint32_t minor: 8;
          uint32_t revision: 15;
          uint32_t build: 5;
      } component;
  };
  
  union VersionFormatBBpro {
      uint32_t numberValue;
      struct {
          uint32_t build: 8;
          uint32_t revision: 8;
          uint32_t minor: 8;
          uint32_t major: 8;
      } component;
  };
  
  union VersionFormatBBproApp {
      uint32_t numberValue;
      struct {
          uint32_t major: 4;
          uint32_t minor: 8;
          uint32_t revision: 9;
          uint32_t build: 11;
      } component;
  };
  
  union VersionFormatBBproPatch {
      uint32_t numberValue;
      struct {
          uint32_t major: 4;
          uint32_t minor: 8;
          uint32_t revision: 15;
          uint32_t build: 5;
      } component;
  };
  
  union VersionFormatOTA {
      uint32_t numberValue;
      struct {
          uint32_t build: 8;
          uint32_t revision: 8;
          uint32_t minor: 8;
          uint32_t major: 8;
      } component;
  };
  
  union VersionFormatDSP {
      uint32_t numberValue;
      struct {
          uint8_t customer_info: 8;
          uint8_t svn_revision: 8;
          uint8_t svn_minor: 8;
          uint8_t svn_major: 8;
      } component;
  };
  
  
  union VersionFormatDSPConfig {
      uint32_t numberValue;
      struct {
          uint8_t minor: 8;
          uint8_t major: 8;
          uint8_t custom_minor: 8;
          uint8_t custom_major: 8;
      } component;
  };
  
  union VersionFormatDSPLegacy {
      uint32_t numberValue;
      struct {
          uint32_t rsv: 16;
          uint8_t minor: 8;
          uint8_t major: 8;
      } component;
  };
  
  
  #pragma pack(pop)
  
  #endif /* RTKOTAFileFormat_h */