From: Zachary T Welch Date: Fri, 13 Nov 2009 15:37:54 +0000 (-0800) Subject: flash_sector_t -> struct flash_sector X-Git-Tag: v0.4.0-rc1~753 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fb59ec739a3ae79937020dc2fe5413be0e73e8d3;p=openocd flash_sector_t -> struct flash_sector Remove misleading typedef and redundant suffix from struct flash_sector. --- diff --git a/src/flash/aduc702x.c b/src/flash/aduc702x.c index 0e862e9b..61ea36a9 100644 --- a/src/flash/aduc702x.c +++ b/src/flash/aduc702x.c @@ -85,7 +85,7 @@ static int aduc702x_build_sector_list(struct flash_bank_s *bank) // sector size is 512 bank->num_sectors = bank->size / 512; - bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); for (i = 0; i < bank->num_sectors; ++i) { bank->sectors[i].offset = offset; diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index ede54913..fd84e231 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -551,7 +551,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank) t_bank->num_sectors = sectors_num; /* allocate sectors */ - t_bank->sectors = malloc(sectors_num * sizeof(flash_sector_t)); + t_bank->sectors = malloc(sectors_num * sizeof(struct flash_sector)); for (sec = 0; sec < sectors_num; sec++) { t_bank->sectors[sec].offset = sec * pages_per_sector * page_size; @@ -804,7 +804,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) t_bank->num_sectors = num_sectors; /* allocate sectors */ - t_bank->sectors = malloc(num_sectors * sizeof(flash_sector_t)); + t_bank->sectors = malloc(num_sectors * sizeof(struct flash_sector)); for (sec = 0; sec < num_sectors; sec++) { t_bank->sectors[sec].offset = sec * pages_per_sector * page_size; diff --git a/src/flash/avrf.c b/src/flash/avrf.c index 7a7eddd9..fec21cbd 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -306,7 +306,7 @@ static int avrf_probe(struct flash_bank_s *bank) bank->base = 0x00000000; bank->size = (avr_info->flash_page_size * avr_info->flash_page_num); bank->num_sectors = avr_info->flash_page_num; - bank->sectors = malloc(sizeof(flash_sector_t) * avr_info->flash_page_num); + bank->sectors = malloc(sizeof(struct flash_sector) * avr_info->flash_page_num); for (i = 0; i < avr_info->flash_page_num; i++) { diff --git a/src/flash/cfi.c b/src/flash/cfi.c index 8c20e478..a3187fe2 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -2391,7 +2391,7 @@ static int cfi_probe(struct flash_bank_s *bank) { /* a device might have only one erase block, spanning the whole device */ bank->num_sectors = 1; - bank->sectors = malloc(sizeof(flash_sector_t)); + bank->sectors = malloc(sizeof(struct flash_sector)); bank->sectors[sector].offset = 0x0; bank->sectors[sector].size = bank->size; @@ -2408,7 +2408,7 @@ static int cfi_probe(struct flash_bank_s *bank) } bank->num_sectors = num_sectors; - bank->sectors = malloc(sizeof(flash_sector_t) * num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * num_sectors); for (i = 0; i < cfi_info->num_erase_regions; i++) { diff --git a/src/flash/ecos.c b/src/flash/ecos.c index 2154da09..b508cb12 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -130,7 +130,7 @@ FLASH_BANK_COMMAND_HANDLER(ecosflash_flash_bank_command) int i = 0; uint32_t offset = 0; bank->num_sectors = bank->size/sectorSize; - bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); for (i = 0; i < bank->num_sectors; i++) { bank->sectors[i].offset = offset; diff --git a/src/flash/faux.c b/src/flash/faux.c index d0f3f706..b7622f3b 100644 --- a/src/flash/faux.c +++ b/src/flash/faux.c @@ -66,7 +66,7 @@ FLASH_BANK_COMMAND_HANDLER(faux_flash_bank_command) int i = 0; uint32_t offset = 0; bank->num_sectors = bank->size/sectorSize; - bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); for (i = 0; i < bank->num_sectors; i++) { bank->sectors[i].offset = offset; diff --git a/src/flash/flash.h b/src/flash/flash.h index 7afb1327..d4abcde1 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -38,7 +38,7 @@ struct image_s; * within a flash bank. A single bank typically consists of multiple * sectors, each of which can be erased and protected independently. */ -typedef struct flash_sector_s +struct flash_sector { /// Bus offset from start of the flash chip (in bytes). uint32_t offset; @@ -55,7 +55,7 @@ typedef struct flash_sector_s * @c flash_driver_s::protect_check. */ int is_protected; -} flash_sector_t; +}; struct flash_bank_s; @@ -259,7 +259,7 @@ typedef struct flash_bank_s */ int num_sectors; /// Array of sectors, allocated and initilized by the flash driver - flash_sector_t *sectors; + struct flash_sector *sectors; struct flash_bank_s *next; /**< The next flash bank on this chip */ } flash_bank_t; diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index 0481355c..308a25cd 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -68,7 +68,7 @@ static int lpc2000_build_sector_list(struct flash_bank_s *bank) if (bank->size == 128 * 1024) { bank->num_sectors = 16; - bank->sectors = malloc(sizeof(flash_sector_t) * 16); + bank->sectors = malloc(sizeof(struct flash_sector) * 16); for (i = 0; i < 16; i++) { bank->sectors[i].offset = offset; @@ -81,7 +81,7 @@ static int lpc2000_build_sector_list(struct flash_bank_s *bank) else if (bank->size == 256 * 1024) { bank->num_sectors = 18; - bank->sectors = malloc(sizeof(flash_sector_t) * 18); + bank->sectors = malloc(sizeof(struct flash_sector) * 18); for (i = 0; i < 8; i++) { @@ -152,7 +152,7 @@ static int lpc2000_build_sector_list(struct flash_bank_s *bank) break; } - bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); for (i = 0; i < bank->num_sectors; i++) { @@ -206,7 +206,7 @@ static int lpc2000_build_sector_list(struct flash_bank_s *bank) exit(-1); } - bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); for(i = 0; i < bank->num_sectors; i++) { diff --git a/src/flash/lpc288x.c b/src/flash/lpc288x.c index 3c3e1e48..52d31a8a 100644 --- a/src/flash/lpc288x.c +++ b/src/flash/lpc288x.c @@ -137,7 +137,7 @@ static int lpc288x_read_part_info(struct flash_bank_s *bank) /* setup the sector info... */ offset = bank->base; bank->num_sectors = 23; - bank->sectors = malloc(sizeof(flash_sector_t) * 23); + bank->sectors = malloc(sizeof(struct flash_sector) * 23); for (i = 0; i < 15; i++) { diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index 83593792..fd265bd7 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -1702,7 +1702,7 @@ static int lpc2900_probe(struct flash_bank_s *bank) * the logical flash number are translated into the physical flash numbers * of the device. */ - bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); offset = 0; for (i = 0; i < bank->num_sectors; i++) diff --git a/src/flash/ocl.c b/src/flash/ocl.c index 63e9282f..239f9f5c 100644 --- a/src/flash/ocl.c +++ b/src/flash/ocl.c @@ -290,7 +290,7 @@ static int ocl_probe(struct flash_bank_s *bank) ocl->buflen = dcc_buffer[0] & 0xffff; ocl->bufalign = dcc_buffer[0] >> 16; - bank->sectors = realloc(bank->sectors, sizeof(flash_sector_t)*bank->num_sectors); + bank->sectors = realloc(bank->sectors, sizeof(struct flash_sector)*bank->num_sectors); if (bank->num_sectors == 0) { LOG_ERROR("number of sectors shall be non zero value"); diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index 1408fe9c..438630a1 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -607,7 +607,7 @@ static int pic32mx_probe(struct flash_bank_s *bank) bank->num_sectors = num_pages; bank->chip_width = 4; bank->bus_width = 4; - bank->sectors = malloc(sizeof(flash_sector_t) * num_pages); + bank->sectors = malloc(sizeof(struct flash_sector) * num_pages); for (i = 0; i < num_pages; i++) { diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index d66b9a8a..dc35c59e 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -592,7 +592,7 @@ static int stellaris_read_part_info(struct flash_bank_s *bank) /* provide this for the benefit of the higher flash driver layers */ bank->num_sectors = stellaris_info->num_pages; - bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); for (i = 0; i < bank->num_sectors; i++) { bank->sectors[i].offset = i * stellaris_info->pagesize; diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index 41b9008f..8725fad6 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -756,7 +756,7 @@ static int stm32x_probe(struct flash_bank_s *bank) bank->base = 0x08000000; bank->size = (num_pages * page_size); bank->num_sectors = num_pages; - bank->sectors = malloc(sizeof(flash_sector_t) * num_pages); + bank->sectors = malloc(sizeof(struct flash_sector) * num_pages); for (i = 0; i < num_pages; i++) { diff --git a/src/flash/str7x.c b/src/flash/str7x.c index 9738180e..dbb58723 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -81,7 +81,7 @@ static int str7x_build_block_list(struct flash_bank_s *bank) num_sectors = b0_sectors + b1_sectors; bank->num_sectors = num_sectors; - bank->sectors = malloc(sizeof(flash_sector_t) * num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * num_sectors); str7x_info->sector_bits = malloc(sizeof(uint32_t) * num_sectors); num_sectors = 0; diff --git a/src/flash/str9x.c b/src/flash/str9x.c index cdee5719..caabd993 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -83,7 +83,7 @@ static int str9x_build_block_list(struct flash_bank_s *bank) num_sectors = b0_sectors + b1_sectors; bank->num_sectors = num_sectors; - bank->sectors = malloc(sizeof(flash_sector_t) * num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * num_sectors); str9x_info->sector_bits = malloc(sizeof(uint32_t) * num_sectors); num_sectors = 0; diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index 83566df8..6b85e6a1 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -205,7 +205,7 @@ static int str9xpec_build_block_list(struct flash_bank_s *bank) num_sectors = b0_sectors + b1_sectors; bank->num_sectors = num_sectors; - bank->sectors = malloc(sizeof(flash_sector_t) * num_sectors); + bank->sectors = malloc(sizeof(struct flash_sector) * num_sectors); str9xpec_info->sector_bits = malloc(sizeof(uint32_t) * num_sectors); num_sectors = 0; diff --git a/src/flash/tms470.c b/src/flash/tms470.c index d33ccd67..75b233d9 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -28,7 +28,7 @@ Internal Support, Helpers ---------------------------------------------------------------------- */ -const flash_sector_t TMS470R1A256_SECTORS[] = { +const struct flash_sector TMS470R1A256_SECTORS[] = { {0x00000000, 0x00002000, -1, -1}, {0x00002000, 0x00002000, -1, -1}, {0x00004000, 0x00002000, -1, -1}, @@ -48,7 +48,7 @@ const flash_sector_t TMS470R1A256_SECTORS[] = { #define TMS470R1A256_NUM_SECTORS \ (sizeof(TMS470R1A256_SECTORS)/sizeof(TMS470R1A256_SECTORS[0])) -const flash_sector_t TMS470R1A288_BANK0_SECTORS[] = { +const struct flash_sector TMS470R1A288_BANK0_SECTORS[] = { {0x00000000, 0x00002000, -1, -1}, {0x00002000, 0x00002000, -1, -1}, {0x00004000, 0x00002000, -1, -1}, @@ -58,7 +58,7 @@ const flash_sector_t TMS470R1A288_BANK0_SECTORS[] = { #define TMS470R1A288_BANK0_NUM_SECTORS \ (sizeof(TMS470R1A288_BANK0_SECTORS)/sizeof(TMS470R1A288_BANK0_SECTORS[0])) -const flash_sector_t TMS470R1A288_BANK1_SECTORS[] = { +const struct flash_sector TMS470R1A288_BANK1_SECTORS[] = { {0x00040000, 0x00010000, -1, -1}, {0x00050000, 0x00010000, -1, -1}, {0x00060000, 0x00010000, -1, -1}, @@ -68,7 +68,7 @@ const flash_sector_t TMS470R1A288_BANK1_SECTORS[] = { #define TMS470R1A288_BANK1_NUM_SECTORS \ (sizeof(TMS470R1A288_BANK1_SECTORS)/sizeof(TMS470R1A288_BANK1_SECTORS[0])) -const flash_sector_t TMS470R1A384_BANK0_SECTORS[] = { +const struct flash_sector TMS470R1A384_BANK0_SECTORS[] = { {0x00000000, 0x00002000, -1, -1}, {0x00002000, 0x00002000, -1, -1}, {0x00004000, 0x00004000, -1, -1}, @@ -84,7 +84,7 @@ const flash_sector_t TMS470R1A384_BANK0_SECTORS[] = { #define TMS470R1A384_BANK0_NUM_SECTORS \ (sizeof(TMS470R1A384_BANK0_SECTORS)/sizeof(TMS470R1A384_BANK0_SECTORS[0])) -const flash_sector_t TMS470R1A384_BANK1_SECTORS[] = { +const struct flash_sector TMS470R1A384_BANK1_SECTORS[] = { {0x00020000, 0x00008000, -1, -1}, {0x00028000, 0x00008000, -1, -1}, {0x00030000, 0x00008000, -1, -1}, @@ -94,7 +94,7 @@ const flash_sector_t TMS470R1A384_BANK1_SECTORS[] = { #define TMS470R1A384_BANK1_NUM_SECTORS \ (sizeof(TMS470R1A384_BANK1_SECTORS)/sizeof(TMS470R1A384_BANK1_SECTORS[0])) -const flash_sector_t TMS470R1A384_BANK2_SECTORS[] = { +const struct flash_sector TMS470R1A384_BANK2_SECTORS[] = { {0x00040000, 0x00008000, -1, -1}, {0x00048000, 0x00008000, -1, -1}, {0x00050000, 0x00008000, -1, -1},