Remove misleading typedef and redundant suffix from struct flash_sector.
// 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;
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;
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;
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++)
{
{
/* 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;
}
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++)
{
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;
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;
* 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;
* @c flash_driver_s::protect_check.
*/
int is_protected;
-} flash_sector_t;
+};
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;
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;
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++)
{
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++)
{
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++)
{
/* 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++)
{
* 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++)
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");
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++)
{
/* 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;
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++)
{
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;
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;
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;
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},
#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},
#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},
#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},
#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},
#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},