target_t -> struct target
[fw/openocd] / src / flash / pic32mx.c
index 1408fe9cc5b3dc6af1ca7a91c0521cb67cf0b3a4..25f90fd6b0f6c8dcdb8f003565c2c0cf0d23d299 100644 (file)
@@ -64,7 +64,7 @@ static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint3
  */
 FLASH_BANK_COMMAND_HANDLER(pic32mx_flash_bank_command)
 {
-       pic32mx_flash_bank_t *pic32mx_info;
+       struct pic32mx_flash_bank *pic32mx_info;
 
        if (argc < 6)
        {
@@ -72,7 +72,7 @@ FLASH_BANK_COMMAND_HANDLER(pic32mx_flash_bank_command)
                return ERROR_FLASH_BANK_INVALID;
        }
 
-       pic32mx_info = malloc(sizeof(pic32mx_flash_bank_t));
+       pic32mx_info = malloc(sizeof(struct pic32mx_flash_bank));
        bank->driver_priv = pic32mx_info;
 
        pic32mx_info->write_algorithm = NULL;
@@ -83,7 +83,7 @@ FLASH_BANK_COMMAND_HANDLER(pic32mx_flash_bank_command)
 
 static uint32_t pic32mx_get_flash_status(flash_bank_t *bank)
 {
-       target_t *target = bank->target;
+       struct target *target = bank->target;
        uint32_t status;
 
        target_read_u32(target, PIC32MX_NVMCON, &status);
@@ -109,7 +109,7 @@ static uint32_t pic32mx_wait_status_busy(flash_bank_t *bank, int timeout)
 
 static int pic32mx_nvm_exec(struct flash_bank_s *bank, uint32_t op, uint32_t timeout)
 {
-       target_t *target = bank->target;
+       struct target *target = bank->target;
        uint32_t status;
 
        target_write_u32(target, PIC32MX_NVMCON, NVMCON_NVMWREN | op);
@@ -131,7 +131,7 @@ static int pic32mx_nvm_exec(struct flash_bank_s *bank, uint32_t op, uint32_t tim
 
 static int pic32mx_protect_check(struct flash_bank_s *bank)
 {
-       target_t *target = bank->target;
+       struct target *target = bank->target;
 
        uint32_t devcfg0;
        int s;
@@ -165,7 +165,7 @@ static int pic32mx_protect_check(struct flash_bank_s *bank)
 
 static int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
 {
-       target_t *target = bank->target;
+       struct target *target = bank->target;
        int i;
        uint32_t status;
 
@@ -207,8 +207,8 @@ static int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
 
 static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last)
 {
-       pic32mx_flash_bank_t *pic32mx_info = NULL;
-       target_t *target = bank->target;
+       struct pic32mx_flash_bank *pic32mx_info = NULL;
+       struct target *target = bank->target;
 #if 0
        uint16_t prot_reg[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
        int i, reg, bit;
@@ -300,14 +300,14 @@ static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int la
 
 static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
 {
-       target_t *target = bank->target;
+       struct target *target = bank->target;
        uint32_t buffer_size = 512;
-       working_area_t *source;
+       struct working_area *source;
        uint32_t address = bank->base + offset;
        int retval = ERROR_OK;
 #if 0
-       pic32mx_flash_bank_t *pic32mx_info = bank->driver_priv;
-       armv7m_algorithm_t armv7m_info;
+       struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv;
+       struct armv7m_algorithm armv7m_info;
 
        uint8_t pic32mx_flash_write_code[] = {
                                                                        /* write: */
@@ -429,7 +429,7 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3
 
 static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint32_t word)
 {
-       target_t *target = bank->target;
+       struct target *target = bank->target;
 
        if (bank->base >= PIC32MX_KSEG1_PGM_FLASH)
                target_write_u32(target, PIC32MX_NVMADDR, KS1Virt2Phys(address));
@@ -445,7 +445,7 @@ static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint3
  */
 static int pic32mx_write_row(struct flash_bank_s *bank, uint32_t address, uint32_t srcaddr)
 {
-       target_t *target = bank->target;
+       struct target *target = bank->target;
 
        LOG_DEBUG("addr: 0x%08" PRIx32 " srcaddr: 0x%08" PRIx32 "", address, srcaddr);
 
@@ -541,10 +541,10 @@ static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
 
 static int pic32mx_probe(struct flash_bank_s *bank)
 {
-       target_t *target = bank->target;
-       pic32mx_flash_bank_t *pic32mx_info = bank->driver_priv;
-       mips32_common_t *mips32 = target->arch_info;
-       mips_ejtag_t *ejtag_info = &mips32->ejtag_info;
+       struct target *target = bank->target;
+       struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv;
+       struct mips32_common *mips32 = target->arch_info;
+       struct mips_ejtag *ejtag_info = &mips32->ejtag_info;
        int i;
        uint16_t num_pages = 0;
        uint32_t device_id;
@@ -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++)
        {
@@ -624,7 +624,7 @@ static int pic32mx_probe(struct flash_bank_s *bank)
 
 static int pic32mx_auto_probe(struct flash_bank_s *bank)
 {
-       pic32mx_flash_bank_t *pic32mx_info = bank->driver_priv;
+       struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv;
        if (pic32mx_info->probed)
                return ERROR_OK;
        return pic32mx_probe(bank);
@@ -639,9 +639,9 @@ COMMAND_HANDLER(pic32mx_handle_part_id_command)
 
 static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size)
 {
-       target_t *target = bank->target;
-       mips32_common_t *mips32 = target->arch_info;
-       mips_ejtag_t *ejtag_info = &mips32->ejtag_info;
+       struct target *target = bank->target;
+       struct mips32_common *mips32 = target->arch_info;
+       struct mips_ejtag *ejtag_info = &mips32->ejtag_info;
        uint32_t device_id;
        int printed = 0, i;
 
@@ -674,8 +674,8 @@ static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size)
 #if 0
 COMMAND_HANDLER(pic32mx_handle_lock_command)
 {
-       target_t *target = NULL;
-       pic32mx_flash_bank_t *pic32mx_info = NULL;
+       struct target *target = NULL;
+       struct pic32mx_flash_bank *pic32mx_info = NULL;
 
        if (argc < 1)
        {
@@ -720,8 +720,8 @@ COMMAND_HANDLER(pic32mx_handle_lock_command)
 
 COMMAND_HANDLER(pic32mx_handle_unlock_command)
 {
-       target_t *target = NULL;
-       pic32mx_flash_bank_t *pic32mx_info = NULL;
+       struct target *target = NULL;
+       struct pic32mx_flash_bank *pic32mx_info = NULL;
 
        if (argc < 1)
        {
@@ -765,7 +765,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
 #if 0
 static int pic32mx_chip_erase(struct flash_bank_s *bank)
 {
-       target_t *target = bank->target;
+       struct target *target = bank->target;
 #if 0
        uint32_t status;
 #endif
@@ -904,7 +904,7 @@ static int pic32mx_register_commands(struct command_context_s *cmd_ctx)
        return ERROR_OK;
 }
 
-flash_driver_t pic32mx_flash = {
+struct flash_driver pic32mx_flash = {
                .name = "pic32mx",
                .register_commands = &pic32mx_register_commands,
                .flash_bank_command = &pic32mx_flash_bank_command,