X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fflash%2Flpc288x.c;h=446fc9da58677787236e61117056b83554a3fe74;hb=e1ec02bb055fa356b058dddc0a15710e0fdc9870;hp=d681fbf9ea69ce3e0cf54f385e08506f197fc9f2;hpb=632fd663a821047df9a9b965ec1c35d6b034ebba;p=openocd.git diff --git a/src/flash/lpc288x.c b/src/flash/lpc288x.c index d681fbf9ea..446fc9da58 100644 --- a/src/flash/lpc288x.c +++ b/src/flash/lpc288x.c @@ -84,15 +84,15 @@ /* F_CLK_TIME */ #define FCT_CLK_DIV_MASK 0x0FFF -static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout); -static void lpc288x_load_timer(int erase, struct target_s *target); -static void lpc288x_set_flash_clk(struct flash_bank_s *bank); -static uint32_t lpc288x_system_ready(struct flash_bank_s *bank); +static uint32_t lpc288x_wait_status_busy(struct flash_bank *bank, int timeout); +static void lpc288x_load_timer(int erase, struct target *target); +static void lpc288x_set_flash_clk(struct flash_bank *bank); +static uint32_t lpc288x_system_ready(struct flash_bank *bank); -static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout) +static uint32_t lpc288x_wait_status_busy(struct flash_bank *bank, int timeout) { uint32_t status; - target_t *target = bank->target; + struct target *target = bank->target; do { alive_sleep(1); @@ -109,10 +109,10 @@ static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout) } /* Read device id register and fill in driver info structure */ -static int lpc288x_read_part_info(struct flash_bank_s *bank) +static int lpc288x_read_part_info(struct flash_bank *bank) { - lpc288x_flash_bank_t *lpc288x_info = bank->driver_priv; - target_t *target = bank->target; + struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv; + struct target *target = bank->target; uint32_t cidr; int i = 0; @@ -159,7 +159,7 @@ static int lpc288x_read_part_info(struct flash_bank_s *bank) return ERROR_OK; } -static int lpc288x_protect_check(struct flash_bank_s *bank) +static int lpc288x_protect_check(struct flash_bank *bank) { return ERROR_OK; } @@ -167,20 +167,20 @@ static int lpc288x_protect_check(struct flash_bank_s *bank) /* flash_bank LPC288x 0 0 0 0 */ FLASH_BANK_COMMAND_HANDLER(lpc288x_flash_bank_command) { - lpc288x_flash_bank_t *lpc288x_info; + struct lpc288x_flash_bank *lpc288x_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank LPC288x configuration"); return ERROR_FLASH_BANK_INVALID; } - lpc288x_info = malloc(sizeof(lpc288x_flash_bank_t)); + lpc288x_info = malloc(sizeof(struct lpc288x_flash_bank)); bank->driver_priv = lpc288x_info; /* part wasn't probed for info yet */ lpc288x_info->cidr = 0; - COMMAND_PARSE_NUMBER(u32, args[6], lpc288x_info->cclk); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[6], lpc288x_info->cclk); return ERROR_OK; } @@ -190,10 +190,10 @@ FLASH_BANK_COMMAND_HANDLER(lpc288x_flash_bank_command) * AHB = 12 MHz ? * 12000000/66000 = 182 * CLK_DIV = 60 ? */ -static void lpc288x_set_flash_clk(struct flash_bank_s *bank) +static void lpc288x_set_flash_clk(struct flash_bank *bank) { uint32_t clk_time; - lpc288x_flash_bank_t *lpc288x_info = bank->driver_priv; + struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv; clk_time = (lpc288x_info->cclk / 66000) / 3; target_write_u32(bank->target, F_CTRL, FC_CS | FC_WEN); target_write_u32(bank->target, F_CLK_TIME, clk_time); @@ -205,7 +205,7 @@ static void lpc288x_set_flash_clk(struct flash_bank_s *bank) * LOAD_TIMER_WRITE FPT_TIME = ((1,000,000 / AHB tcyc (in ns)) - 2) / 512 * = 23 (75) (AN10548 72 - is this wrong?) * TODO: Sort out timing calcs ;) */ -static void lpc288x_load_timer(int erase, struct target_s *target) +static void lpc288x_load_timer(int erase, struct target *target) { if (erase == LOAD_TIMER_ERASE) { @@ -217,9 +217,9 @@ static void lpc288x_load_timer(int erase, struct target_s *target) } } -static uint32_t lpc288x_system_ready(struct flash_bank_s *bank) +static uint32_t lpc288x_system_ready(struct flash_bank *bank) { - lpc288x_flash_bank_t *lpc288x_info = bank->driver_priv; + struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv; if (lpc288x_info->cidr == 0) { return ERROR_FLASH_BANK_NOT_PROBED; @@ -233,7 +233,7 @@ static uint32_t lpc288x_system_ready(struct flash_bank_s *bank) return ERROR_OK; } -static int lpc288x_erase_check(struct flash_bank_s *bank) +static int lpc288x_erase_check(struct flash_bank *bank) { uint32_t status = lpc288x_system_ready(bank); /* probed? halted? */ if (status != ERROR_OK) @@ -245,11 +245,11 @@ static int lpc288x_erase_check(struct flash_bank_s *bank) return ERROR_OK; } -static int lpc288x_erase(struct flash_bank_s *bank, int first, int last) +static int lpc288x_erase(struct flash_bank *bank, int first, int last) { uint32_t status; int sector; - target_t *target = bank->target; + struct target *target = bank->target; status = lpc288x_system_ready(bank); /* probed? halted? */ if (status != ERROR_OK) @@ -286,11 +286,11 @@ static int lpc288x_erase(struct flash_bank_s *bank, int first, int last) return ERROR_OK; } -static int lpc288x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int lpc288x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { uint8_t page_buffer[FLASH_PAGE_SIZE]; uint32_t status, source_offset,dest_offset; - target_t *target = bank->target; + struct target *target = bank->target; uint32_t bytes_remaining = count; uint32_t first_sector, last_sector, sector, page; int i; @@ -402,10 +402,10 @@ static int lpc288x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of return ERROR_OK; } -static int lpc288x_probe(struct flash_bank_s *bank) +static int lpc288x_probe(struct flash_bank *bank) { /* we only deal with LPC2888 so flash config is fixed */ - lpc288x_flash_bank_t *lpc288x_info = bank->driver_priv; + struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv; int retval; if (lpc288x_info->cidr != 0) @@ -425,17 +425,17 @@ static int lpc288x_probe(struct flash_bank_s *bank) return ERROR_OK; } -static int lpc288x_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int lpc288x_info(struct flash_bank *bank, char *buf, int buf_size) { snprintf(buf, buf_size, "lpc288x flash driver"); return ERROR_OK; } -static int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int last) +static int lpc288x_protect(struct flash_bank *bank, int set, int first, int last) { int lockregion, status; uint32_t value; - target_t *target = bank->target; + struct target *target = bank->target; /* probed? halted? */ status = lpc288x_system_ready(bank);