25
25
#include "info.h"
26
26
#include "settings.h"
27
27
#include "compiler.h"
28
- #include "macro.h"
29
28
#include "util.h"
30
29
31
30
// Virtual file system driver
@@ -257,7 +256,7 @@ const virtual_media_t virtual_media_tmpl[] = {
257
256
/* Raw filesystem contents follow */
258
257
};
259
258
// Keep virtual_media_idx_t in sync with virtual_media_tmpl
260
- COMPILER_ASSERT (MEDIA_IDX_COUNT == ELEMENTS_IN_ARRAY (virtual_media_tmpl ));
259
+ COMPILER_ASSERT (MEDIA_IDX_COUNT == ARRAY_SIZE (virtual_media_tmpl ));
261
260
262
261
static const FatDirectoryEntry_t root_dir_entry = {
263
262
/*uint8_t[11] */ .filename = {"" },
@@ -311,7 +310,7 @@ static void write_fat(file_allocation_table_t *fat, uint32_t idx, uint16_t val)
311
310
high_idx = idx * 2 + 1 ;
312
311
313
312
// Assert that this is still within the fat table
314
- if (high_idx >= ELEMENTS_IN_ARRAY (fat -> f )) {
313
+ if (high_idx >= ARRAY_SIZE (fat -> f )) {
315
314
util_assert (0 );
316
315
return ;
317
316
}
@@ -366,7 +365,7 @@ void vfs_init(const vfs_filename_t drive_name, uint32_t disk_size)
366
365
virtual_media_idx = MEDIA_IDX_COUNT ;
367
366
data_start = 0 ;
368
367
369
- for (i = 0 ; i < ELEMENTS_IN_ARRAY (virtual_media_tmpl ); i ++ ) {
368
+ for (i = 0 ; i < ARRAY_SIZE (virtual_media_tmpl ); i ++ ) {
370
369
data_start += virtual_media [i ].length ;
371
370
}
372
371
@@ -424,7 +423,7 @@ vfs_file_t vfs_create_file(const vfs_filename_t filename, vfs_read_cb_t read_cb,
424
423
}
425
424
426
425
// Update directory entry
427
- if (dir_idx >= ELEMENTS_IN_ARRAY (dir_current .f )) {
426
+ if (dir_idx >= ARRAY_SIZE (dir_current .f )) {
428
427
util_assert (0 );
429
428
return VFS_FILE_INVALID ;
430
429
}
@@ -438,7 +437,7 @@ vfs_file_t vfs_create_file(const vfs_filename_t filename, vfs_read_cb_t read_cb,
438
437
de -> first_cluster_low_16 = (first_cluster >> 0 ) & 0xFFFF ;
439
438
440
439
// Update virtual media
441
- if (virtual_media_idx >= ELEMENTS_IN_ARRAY (virtual_media )) {
440
+ if (virtual_media_idx >= ARRAY_SIZE (virtual_media )) {
442
441
util_assert (0 );
443
442
return VFS_FILE_INVALID ;
444
443
}
@@ -502,7 +501,7 @@ void vfs_read(uint32_t requested_sector, uint8_t *buf, uint32_t num_sectors)
502
501
memset (buf , 0 , num_sectors * VFS_SECTOR_SIZE );
503
502
current_sector = 0 ;
504
503
505
- for (i = 0 ; i < ELEMENTS_IN_ARRAY (virtual_media ); i ++ ) {
504
+ for (i = 0 ; i < ARRAY_SIZE (virtual_media ); i ++ ) {
506
505
uint32_t vm_sectors = virtual_media [i ].length / VFS_SECTOR_SIZE ;
507
506
uint32_t vm_start = current_sector ;
508
507
uint32_t vm_end = current_sector + vm_sectors ;
0 commit comments