Skip to content

Commit 547020d

Browse files
committed
Merge branch '58-update-d7a-system-files-to-v1-2' into 'master'
Resolve "Update D7A system files to v1.2" Closes Sub-IoT#58 See merge request aloxy/oss-7!41
2 parents b719e86 + d49b7f4 commit 547020d

File tree

4 files changed

+66
-52
lines changed

4 files changed

+66
-52
lines changed

stack/framework/inc/d7ap_fs.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@
5050
#define D7A_FILE_ENGINEERING_MODE_FILE_ID 0x05
5151
#define D7A_FILE_ENGINEERING_MODE_SIZE 9
5252

53+
#define D7A_FILE_VID_FILE_ID 0x06
54+
#define D7A_FILE_VID_SIZE 3
55+
5356
#define D7A_FILE_DLL_CONF_FILE_ID 0x0A
54-
#define D7A_FILE_DLL_CONF_SIZE 6
57+
#define D7A_FILE_DLL_CONF_SIZE 7
5558

5659
#define D7A_FILE_ACCESS_PROFILE_ID 0x20 // the first access class file
5760
#define D7A_FILE_ACCESS_PROFILE_SIZE 65

stack/modules/d7ap/d7ap_fs.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ int d7ap_fs_read_uid(uint8_t *buffer)
257257

258258
int d7ap_fs_read_vid(uint8_t *buffer)
259259
{
260-
return (d7ap_fs_read_file(D7A_FILE_DLL_CONF_FILE_ID, 1, buffer, 2));
260+
return (d7ap_fs_read_file(D7A_FILE_VID_FILE_ID, 0, buffer, ID_TYPE_VID_LENGTH));
261261
}
262262

263263
int d7ap_fs_read_nwl_security_key(uint8_t *buffer)
@@ -343,16 +343,25 @@ int d7ap_fs_read_access_class(uint8_t access_class_index, dae_access_profile_t *
343343
{
344344
assert(access_class_index < 15);
345345
assert(is_file_defined(D7A_FILE_ACCESS_PROFILE_ID + access_class_index));
346-
return (d7ap_fs_read_file(D7A_FILE_ACCESS_PROFILE_ID + access_class_index, 0,
347-
(uint8_t*)access_class, D7A_FILE_ACCESS_PROFILE_SIZE));
346+
int result = d7ap_fs_read_file(D7A_FILE_ACCESS_PROFILE_ID + access_class_index, 0, (uint8_t*)access_class, D7A_FILE_ACCESS_PROFILE_SIZE);
347+
for(int i=0; i<SUBBANDS_NB; i++) {
348+
access_class->subbands[i].channel_index_start = __builtin_bswap16(access_class->subbands[i].channel_index_start);
349+
access_class->subbands[i].channel_index_end = __builtin_bswap16(access_class->subbands[i].channel_index_end);
350+
}
351+
return result;
348352
}
349353

350354
int d7ap_fs_write_access_class(uint8_t access_class_index, dae_access_profile_t* access_class)
351355
{
352356
assert(access_class_index < 15);
353357
assert(is_file_defined(D7A_FILE_ACCESS_PROFILE_ID + access_class_index));
354-
return (d7ap_fs_write_file(D7A_FILE_ACCESS_PROFILE_ID + access_class_index, 0,
355-
(uint8_t*)access_class, D7A_FILE_ACCESS_PROFILE_SIZE));
358+
dae_access_profile_t* temp_access_class;
359+
memcpy(&temp_access_class, &access_class, sizeof(dae_access_profile_t));
360+
for(int i=0; i<SUBBANDS_NB; i++) {
361+
temp_access_class->subbands[i].channel_index_start = __builtin_bswap16(temp_access_class->subbands[i].channel_index_start);
362+
temp_access_class->subbands[i].channel_index_end = __builtin_bswap16(temp_access_class->subbands[i].channel_index_end);
363+
}
364+
return d7ap_fs_write_file(D7A_FILE_ACCESS_PROFILE_ID + access_class_index, 0, (uint8_t*)temp_access_class, D7A_FILE_ACCESS_PROFILE_SIZE);
356365
}
357366

358367
uint8_t d7ap_fs_read_dll_conf_active_access_class()

stack/modules/d7ap/d7ap_fs_data.c

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ from d7a.system_files.security_key import SecurityKeyFile
4040
from d7a.system_files.uid import UidFile
4141
from d7a.system_files.engineering_mode import EngineeringModeFile
4242
from d7a.system_files.factory_settings import FactorySettingsFile
43+
from d7a.system_files.vid import VidFile
4344
from d7a.fs.file_permissions import FilePermissions
4445
from d7a.fs.file_properties import FileProperties
4546
from d7a.fs.file_properties import ActionCondition, StorageClass, FileProperties
@@ -85,7 +86,7 @@ system_files = [
8586
NotImplementedFile(SystemFileIds.DEVICE_CAPACITY.value, 19),
8687
NotImplementedFile(SystemFileIds.DEVICE_STATUS.value, 9),
8788
EngineeringModeFile(),
88-
NotImplementedFile(SystemFileIds.VID.value, 3),
89+
VidFile(),
8990
NotImplementedFile(SystemFileIds.RFU_07.value, 0),
9091
NotImplementedFile(SystemFileIds.PHY_CONFIG.value, 9),
9192
NotImplementedFile(SystemFileIds.PHY_STATUS.value, 24), # TODO assuming 3 channels for now
@@ -190,44 +191,44 @@ __attribute__((used)) uint16_t files_offset[] = {
190191
0x9b, // RFU_07 - 7 (length 0))
191192
0xa7, // PHY_CONFIG - 8 (length 9))
192193
0xbc, // PHY_STATUS - 9 (length 24))
193-
0xe0, // DLL_CONFIG - 10 (length 3))
194-
0xef, // DLL_STATUS - 11 (length 12))
195-
0x107, // NWL_ROUTING - 12 (length 1))
196-
0x114, // NWL_SECURITY - 13 (length 5))
197-
0x125, // NWL_SECURITY_KEY - 14 (length 16))
198-
0x141, // NWL_SSR - 15 (length 4))
199-
0x151, // NWL_STATUS - 16 (length 20))
200-
0x171, // TRL_STATUS - 17 (length 1))
201-
0x17e, // SEL_CONFIG - 18 (length 6))
202-
0x190, // FOF_STATUS - 19 (length 10))
203-
0x1a6, // RFU_14 - 20 (length 0))
204-
0x1b2, // RFU_15 - 21 (length 0))
205-
0x1be, // RFU_16 - 22 (length 0))
206-
0x1ca, // LOCATION_DATA - 23 (length 1))
207-
0x1d7, // D7AALP_RFU_18 - 24 (length 0))
208-
0x1e3, // D7AALP_RFU_19 - 25 (length 0))
209-
0x1ef, // D7AALP_RFU_1A - 26 (length 0))
210-
0x1fb, // D7AALP_RFU_1B - 27 (length 0))
211-
0x207, // D7AALP_RFU_1C - 28 (length 0))
212-
0x213, // D7AALP_RFU_1D - 29 (length 0))
213-
0x21f, // D7AALP_RFU_1E - 30 (length 0))
214-
0x22b, // D7AALP_RFU_1F - 31 (length 0))
215-
0x237, // ACCESS_PROFILE_0 - 32 (length 65))
216-
0x284, // ACCESS_PROFILE_1 - 33 (length 65))
217-
0x2d1, // ACCESS_PROFILE_2 - 34 (length 65))
218-
0x31e, // ACCESS_PROFILE_3 - 35 (length 65))
219-
0x36b, // ACCESS_PROFILE_4 - 36 (length 65))
220-
0x3b8, // ACCESS_PROFILE_5 - 37 (length 65))
221-
0x405, // ACCESS_PROFILE_6 - 38 (length 65))
222-
0x452, // ACCESS_PROFILE_7 - 39 (length 65))
223-
0x49f, // ACCESS_PROFILE_8 - 40 (length 65))
224-
0x4ec, // ACCESS_PROFILE_9 - 41 (length 65))
225-
0x539, // ACCESS_PROFILE_10 - 42 (length 65))
226-
0x586, // ACCESS_PROFILE_11 - 43 (length 65))
227-
0x5d3, // ACCESS_PROFILE_12 - 44 (length 65))
228-
0x620, // ACCESS_PROFILE_13 - 45 (length 65))
229-
0x66d, // ACCESS_PROFILE_14 - 46 (length 65))
230-
//[[[end]]] (checksum: 130e32b284b338c84403ad3d6198ff1f)
194+
0xe0, // DLL_CONFIG - 10 (length 7))
195+
0xf3, // DLL_STATUS - 11 (length 12))
196+
0x10b, // NWL_ROUTING - 12 (length 1))
197+
0x118, // NWL_SECURITY - 13 (length 5))
198+
0x129, // NWL_SECURITY_KEY - 14 (length 16))
199+
0x145, // NWL_SSR - 15 (length 4))
200+
0x155, // NWL_STATUS - 16 (length 20))
201+
0x175, // TRL_STATUS - 17 (length 1))
202+
0x182, // SEL_CONFIG - 18 (length 6))
203+
0x194, // FOF_STATUS - 19 (length 10))
204+
0x1aa, // RFU_14 - 20 (length 0))
205+
0x1b6, // RFU_15 - 21 (length 0))
206+
0x1c2, // RFU_16 - 22 (length 0))
207+
0x1ce, // LOCATION_DATA - 23 (length 1))
208+
0x1db, // D7AALP_RFU_18 - 24 (length 0))
209+
0x1e7, // D7AALP_RFU_19 - 25 (length 0))
210+
0x1f3, // D7AALP_RFU_1A - 26 (length 0))
211+
0x1ff, // D7AALP_RFU_1B - 27 (length 0))
212+
0x20b, // D7AALP_RFU_1C - 28 (length 0))
213+
0x217, // D7AALP_RFU_1D - 29 (length 0))
214+
0x223, // D7AALP_RFU_1E - 30 (length 0))
215+
0x22f, // D7AALP_RFU_1F - 31 (length 0))
216+
0x23b, // ACCESS_PROFILE_0 - 32 (length 65))
217+
0x288, // ACCESS_PROFILE_1 - 33 (length 65))
218+
0x2d5, // ACCESS_PROFILE_2 - 34 (length 65))
219+
0x322, // ACCESS_PROFILE_3 - 35 (length 65))
220+
0x36f, // ACCESS_PROFILE_4 - 36 (length 65))
221+
0x3bc, // ACCESS_PROFILE_5 - 37 (length 65))
222+
0x409, // ACCESS_PROFILE_6 - 38 (length 65))
223+
0x456, // ACCESS_PROFILE_7 - 39 (length 65))
224+
0x4a3, // ACCESS_PROFILE_8 - 40 (length 65))
225+
0x4f0, // ACCESS_PROFILE_9 - 41 (length 65))
226+
0x53d, // ACCESS_PROFILE_10 - 42 (length 65))
227+
0x58a, // ACCESS_PROFILE_11 - 43 (length 65))
228+
0x5d7, // ACCESS_PROFILE_12 - 44 (length 65))
229+
0x624, // ACCESS_PROFILE_13 - 45 (length 65))
230+
0x671, // ACCESS_PROFILE_14 - 46 (length 65))
231+
//[[[end]]] (checksum: 798913e0a6af67a14112df377fbc85a3)
231232
};
232233

233234
__attribute__((used)) uint8_t files_length[] = {
@@ -244,7 +245,7 @@ __attribute__((used)) uint8_t files_length[] = {
244245
0xc, // RFU_07 - 7)
245246
0x15, // PHY_CONFIG - 8)
246247
0x24, // PHY_STATUS - 9)
247-
0xf, // DLL_CONFIG - 10)
248+
0x13, // DLL_CONFIG - 10)
248249
0x18, // DLL_STATUS - 11)
249250
0xd, // NWL_ROUTING - 12)
250251
0x11, // NWL_SECURITY - 13)
@@ -281,7 +282,7 @@ __attribute__((used)) uint8_t files_length[] = {
281282
0x4d, // ACCESS_PROFILE_12 - 44)
282283
0x4d, // ACCESS_PROFILE_13 - 45)
283284
0x4d, // ACCESS_PROFILE_14 - 46)
284-
//[[[end]]] (checksum: 3c8db48a9505d827b95106ac98851d3c)
285+
//[[[end]]] (checksum: e84fba5d8d3ec166279358e4bea2f101)
285286
};
286287

287288
__attribute__((used)) uint8_t d7ap_permanent_files_data[FRAMEWORK_FS_PERMANENT_STORAGE_SIZE] LINKER_SECTION_FS_SYSTEM_FILE = {
@@ -312,7 +313,7 @@ __attribute__((used)) uint8_t d7ap_permanent_files_data[FRAMEWORK_FS_PERMANENT_S
312313
0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0,
313314
// VID - 6
314315
0x24, 0x23, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x3,
315-
0x0, 0x0, 0x0,
316+
0xff, 0xff, 0x0,
316317
// RFU_07 - 7
317318
0x24, 0x23, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
318319

@@ -323,8 +324,8 @@ __attribute__((used)) uint8_t d7ap_permanent_files_data[FRAMEWORK_FS_PERMANENT_S
323324
0x24, 0x23, 0xff, 0xff, 0x0, 0x0, 0x0, 0x18, 0x0, 0x0, 0x0, 0x18,
324325
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
325326
// DLL_CONFIG - 10
326-
0x24, 0x23, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x3,
327-
0x21, 0xff, 0xff,
327+
0x24, 0x23, 0xff, 0xff, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7,
328+
0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
328329
// DLL_STATUS - 11
329330
0x24, 0x23, 0xff, 0xff, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xc,
330331
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@@ -433,7 +434,7 @@ __attribute__((used)) uint8_t d7ap_permanent_files_data[FRAMEWORK_FS_PERMANENT_S
433434
// ACCESS_PROFILE_14 - 46
434435
0x24, 0x23, 0xff, 0xff, 0x0, 0x0, 0x0, 0x41, 0x0, 0x0, 0x0, 0x41,
435436
0x32, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe, 0x56, 0xff, 0x0, 0x0, 0x0, 0x0, 0xe, 0x56, 0xff, 0x0, 0x0, 0x0, 0x0, 0xe, 0x56, 0xff, 0x0, 0x0, 0x0, 0x0, 0xe, 0x56, 0xff, 0x0, 0x0, 0x0, 0x0, 0xe, 0x56, 0xff, 0x0, 0x0, 0x0, 0x0, 0xe, 0x56, 0xff, 0x0, 0x0, 0x0, 0x0, 0xe, 0x56, 0xff, 0x0, 0x0, 0x0, 0x0, 0xe, 0x56, 0xff,
436-
//[[[end]]] (checksum: 6a2a7b05a04acc64d665b305b56b842b)
437+
//[[[end]]] (checksum: 149f22e1928490f8553b2faf3cdef27a)
437438
};
438439

439440

stack/modules/d7ap/engineering_mode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ static void em_file_change_callback(uint8_t file_id) {
180180

181181
d7ap_fs_read_file(D7A_FILE_ENGINEERING_MODE_FILE_ID, 0, data, D7A_FILE_ENGINEERING_MODE_SIZE);
182182

183-
d7ap_fs_engineering_mode_t* em_command = (d7ap_fs_engineering_mode_t*)data;
183+
d7ap_fs_engineering_mode_t* em_command = (d7ap_fs_engineering_mode_t*) data;
184+
em_command->channel_id.center_freq_index = __builtin_bswap16(em_command->channel_id.center_freq_index);
184185

185186
DPRINT("em_file_change_callback");
186187
DPRINT_DATA(data, D7A_FILE_ENGINEERING_MODE_SIZE);

0 commit comments

Comments
 (0)