flash_bank_t -> struct flash_bank

Remove misleading typedef and redundant suffix from struct flash_bank.
This commit is contained in:
Zachary T Welch 2009-11-13 11:32:28 -08:00
parent 2f6e56e383
commit 96b62996d2
24 changed files with 373 additions and 373 deletions

View File

@ -29,7 +29,7 @@
#include "time_support.h" #include "time_support.h"
static int aduc702x_build_sector_list(struct flash_bank_s *bank); static int aduc702x_build_sector_list(struct flash_bank *bank);
static int aduc702x_check_flash_completion(struct target* target, unsigned int timeout_ms); static int aduc702x_check_flash_completion(struct target* target, unsigned int timeout_ms);
static int aduc702x_set_write_enable(struct target *target, int enable); static int aduc702x_set_write_enable(struct target *target, int enable);
@ -64,9 +64,9 @@ FLASH_BANK_COMMAND_HANDLER(aduc702x_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int aduc702x_build_sector_list(struct flash_bank_s *bank) static int aduc702x_build_sector_list(struct flash_bank *bank)
{ {
//aduc7026_flash_bank_t *aduc7026_info = bank->driver_priv; //aduc7026_struct flash_bank *aduc7026_info = bank->driver_priv;
int i = 0; int i = 0;
uint32_t offset = 0; uint32_t offset = 0;
@ -86,13 +86,13 @@ static int aduc702x_build_sector_list(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int aduc702x_protect_check(struct flash_bank_s *bank) static int aduc702x_protect_check(struct flash_bank *bank)
{ {
printf("aduc702x_protect_check not implemented yet.\n"); printf("aduc702x_protect_check not implemented yet.\n");
return ERROR_OK; return ERROR_OK;
} }
static int aduc702x_erase(struct flash_bank_s *bank, int first, int last) static int aduc702x_erase(struct flash_bank *bank, int first, int last)
{ {
//int res; //int res;
int x; int x;
@ -145,7 +145,7 @@ static int aduc702x_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int last) static int aduc702x_protect(struct flash_bank *bank, int set, int first, int last)
{ {
printf("aduc702x_protect not implemented yet.\n"); printf("aduc702x_protect not implemented yet.\n");
return ERROR_FLASH_OPERATION_FAILED; return ERROR_FLASH_OPERATION_FAILED;
@ -156,7 +156,7 @@ static int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int l
* *
* Caller should not check for other return values specifically * Caller should not check for other return values specifically
*/ */
static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct aduc702x_flash_bank *aduc702x_info = bank->driver_priv; struct aduc702x_flash_bank *aduc702x_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -301,7 +301,7 @@ static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint
/* All-JTAG, single-access method. Very slow. Used only if there is no /* All-JTAG, single-access method. Very slow. Used only if there is no
* working area available. */ * working area available. */
static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int aduc702x_write_single(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
uint32_t x; uint32_t x;
uint8_t b; uint8_t b;
@ -342,7 +342,7 @@ static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uin
return ERROR_OK; return ERROR_OK;
} }
int aduc702x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) int aduc702x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
int retval; int retval;
@ -366,12 +366,12 @@ int aduc702x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset,
return retval; return retval;
} }
static int aduc702x_probe(struct flash_bank_s *bank) static int aduc702x_probe(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
static int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size) static int aduc702x_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
snprintf(buf, buf_size, "aduc702x flash driver info"); snprintf(buf, buf_size, "aduc702x flash driver info");
return ERROR_OK; return ERROR_OK;

View File

@ -175,7 +175,7 @@ struct sam3_bank_private {
// so we can find the chip we belong to // so we can find the chip we belong to
struct sam3_chip *pChip; struct sam3_chip *pChip;
// so we can find the orginal bank pointer // so we can find the orginal bank pointer
flash_bank_t *pBank; struct flash_bank *pBank;
unsigned bank_number; unsigned bank_number;
uint32_t controller_address; uint32_t controller_address;
uint32_t base_address; uint32_t base_address;
@ -1456,7 +1456,7 @@ static const struct sam3_reg_list sam3_all_regs[] = {
static struct sam3_bank_private * static struct sam3_bank_private *
get_sam3_bank_private(flash_bank_t *bank) get_sam3_bank_private(struct flash_bank *bank)
{ {
return (struct sam3_bank_private *)(bank->driver_priv); return (struct sam3_bank_private *)(bank->driver_priv);
} }
@ -1582,7 +1582,7 @@ sam3_GetInfo(struct sam3_chip *pChip)
static int static int
sam3_erase_check(struct flash_bank_s *bank) sam3_erase_check(struct flash_bank *bank)
{ {
int x; int x;
@ -1606,7 +1606,7 @@ sam3_erase_check(struct flash_bank_s *bank)
} }
static int static int
sam3_protect_check(struct flash_bank_s *bank) sam3_protect_check(struct flash_bank *bank)
{ {
int r; int r;
uint32_t v=0; uint32_t v=0;
@ -1709,7 +1709,7 @@ sam3_GetDetails(struct sam3_bank_private *pPrivate)
const struct sam3_chip_details *pDetails; const struct sam3_chip_details *pDetails;
struct sam3_chip *pChip; struct sam3_chip *pChip;
void *vp; void *vp;
flash_bank_t *saved_banks[SAM3_MAX_FLASH_BANKS]; struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS];
unsigned x; unsigned x;
const char *cp; const char *cp;
@ -1777,7 +1777,7 @@ sam3_GetDetails(struct sam3_bank_private *pPrivate)
static int static int
_sam3_probe(struct flash_bank_s *bank, int noise) _sam3_probe(struct flash_bank *bank, int noise)
{ {
unsigned x; unsigned x;
int r; int r;
@ -1861,13 +1861,13 @@ _sam3_probe(struct flash_bank_s *bank, int noise)
} }
static int static int
sam3_probe(struct flash_bank_s *bank) sam3_probe(struct flash_bank *bank)
{ {
return _sam3_probe(bank, 1); return _sam3_probe(bank, 1);
} }
static int static int
sam3_auto_probe(struct flash_bank_s *bank) sam3_auto_probe(struct flash_bank *bank)
{ {
return _sam3_probe(bank, 0); return _sam3_probe(bank, 0);
} }
@ -1875,7 +1875,7 @@ sam3_auto_probe(struct flash_bank_s *bank)
static int static int
sam3_erase(struct flash_bank_s *bank, int first, int last) sam3_erase(struct flash_bank *bank, int first, int last)
{ {
struct sam3_bank_private *pPrivate; struct sam3_bank_private *pPrivate;
int r; int r;
@ -1907,7 +1907,7 @@ sam3_erase(struct flash_bank_s *bank, int first, int last)
} }
static int static int
sam3_protect(struct flash_bank_s *bank, int set, int first, int last) sam3_protect(struct flash_bank *bank, int set, int first, int last)
{ {
struct sam3_bank_private *pPrivate; struct sam3_bank_private *pPrivate;
int r; int r;
@ -1936,7 +1936,7 @@ sam3_protect(struct flash_bank_s *bank, int set, int first, int last)
static int static int
sam3_info(flash_bank_t *bank, char *buf, int buf_size) sam3_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
if (bank->target->state != TARGET_HALTED) { if (bank->target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted"); LOG_ERROR("Target not halted");
@ -2104,7 +2104,7 @@ sam3_page_write(struct sam3_bank_private *pPrivate, unsigned pagenum, uint8_t *b
static int static int
sam3_write(struct flash_bank_s *bank, sam3_write(struct flash_bank *bank,
uint8_t *buffer, uint8_t *buffer,
uint32_t offset, uint32_t offset,
uint32_t count) uint32_t count)

View File

@ -52,13 +52,13 @@
#include "at91sam7.h" #include "at91sam7.h"
#include "binarybuffer.h" #include "binarybuffer.h"
static int at91sam7_protect_check(struct flash_bank_s *bank); static int at91sam7_protect_check(struct flash_bank *bank);
static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); static int at91sam7_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static uint32_t at91sam7_get_flash_status(struct target *target, int bank_number); static uint32_t at91sam7_get_flash_status(struct target *target, int bank_number);
static void at91sam7_set_flash_mode(struct flash_bank_s *bank, int mode); static void at91sam7_set_flash_mode(struct flash_bank *bank, int mode);
static uint32_t at91sam7_wait_status_busy(struct flash_bank_s *bank, uint32_t waitbits, int timeout); static uint32_t at91sam7_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout);
static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen); static int at91sam7_flash_command(struct flash_bank *bank, uint8_t cmd, uint16_t pagen);
static uint32_t MC_FMR[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 }; static uint32_t MC_FMR[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 };
static uint32_t MC_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 }; static uint32_t MC_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 };
@ -97,7 +97,7 @@ static uint32_t at91sam7_get_flash_status(struct target *target, int bank_number
} }
/* Read clock configuration and set at91sam7_info->mck_freq */ /* Read clock configuration and set at91sam7_info->mck_freq */
static void at91sam7_read_clock_info(flash_bank_t *bank) static void at91sam7_read_clock_info(struct flash_bank *bank)
{ {
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -176,7 +176,7 @@ static void at91sam7_read_clock_info(flash_bank_t *bank)
} }
/* Setup the timimg registers for nvbits or normal flash */ /* Setup the timimg registers for nvbits or normal flash */
static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode) static void at91sam7_set_flash_mode(struct flash_bank *bank, int mode)
{ {
uint32_t fmr, fmcn = 0, fws = 0; uint32_t fmr, fmcn = 0, fws = 0;
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
@ -224,7 +224,7 @@ static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode)
at91sam7_info->flashmode = mode; at91sam7_info->flashmode = mode;
} }
static uint32_t at91sam7_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout) static uint32_t at91sam7_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout)
{ {
uint32_t status; uint32_t status;
@ -251,7 +251,7 @@ static uint32_t at91sam7_wait_status_busy(flash_bank_t *bank, uint32_t waitbits,
} }
/* Send one command to the AT91SAM flash controller */ /* Send one command to the AT91SAM flash controller */
static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen) static int at91sam7_flash_command(struct flash_bank *bank, uint8_t cmd, uint16_t pagen)
{ {
uint32_t fcr; uint32_t fcr;
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
@ -280,9 +280,9 @@ static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16
} }
/* Read device id register, main clock frequency register and fill in driver info structure */ /* Read device id register, main clock frequency register and fill in driver info structure */
static int at91sam7_read_part_info(struct flash_bank_s *bank) static int at91sam7_read_part_info(struct flash_bank *bank)
{ {
flash_bank_t *t_bank = bank; struct flash_bank *t_bank = bank;
struct at91sam7_flash_bank *at91sam7_info; struct at91sam7_flash_bank *at91sam7_info;
struct target *target = t_bank->target; struct target *target = t_bank->target;
@ -304,7 +304,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank)
if (at91sam7_info->cidr != 0) if (at91sam7_info->cidr != 0)
{ {
/* flash already configured, update clock and check for protected sectors */ /* flash already configured, update clock and check for protected sectors */
flash_bank_t *fb = bank; struct flash_bank *fb = bank;
t_bank = fb; t_bank = fb;
while (t_bank) while (t_bank)
@ -336,7 +336,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank)
if (at91sam7_info->flash_autodetection == 0) if (at91sam7_info->flash_autodetection == 0)
{ {
/* banks and sectors are already created, based on data from input file */ /* banks and sectors are already created, based on data from input file */
flash_bank_t *fb = bank; struct flash_bank *fb = bank;
t_bank = fb; t_bank = fb;
while (t_bank) while (t_bank)
{ {
@ -532,7 +532,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank)
if (bnk > 0) if (bnk > 0)
{ {
/* create a new flash bank element */ /* create a new flash bank element */
flash_bank_t *fb = malloc(sizeof(flash_bank_t)); struct flash_bank *fb = malloc(sizeof(struct flash_bank));
fb->target = target; fb->target = target;
fb->driver = bank->driver; fb->driver = bank->driver;
fb->driver_priv = malloc(sizeof(struct at91sam7_flash_bank)); fb->driver_priv = malloc(sizeof(struct at91sam7_flash_bank));
@ -595,7 +595,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int at91sam7_erase_check(struct flash_bank_s *bank) static int at91sam7_erase_check(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint16_t retval; uint16_t retval;
@ -661,7 +661,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int at91sam7_protect_check(struct flash_bank_s *bank) static int at91sam7_protect_check(struct flash_bank *bank)
{ {
uint8_t lock_pos, gpnvm_pos; uint8_t lock_pos, gpnvm_pos;
uint32_t status; uint32_t status;
@ -713,7 +713,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank)
FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command)
{ {
flash_bank_t *t_bank = bank; struct flash_bank *t_bank = bank;
struct at91sam7_flash_bank *at91sam7_info; struct at91sam7_flash_bank *at91sam7_info;
struct target *target = t_bank->target; struct target *target = t_bank->target;
@ -785,7 +785,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command)
if (bnk > 0) if (bnk > 0)
{ {
/* create a new bank element */ /* create a new bank element */
flash_bank_t *fb = malloc(sizeof(flash_bank_t)); struct flash_bank *fb = malloc(sizeof(struct flash_bank));
fb->target = target; fb->target = target;
fb->driver = bank->driver; fb->driver = bank->driver;
fb->driver_priv = malloc(sizeof(struct at91sam7_flash_bank)); fb->driver_priv = malloc(sizeof(struct at91sam7_flash_bank));
@ -827,7 +827,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int at91sam7_erase(struct flash_bank_s *bank, int first, int last) static int at91sam7_erase(struct flash_bank *bank, int first, int last)
{ {
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
int sec; int sec;
@ -895,7 +895,7 @@ static int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last) static int at91sam7_protect(struct flash_bank *bank, int set, int first, int last)
{ {
uint32_t cmd; uint32_t cmd;
int sector; int sector;
@ -945,7 +945,7 @@ static int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int l
return ERROR_OK; return ERROR_OK;
} }
static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int at91sam7_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
int retval; int retval;
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
@ -1014,7 +1014,7 @@ static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o
return ERROR_OK; return ERROR_OK;
} }
static int at91sam7_probe(struct flash_bank_s *bank) static int at91sam7_probe(struct flash_bank *bank)
{ {
/* we can't probe on an at91sam7 /* we can't probe on an at91sam7
* if this is an at91sam7, it has the configured flash */ * if this is an at91sam7, it has the configured flash */
@ -1033,7 +1033,7 @@ static int at91sam7_probe(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size) static int at91sam7_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
int printed; int printed;
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
@ -1100,7 +1100,7 @@ static int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size)
*/ */
COMMAND_HANDLER(at91sam7_handle_gpnvm_command) COMMAND_HANDLER(at91sam7_handle_gpnvm_command)
{ {
flash_bank_t *bank; struct flash_bank *bank;
int bit; int bit;
uint8_t flashcmd; uint8_t flashcmd;
uint32_t status; uint32_t status;

View File

@ -198,19 +198,19 @@ FLASH_BANK_COMMAND_HANDLER(avrf_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int avrf_erase(struct flash_bank_s *bank, int first, int last) static int avrf_erase(struct flash_bank *bank, int first, int last)
{ {
LOG_INFO("%s", __FUNCTION__); LOG_INFO("%s", __FUNCTION__);
return ERROR_OK; return ERROR_OK;
} }
static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last) static int avrf_protect(struct flash_bank *bank, int set, int first, int last)
{ {
LOG_INFO("%s", __FUNCTION__); LOG_INFO("%s", __FUNCTION__);
return ERROR_OK; return ERROR_OK;
} }
static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int avrf_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct avr_common *avr = target->arch_info; struct avr_common *avr = target->arch_info;
@ -261,7 +261,7 @@ static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offse
#define EXTRACT_MFG(X) (((X) & 0xffe) >> 1) #define EXTRACT_MFG(X) (((X) & 0xffe) >> 1)
#define EXTRACT_PART(X) (((X) & 0xffff000) >> 12) #define EXTRACT_PART(X) (((X) & 0xffff000) >> 12)
#define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28) #define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28)
static int avrf_probe(struct flash_bank_s *bank) static int avrf_probe(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct avrf_flash_bank *avrf_info = bank->driver_priv; struct avrf_flash_bank *avrf_info = bank->driver_priv;
@ -329,7 +329,7 @@ static int avrf_probe(struct flash_bank_s *bank)
} }
} }
static int avrf_auto_probe(struct flash_bank_s *bank) static int avrf_auto_probe(struct flash_bank *bank)
{ {
struct avrf_flash_bank *avrf_info = bank->driver_priv; struct avrf_flash_bank *avrf_info = bank->driver_priv;
if (avrf_info->probed) if (avrf_info->probed)
@ -337,13 +337,13 @@ static int avrf_auto_probe(struct flash_bank_s *bank)
return avrf_probe(bank); return avrf_probe(bank);
} }
static int avrf_protect_check(struct flash_bank_s *bank) static int avrf_protect_check(struct flash_bank *bank)
{ {
LOG_INFO("%s", __FUNCTION__); LOG_INFO("%s", __FUNCTION__);
return ERROR_OK; return ERROR_OK;
} }
static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size) static int avrf_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct avr_common *avr = target->arch_info; struct avr_common *avr = target->arch_info;
@ -394,7 +394,7 @@ static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size)
} }
} }
static int avrf_mass_erase(struct flash_bank_s *bank) static int avrf_mass_erase(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct avr_common *avr = target->arch_info; struct avr_common *avr = target->arch_info;
@ -425,7 +425,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;

View File

@ -42,9 +42,9 @@ static struct cfi_unlock_addresses cfi_unlock_addresses[] =
}; };
/* CFI fixups foward declarations */ /* CFI fixups foward declarations */
static void cfi_fixup_0002_erase_regions(flash_bank_t *flash, void *param); static void cfi_fixup_0002_erase_regions(struct flash_bank *flash, void *param);
static void cfi_fixup_0002_unlock_addresses(flash_bank_t *flash, void *param); static void cfi_fixup_0002_unlock_addresses(struct flash_bank *flash, void *param);
static void cfi_fixup_atmel_reversed_erase_regions(flash_bank_t *flash, void *param); static void cfi_fixup_atmel_reversed_erase_regions(struct flash_bank *flash, void *param);
/* fixup after reading cmdset 0002 primary query table */ /* fixup after reading cmdset 0002 primary query table */
static const struct cfi_fixup cfi_0002_fixups[] = { static const struct cfi_fixup cfi_0002_fixups[] = {
@ -67,7 +67,7 @@ static const struct cfi_fixup cfi_0001_fixups[] = {
{0, 0, NULL, NULL} {0, 0, NULL, NULL}
}; };
static void cfi_fixup(flash_bank_t *bank, const struct cfi_fixup *fixups) static void cfi_fixup(struct flash_bank *bank, const struct cfi_fixup *fixups)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
const struct cfi_fixup *f; const struct cfi_fixup *f;
@ -82,8 +82,8 @@ static void cfi_fixup(flash_bank_t *bank, const struct cfi_fixup *fixups)
} }
} }
/* inline uint32_t flash_address(flash_bank_t *bank, int sector, uint32_t offset) */ /* inline uint32_t flash_address(struct flash_bank *bank, int sector, uint32_t offset) */
static __inline__ uint32_t flash_address(flash_bank_t *bank, int sector, uint32_t offset) static __inline__ uint32_t flash_address(struct flash_bank *bank, int sector, uint32_t offset)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -104,7 +104,7 @@ static __inline__ uint32_t flash_address(flash_bank_t *bank, int sector, uint32_
} }
static void cfi_command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf) static void cfi_command(struct flash_bank *bank, uint8_t cmd, uint8_t *cmd_buf)
{ {
int i; int i;
@ -134,7 +134,7 @@ static void cfi_command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf)
* flash banks are expected to be made of similar chips * flash banks are expected to be made of similar chips
* the query result should be the same for all * the query result should be the same for all
*/ */
static uint8_t cfi_query_u8(flash_bank_t *bank, int sector, uint32_t offset) static uint8_t cfi_query_u8(struct flash_bank *bank, int sector, uint32_t offset)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint8_t data[CFI_MAX_BUS_WIDTH]; uint8_t data[CFI_MAX_BUS_WIDTH];
@ -151,7 +151,7 @@ static uint8_t cfi_query_u8(flash_bank_t *bank, int sector, uint32_t offset)
* in case of a bank made of multiple chips, * in case of a bank made of multiple chips,
* the individual values are ORed * the individual values are ORed
*/ */
static uint8_t cfi_get_u8(flash_bank_t *bank, int sector, uint32_t offset) static uint8_t cfi_get_u8(struct flash_bank *bank, int sector, uint32_t offset)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint8_t data[CFI_MAX_BUS_WIDTH]; uint8_t data[CFI_MAX_BUS_WIDTH];
@ -176,7 +176,7 @@ static uint8_t cfi_get_u8(flash_bank_t *bank, int sector, uint32_t offset)
} }
} }
static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset) static uint16_t cfi_query_u16(struct flash_bank *bank, int sector, uint32_t offset)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -198,7 +198,7 @@ static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset)
return data[bank->bus_width - 1] | data[(2 * bank->bus_width) - 1] << 8; return data[bank->bus_width - 1] | data[(2 * bank->bus_width) - 1] << 8;
} }
static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset) static uint32_t cfi_query_u32(struct flash_bank *bank, int sector, uint32_t offset)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -221,7 +221,7 @@ static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset)
data[(3 * bank->bus_width) - 1] << 16 | data[(4 * bank->bus_width) - 1] << 24; data[(3 * bank->bus_width) - 1] << 16 | data[(4 * bank->bus_width) - 1] << 24;
} }
static void cfi_intel_clear_status_register(flash_bank_t *bank) static void cfi_intel_clear_status_register(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint8_t command[8]; uint8_t command[8];
@ -236,7 +236,7 @@ static void cfi_intel_clear_status_register(flash_bank_t *bank)
target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command);
} }
uint8_t cfi_intel_wait_status_busy(flash_bank_t *bank, int timeout) uint8_t cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout)
{ {
uint8_t status; uint8_t status;
@ -277,7 +277,7 @@ uint8_t cfi_intel_wait_status_busy(flash_bank_t *bank, int timeout)
return status; return status;
} }
int cfi_spansion_wait_status_busy(flash_bank_t *bank, int timeout) int cfi_spansion_wait_status_busy(struct flash_bank *bank, int timeout)
{ {
uint8_t status, oldstatus; uint8_t status, oldstatus;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -312,7 +312,7 @@ int cfi_spansion_wait_status_busy(flash_bank_t *bank, int timeout)
return(ERROR_FLASH_BUSY); return(ERROR_FLASH_BUSY);
} }
static int cfi_read_intel_pri_ext(flash_bank_t *bank) static int cfi_read_intel_pri_ext(struct flash_bank *bank)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -378,7 +378,7 @@ static int cfi_read_intel_pri_ext(flash_bank_t *bank)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_read_spansion_pri_ext(flash_bank_t *bank) static int cfi_read_spansion_pri_ext(struct flash_bank *bank)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -443,7 +443,7 @@ static int cfi_read_spansion_pri_ext(flash_bank_t *bank)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_read_atmel_pri_ext(flash_bank_t *bank) static int cfi_read_atmel_pri_ext(struct flash_bank *bank)
{ {
int retval; int retval;
struct cfi_atmel_pri_ext atmel_pri_ext; struct cfi_atmel_pri_ext atmel_pri_ext;
@ -510,7 +510,7 @@ static int cfi_read_atmel_pri_ext(flash_bank_t *bank)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_read_0002_pri_ext(flash_bank_t *bank) static int cfi_read_0002_pri_ext(struct flash_bank *bank)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -524,7 +524,7 @@ static int cfi_read_0002_pri_ext(flash_bank_t *bank)
} }
} }
static int cfi_spansion_info(struct flash_bank_s *bank, char *buf, int buf_size) static int cfi_spansion_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
int printed; int printed;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -559,7 +559,7 @@ static int cfi_spansion_info(struct flash_bank_s *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_intel_info(struct flash_bank_s *bank, char *buf, int buf_size) static int cfi_intel_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
int printed; int printed;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -652,7 +652,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_intel_erase(struct flash_bank_s *bank, int first, int last) static int cfi_intel_erase(struct flash_bank *bank, int first, int last)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -696,7 +696,7 @@ static int cfi_intel_erase(struct flash_bank_s *bank, int first, int last)
} }
static int cfi_spansion_erase(struct flash_bank_s *bank, int first, int last) static int cfi_spansion_erase(struct flash_bank *bank, int first, int last)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -762,7 +762,7 @@ static int cfi_spansion_erase(struct flash_bank_s *bank, int first, int last)
return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command);
} }
static int cfi_erase(struct flash_bank_s *bank, int first, int last) static int cfi_erase(struct flash_bank *bank, int first, int last)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -797,7 +797,7 @@ static int cfi_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int last) static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int last)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -914,7 +914,7 @@ static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int
return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command);
} }
static int cfi_protect(struct flash_bank_s *bank, int set, int first, int last) static int cfi_protect(struct flash_bank *bank, int set, int first, int last)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -947,7 +947,7 @@ static int cfi_protect(struct flash_bank_s *bank, int set, int first, int last)
} }
/* FIXME Replace this by a simple memcpy() - still unsure about sideeffects */ /* FIXME Replace this by a simple memcpy() - still unsure about sideeffects */
static void cfi_add_byte(struct flash_bank_s *bank, uint8_t *word, uint8_t byte) static void cfi_add_byte(struct flash_bank *bank, uint8_t *word, uint8_t byte)
{ {
/* struct target *target = bank->target; */ /* struct target *target = bank->target; */
@ -993,7 +993,7 @@ static void cfi_fix_code_endian(struct target *target, uint8_t *dest, const uint
} }
} }
static uint32_t cfi_command_val(flash_bank_t *bank, uint8_t cmd) static uint32_t cfi_command_val(struct flash_bank *bank, uint8_t cmd)
{ {
struct target *target = bank->target; struct target *target = bank->target;
@ -1016,7 +1016,7 @@ static uint32_t cfi_command_val(flash_bank_t *bank, uint8_t cmd)
} }
} }
static int cfi_intel_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t address, uint32_t count) static int cfi_intel_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t address, uint32_t count)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -1260,7 +1260,7 @@ cleanup:
return retval; return retval;
} }
static int cfi_spansion_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t address, uint32_t count) static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t address, uint32_t count)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext; struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext;
@ -1559,7 +1559,7 @@ static int cfi_spansion_write_block(struct flash_bank_s *bank, uint8_t *buffer,
return exit_code; return exit_code;
} }
static int cfi_intel_write_word(struct flash_bank_s *bank, uint8_t *word, uint32_t address) static int cfi_intel_write_word(struct flash_bank *bank, uint8_t *word, uint32_t address)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -1593,7 +1593,7 @@ static int cfi_intel_write_word(struct flash_bank_s *bank, uint8_t *word, uint32
return ERROR_OK; return ERROR_OK;
} }
static int cfi_intel_write_words(struct flash_bank_s *bank, uint8_t *word, uint32_t wordcount, uint32_t address) static int cfi_intel_write_words(struct flash_bank *bank, uint8_t *word, uint32_t wordcount, uint32_t address)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -1686,7 +1686,7 @@ static int cfi_intel_write_words(struct flash_bank_s *bank, uint8_t *word, uint3
return ERROR_OK; return ERROR_OK;
} }
static int cfi_spansion_write_word(struct flash_bank_s *bank, uint8_t *word, uint32_t address) static int cfi_spansion_write_word(struct flash_bank *bank, uint8_t *word, uint32_t address)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -1732,7 +1732,7 @@ static int cfi_spansion_write_word(struct flash_bank_s *bank, uint8_t *word, uin
return ERROR_OK; return ERROR_OK;
} }
static int cfi_spansion_write_words(struct flash_bank_s *bank, uint8_t *word, uint32_t wordcount, uint32_t address) static int cfi_spansion_write_words(struct flash_bank *bank, uint8_t *word, uint32_t wordcount, uint32_t address)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -1824,7 +1824,7 @@ static int cfi_spansion_write_words(struct flash_bank_s *bank, uint8_t *word, ui
return ERROR_OK; return ERROR_OK;
} }
static int cfi_write_word(struct flash_bank_s *bank, uint8_t *word, uint32_t address) static int cfi_write_word(struct flash_bank *bank, uint8_t *word, uint32_t address)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -1845,7 +1845,7 @@ static int cfi_write_word(struct flash_bank_s *bank, uint8_t *word, uint32_t add
return ERROR_FLASH_OPERATION_FAILED; return ERROR_FLASH_OPERATION_FAILED;
} }
static int cfi_write_words(struct flash_bank_s *bank, uint8_t *word, uint32_t wordcount, uint32_t address) static int cfi_write_words(struct flash_bank *bank, uint8_t *word, uint32_t wordcount, uint32_t address)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -1866,7 +1866,7 @@ static int cfi_write_words(struct flash_bank_s *bank, uint8_t *word, uint32_t wo
return ERROR_FLASH_OPERATION_FAILED; return ERROR_FLASH_OPERATION_FAILED;
} }
int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -2075,7 +2075,7 @@ int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint3
return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word); return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word);
} }
static void cfi_fixup_atmel_reversed_erase_regions(flash_bank_t *bank, void *param) static void cfi_fixup_atmel_reversed_erase_regions(struct flash_bank *bank, void *param)
{ {
(void) param; (void) param;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -2084,7 +2084,7 @@ static void cfi_fixup_atmel_reversed_erase_regions(flash_bank_t *bank, void *par
pri_ext->_reversed_geometry = 1; pri_ext->_reversed_geometry = 1;
} }
static void cfi_fixup_0002_erase_regions(flash_bank_t *bank, void *param) static void cfi_fixup_0002_erase_regions(struct flash_bank *bank, void *param)
{ {
int i; int i;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -2107,7 +2107,7 @@ static void cfi_fixup_0002_erase_regions(flash_bank_t *bank, void *param)
} }
} }
static void cfi_fixup_0002_unlock_addresses(flash_bank_t *bank, void *param) static void cfi_fixup_0002_unlock_addresses(struct flash_bank *bank, void *param)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext; struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext;
@ -2118,7 +2118,7 @@ static void cfi_fixup_0002_unlock_addresses(flash_bank_t *bank, void *param)
} }
static int cfi_query_string(struct flash_bank_s *bank, int address) static int cfi_query_string(struct flash_bank *bank, int address)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -2156,7 +2156,7 @@ static int cfi_query_string(struct flash_bank_s *bank, int address)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_probe(struct flash_bank_s *bank) static int cfi_probe(struct flash_bank *bank)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -2435,7 +2435,7 @@ static int cfi_probe(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_auto_probe(struct flash_bank_s *bank) static int cfi_auto_probe(struct flash_bank *bank)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
if (cfi_info->probed) if (cfi_info->probed)
@ -2444,7 +2444,7 @@ static int cfi_auto_probe(struct flash_bank_s *bank)
} }
static int cfi_intel_protect_check(struct flash_bank_s *bank) static int cfi_intel_protect_check(struct flash_bank *bank)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -2477,7 +2477,7 @@ static int cfi_intel_protect_check(struct flash_bank_s *bank)
return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command);
} }
static int cfi_spansion_protect_check(struct flash_bank_s *bank) static int cfi_spansion_protect_check(struct flash_bank *bank)
{ {
int retval; int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -2518,7 +2518,7 @@ static int cfi_spansion_protect_check(struct flash_bank_s *bank)
return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command);
} }
static int cfi_protect_check(struct flash_bank_s *bank) static int cfi_protect_check(struct flash_bank *bank)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
@ -2548,7 +2548,7 @@ static int cfi_protect_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int cfi_info(struct flash_bank_s *bank, char *buf, int buf_size) static int cfi_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
int printed; int printed;
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;

View File

@ -146,7 +146,7 @@ struct cfi_fixup
{ {
uint16_t mfr; uint16_t mfr;
uint16_t id; uint16_t id;
void (*fixup)(flash_bank_t *flash, void *param); void (*fixup)(struct flash_bank *flash, void *param);
void *param; void *param;
}; };

View File

@ -27,9 +27,9 @@
#if 0 #if 0
static uint32_t ecosflash_get_flash_status(flash_bank_t *bank); static uint32_t ecosflash_get_flash_status(struct flash_bank *bank);
static void ecosflash_set_flash_mode(flash_bank_t *bank,int mode); static void ecosflash_set_flash_mode(struct flash_bank *bank,int mode);
static uint32_t ecosflash_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout); static uint32_t ecosflash_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout);
static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
#endif #endif
@ -329,7 +329,7 @@ static int eCosBoard_flash(struct ecosflash_flash_bank *info, void *data, uint32
return ERROR_OK; return ERROR_OK;
} }
static int ecosflash_probe(struct flash_bank_s *bank) static int ecosflash_probe(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
@ -342,7 +342,7 @@ static int ecosflash_register_commands(struct command_context_s *cmd_ctx)
} }
#if 0 #if 0
static void command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf) static void command(struct flash_bank *bank, uint8_t cmd, uint8_t *cmd_buf)
{ {
struct ecosflash_flash_bank *info = bank->driver_priv; struct ecosflash_flash_bank *info = bank->driver_priv;
int i; int i;
@ -365,7 +365,7 @@ static void command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf)
#endif #endif
#if 0 #if 0
static uint32_t ecosflash_address(struct flash_bank_s *bank, uint32_t address) static uint32_t ecosflash_address(struct flash_bank *bank, uint32_t address)
{ {
uint32_t retval = 0; uint32_t retval = 0;
switch (bank->bus_width) switch (bank->bus_width)
@ -382,31 +382,31 @@ static uint32_t ecosflash_address(struct flash_bank_s *bank, uint32_t address)
} }
#endif #endif
static int ecosflash_erase(struct flash_bank_s *bank, int first, int last) static int ecosflash_erase(struct flash_bank *bank, int first, int last)
{ {
struct flash_bank_s *c = bank; struct flash_bank *c = bank;
struct ecosflash_flash_bank *info = bank->driver_priv; struct ecosflash_flash_bank *info = bank->driver_priv;
return eCosBoard_erase(info, c->base + first*sectorSize, sectorSize*(last-first + 1)); return eCosBoard_erase(info, c->base + first*sectorSize, sectorSize*(last-first + 1));
} }
static int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last) static int ecosflash_protect(struct flash_bank *bank, int set, int first, int last)
{ {
return ERROR_OK; return ERROR_OK;
} }
static int ecosflash_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int ecosflash_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct ecosflash_flash_bank *info = bank->driver_priv; struct ecosflash_flash_bank *info = bank->driver_priv;
struct flash_bank_s *c = bank; struct flash_bank *c = bank;
return eCosBoard_flash(info, buffer, c->base + offset, count); return eCosBoard_flash(info, buffer, c->base + offset, count);
} }
static int ecosflash_protect_check(struct flash_bank_s *bank) static int ecosflash_protect_check(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
static int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size) static int ecosflash_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
struct ecosflash_flash_bank *info = bank->driver_priv; struct ecosflash_flash_bank *info = bank->driver_priv;
snprintf(buf, buf_size, "eCos flash driver: %s", info->driverPath); snprintf(buf, buf_size, "eCos flash driver: %s", info->driverPath);
@ -414,17 +414,17 @@ static int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size)
} }
#if 0 #if 0
static uint32_t ecosflash_get_flash_status(flash_bank_t *bank) static uint32_t ecosflash_get_flash_status(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
static void ecosflash_set_flash_mode(flash_bank_t *bank,int mode) static void ecosflash_set_flash_mode(struct flash_bank *bank,int mode)
{ {
} }
static uint32_t ecosflash_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout) static uint32_t ecosflash_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout)
{ {
return ERROR_OK; return ERROR_OK;
} }

View File

@ -92,38 +92,38 @@ static int faux_register_commands(struct command_context_s *cmd_ctx)
return ERROR_OK; return ERROR_OK;
} }
static int faux_erase(struct flash_bank_s *bank, int first, int last) static int faux_erase(struct flash_bank *bank, int first, int last)
{ {
struct faux_flash_bank *info = bank->driver_priv; struct faux_flash_bank *info = bank->driver_priv;
memset(info->memory + first*sectorSize, 0xff, sectorSize*(last-first + 1)); memset(info->memory + first*sectorSize, 0xff, sectorSize*(last-first + 1));
return ERROR_OK; return ERROR_OK;
} }
static int faux_protect(struct flash_bank_s *bank, int set, int first, int last) static int faux_protect(struct flash_bank *bank, int set, int first, int last)
{ {
LOG_USER("set protection sector %d to %d to %s", first, last, set?"on":"off"); LOG_USER("set protection sector %d to %d to %s", first, last, set?"on":"off");
return ERROR_OK; return ERROR_OK;
} }
static int faux_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int faux_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct faux_flash_bank *info = bank->driver_priv; struct faux_flash_bank *info = bank->driver_priv;
memcpy(info->memory + offset, buffer, count); memcpy(info->memory + offset, buffer, count);
return ERROR_OK; return ERROR_OK;
} }
static int faux_protect_check(struct flash_bank_s *bank) static int faux_protect_check(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
static int faux_info(struct flash_bank_s *bank, char *buf, int buf_size) static int faux_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
snprintf(buf, buf_size, "faux flash driver"); snprintf(buf, buf_size, "faux flash driver");
return ERROR_OK; return ERROR_OK;
} }
static int faux_probe(struct flash_bank_s *bank) static int faux_probe(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }

View File

@ -76,11 +76,11 @@ struct flash_driver *flash_drivers[] = {
NULL, NULL,
}; };
flash_bank_t *flash_banks; struct flash_bank *flash_banks;
static command_t *flash_cmd; static command_t *flash_cmd;
/* wafer thin wrapper for invoking the flash driver */ /* wafer thin wrapper for invoking the flash driver */
static int flash_driver_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int flash_driver_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
int retval; int retval;
@ -94,7 +94,7 @@ static int flash_driver_write(struct flash_bank_s *bank, uint8_t *buffer, uint32
return retval; return retval;
} }
static int flash_driver_erase(struct flash_bank_s *bank, int first, int last) static int flash_driver_erase(struct flash_bank *bank, int first, int last)
{ {
int retval; int retval;
@ -107,7 +107,7 @@ static int flash_driver_erase(struct flash_bank_s *bank, int first, int last)
return retval; return retval;
} }
int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last) int flash_driver_protect(struct flash_bank *bank, int set, int first, int last)
{ {
int retval; int retval;
@ -122,7 +122,7 @@ int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last
static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv) static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{ {
flash_bank_t *p; struct flash_bank *p;
if (argc != 1) { if (argc != 1) {
Jim_WrongNumArgs(interp, 1, argv, "no arguments to flash_banks command"); Jim_WrongNumArgs(interp, 1, argv, "no arguments to flash_banks command");
@ -153,9 +153,9 @@ static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK; return JIM_OK;
} }
flash_bank_t *get_flash_bank_by_num_noprobe(int num) struct flash_bank *get_flash_bank_by_num_noprobe(int num)
{ {
flash_bank_t *p; struct flash_bank *p;
int i = 0; int i = 0;
for (p = flash_banks; p; p = p->next) for (p = flash_banks; p; p = p->next)
@ -171,7 +171,7 @@ flash_bank_t *get_flash_bank_by_num_noprobe(int num)
int flash_get_bank_count(void) int flash_get_bank_count(void)
{ {
flash_bank_t *p; struct flash_bank *p;
int i = 0; int i = 0;
for (p = flash_banks; p; p = p->next) for (p = flash_banks; p; p = p->next)
{ {
@ -180,9 +180,9 @@ int flash_get_bank_count(void)
return i; return i;
} }
flash_bank_t *get_flash_bank_by_num(int num) struct flash_bank *get_flash_bank_by_num(int num)
{ {
flash_bank_t *p = get_flash_bank_by_num_noprobe(num); struct flash_bank *p = get_flash_bank_by_num_noprobe(num);
int retval; int retval;
if (p == NULL) if (p == NULL)
@ -199,7 +199,7 @@ flash_bank_t *get_flash_bank_by_num(int num)
} }
int flash_command_get_bank_by_num( int flash_command_get_bank_by_num(
struct command_context_s *cmd_ctx, const char *str, flash_bank_t **bank) struct command_context_s *cmd_ctx, const char *str, struct flash_bank **bank)
{ {
unsigned bank_num; unsigned bank_num;
COMMAND_PARSE_NUMBER(uint, str, bank_num); COMMAND_PARSE_NUMBER(uint, str, bank_num);
@ -238,7 +238,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
if (strcmp(args[0], flash_drivers[i]->name) != 0) if (strcmp(args[0], flash_drivers[i]->name) != 0)
continue; continue;
flash_bank_t *p, *c; struct flash_bank *p, *c;
/* register flash specific commands */ /* register flash specific commands */
if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK) if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
@ -247,7 +247,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
return ERROR_FAIL; return ERROR_FAIL;
} }
c = malloc(sizeof(flash_bank_t)); c = malloc(sizeof(struct flash_bank));
c->target = target; c->target = target;
c->driver = flash_drivers[i]; c->driver = flash_drivers[i];
c->driver_priv = NULL; c->driver_priv = NULL;
@ -298,7 +298,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
COMMAND_HANDLER(handle_flash_info_command) COMMAND_HANDLER(handle_flash_info_command)
{ {
flash_bank_t *p; struct flash_bank *p;
uint32_t i = 0; uint32_t i = 0;
int j = 0; int j = 0;
int retval; int retval;
@ -369,7 +369,7 @@ COMMAND_HANDLER(handle_flash_probe_command)
unsigned bank_nr; unsigned bank_nr;
COMMAND_PARSE_NUMBER(uint, args[0], bank_nr); COMMAND_PARSE_NUMBER(uint, args[0], bank_nr);
flash_bank_t *p = get_flash_bank_by_num_noprobe(bank_nr); struct flash_bank *p = get_flash_bank_by_num_noprobe(bank_nr);
if (p) if (p)
{ {
if ((retval = p->driver->probe(p)) == ERROR_OK) if ((retval = p->driver->probe(p)) == ERROR_OK)
@ -402,7 +402,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
flash_bank_t *p; struct flash_bank *p;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -443,7 +443,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
COMMAND_HANDLER(handle_flash_erase_address_command) COMMAND_HANDLER(handle_flash_erase_address_command)
{ {
flash_bank_t *p; struct flash_bank *p;
int retval; int retval;
int address; int address;
int length; int length;
@ -490,7 +490,7 @@ COMMAND_HANDLER(handle_flash_protect_check_command)
if (argc != 1) if (argc != 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
flash_bank_t *p; struct flash_bank *p;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -539,7 +539,7 @@ COMMAND_HANDLER(handle_flash_erase_command)
uint32_t last; uint32_t last;
COMMAND_PARSE_NUMBER(u32, args[0], bank_nr); COMMAND_PARSE_NUMBER(u32, args[0], bank_nr);
flash_bank_t *p = get_flash_bank_by_num(bank_nr); struct flash_bank *p = get_flash_bank_by_num(bank_nr);
if (!p) if (!p)
return ERROR_OK; return ERROR_OK;
@ -580,7 +580,7 @@ COMMAND_HANDLER(handle_flash_protect_command)
int set; int set;
COMMAND_PARSE_NUMBER(u32, args[0], bank_nr); COMMAND_PARSE_NUMBER(u32, args[0], bank_nr);
flash_bank_t *p = get_flash_bank_by_num(bank_nr); struct flash_bank *p = get_flash_bank_by_num(bank_nr);
if (!p) if (!p)
return ERROR_OK; return ERROR_OK;
@ -772,7 +772,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
for (wrote = 0; wrote < (count*wordsize); wrote += cur_size) for (wrote = 0; wrote < (count*wordsize); wrote += cur_size)
{ {
cur_size = MIN((count*wordsize - wrote), sizeof(chunk)); cur_size = MIN((count*wordsize - wrote), sizeof(chunk));
flash_bank_t *bank; struct flash_bank *bank;
bank = get_flash_bank_by_addr(target, address); bank = get_flash_bank_by_addr(target, address);
if (bank == NULL) if (bank == NULL)
{ {
@ -820,7 +820,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
struct duration bench; struct duration bench;
duration_start(&bench); duration_start(&bench);
flash_bank_t *p; struct flash_bank *p;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -860,7 +860,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
void flash_set_dirty(void) void flash_set_dirty(void)
{ {
flash_bank_t *c; struct flash_bank *c;
int i; int i;
/* set all flash to require erasing */ /* set all flash to require erasing */
@ -874,9 +874,9 @@ void flash_set_dirty(void)
} }
/* lookup flash bank by address */ /* lookup flash bank by address */
struct flash_bank_s *get_flash_bank_by_addr(struct target *target, uint32_t addr) struct flash_bank *get_flash_bank_by_addr(struct target *target, uint32_t addr)
{ {
flash_bank_t *c; struct flash_bank *c;
/* cycle through bank list */ /* cycle through bank list */
for (c = flash_banks; c; c = c->next) for (c = flash_banks; c; c = c->next)
@ -899,9 +899,9 @@ struct flash_bank_s *get_flash_bank_by_addr(struct target *target, uint32_t addr
/* erase given flash region, selects proper bank according to target and address */ /* erase given flash region, selects proper bank according to target and address */
static int flash_iterate_address_range(struct target *target, uint32_t addr, uint32_t length, static int flash_iterate_address_range(struct target *target, uint32_t addr, uint32_t length,
int (*callback)(struct flash_bank_s *bank, int first, int last)) int (*callback)(struct flash_bank *bank, int first, int last))
{ {
flash_bank_t *c; struct flash_bank *c;
int first = -1; int first = -1;
int last = -1; int last = -1;
int i; int i;
@ -954,7 +954,7 @@ int flash_erase_address_range(struct target *target, uint32_t addr, uint32_t len
return flash_iterate_address_range(target, addr, length, &flash_driver_erase); return flash_iterate_address_range(target, addr, length, &flash_driver_erase);
} }
static int flash_driver_unprotect(struct flash_bank_s *bank, int first, int last) static int flash_driver_unprotect(struct flash_bank *bank, int first, int last)
{ {
return flash_driver_protect(bank, 0, first, last); return flash_driver_protect(bank, 0, first, last);
} }
@ -972,7 +972,7 @@ static int flash_write_unlock(struct target *target, struct image *image, uint32
int section; int section;
uint32_t section_offset; uint32_t section_offset;
flash_bank_t *c; struct flash_bank *c;
int *padding; int *padding;
section = 0; section = 0;
@ -1130,7 +1130,7 @@ int flash_write(struct target *target, struct image *image, uint32_t *written, i
return flash_write_unlock(target, image, written, erase, false); return flash_write_unlock(target, image, written, erase, false);
} }
int default_flash_mem_blank_check(struct flash_bank_s *bank) int default_flash_mem_blank_check(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint8_t buffer[1024]; uint8_t buffer[1024];
@ -1177,7 +1177,7 @@ int default_flash_mem_blank_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
int default_flash_blank_check(struct flash_bank_s *bank) int default_flash_blank_check(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
int i; int i;

View File

@ -57,10 +57,10 @@ struct flash_sector
int is_protected; int is_protected;
}; };
struct flash_bank_s; struct flash_bank;
#define __FLASH_BANK_COMMAND(name) \ #define __FLASH_BANK_COMMAND(name) \
COMMAND_HELPER(name, struct flash_bank_s *bank) COMMAND_HELPER(name, struct flash_bank *bank)
/** /**
* @brief Provides the implementation-independent structure that defines * @brief Provides the implementation-independent structure that defines
@ -103,7 +103,7 @@ struct flash_driver
* Finish the "flash bank" command for @a bank. The * Finish the "flash bank" command for @a bank. The
* @a bank parameter will have been filled in by the core flash * @a bank parameter will have been filled in by the core flash
* layer when this routine is called, and the driver can store * layer when this routine is called, and the driver can store
* additional information in its flash_bank_t::driver_priv field. * additional information in its struct flash_bank::driver_priv field.
* *
* The args are: @par * The args are: @par
* @code * @code
@ -136,7 +136,7 @@ struct flash_driver
* @param last The number of the last sector to erase, typically N-1. * @param last The number of the last sector to erase, typically N-1.
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int (*erase)(struct flash_bank_s *bank, int first, int last); int (*erase)(struct flash_bank *bank, int first, int last);
/** /**
* Bank/sector protection routine (target-specific). * Bank/sector protection routine (target-specific).
@ -150,7 +150,7 @@ struct flash_driver
* @param last The last sector to (un)project, typically N-1. * @param last The last sector to (un)project, typically N-1.
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int (*protect)(struct flash_bank_s *bank, int set, int first, int last); int (*protect)(struct flash_bank *bank, int set, int first, int last);
/** /**
* Program data into the flash. Note CPU address will be * Program data into the flash. Note CPU address will be
@ -163,7 +163,7 @@ struct flash_driver
* @param count The number of bytes to write. * @param count The number of bytes to write.
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int (*write)(struct flash_bank_s *bank, int (*write)(struct flash_bank *bank,
uint8_t *buffer, uint32_t offset, uint32_t count); uint8_t *buffer, uint32_t offset, uint32_t count);
/** /**
@ -173,7 +173,7 @@ struct flash_driver
* @param bank The bank to probe * @param bank The bank to probe
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int (*probe)(struct flash_bank_s *bank); int (*probe)(struct flash_bank *bank);
/** /**
* Check the erasure status of a flash bank. * Check the erasure status of a flash bank.
@ -184,7 +184,7 @@ struct flash_driver
* @param bank The bank to check * @param bank The bank to check
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int (*erase_check)(struct flash_bank_s *bank); int (*erase_check)(struct flash_bank *bank);
/** /**
* Determine if the specific bank is "protected" or not. * Determine if the specific bank is "protected" or not.
@ -196,7 +196,7 @@ struct flash_driver
* @param bank - the bank to check * @param bank - the bank to check
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int (*protect_check)(struct flash_bank_s *bank); int (*protect_check)(struct flash_bank *bank);
/** /**
* Display human-readable information about the flash * Display human-readable information about the flash
@ -208,7 +208,7 @@ struct flash_driver
* @param buf_size - the size of the human buffer. * @param buf_size - the size of the human buffer.
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int (*info)(struct flash_bank_s *bank, char *buf, int buf_size); int (*info)(struct flash_bank *bank, char *buf, int buf_size);
/** /**
* A more gentle flavor of filash_driver_s::probe, performing * A more gentle flavor of filash_driver_s::probe, performing
@ -223,7 +223,7 @@ struct flash_driver
* @param bank - the bank to probe * @param bank - the bank to probe
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int (*auto_probe)(struct flash_bank_s *bank); int (*auto_probe)(struct flash_bank *bank);
}; };
#define FLASH_BANK_COMMAND_HANDLER(name) static __FLASH_BANK_COMMAND(name) #define FLASH_BANK_COMMAND_HANDLER(name) static __FLASH_BANK_COMMAND(name)
@ -238,7 +238,7 @@ struct flash_driver
* may use the @c driver_priv member to store additional data on a * may use the @c driver_priv member to store additional data on a
* per-bank basis, if required. * per-bank basis, if required.
*/ */
typedef struct flash_bank_s struct flash_bank
{ {
struct target *target; /**< Target to which this bank belongs. */ struct target *target; /**< Target to which this bank belongs. */
@ -261,8 +261,8 @@ typedef struct flash_bank_s
/// Array of sectors, allocated and initilized by the flash driver /// Array of sectors, allocated and initilized by the flash driver
struct flash_sector *sectors; struct flash_sector *sectors;
struct flash_bank_s *next; /**< The next flash bank on this chip */ struct flash_bank *next; /**< The next flash bank on this chip */
} flash_bank_t; };
/// Registers the 'flash' subsystem commands /// Registers the 'flash' subsystem commands
int flash_register_commands(struct command_context_s *cmd_ctx); int flash_register_commands(struct command_context_s *cmd_ctx);
@ -300,21 +300,21 @@ int flash_get_bank_count(void);
* this routine will call default_flash_mem_blank_check() to confirm. * this routine will call default_flash_mem_blank_check() to confirm.
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int default_flash_blank_check(struct flash_bank_s *bank); int default_flash_blank_check(struct flash_bank *bank);
/** /**
* Provides a default blank flash memory check. Ensures the contents * Provides a default blank flash memory check. Ensures the contents
* of the given bank have truly been erased. * of the given bank have truly been erased.
* @param bank The flash bank. * @param bank The flash bank.
* @returns ERROR_OK if successful; otherwise, an error code. * @returns ERROR_OK if successful; otherwise, an error code.
*/ */
int default_flash_mem_blank_check(struct flash_bank_s *bank); int default_flash_mem_blank_check(struct flash_bank *bank);
/** /**
* Returns a flash bank by the specified flash_bank_s bank_number, @a num. * Returns a flash bank by the specified flash_bank_s bank_number, @a num.
* @param num The flash bank number. * @param num The flash bank number.
* @returns A flash_bank_t for flash bank @a num, or NULL * @returns A struct flash_bank for flash bank @a num, or NULL
*/ */
flash_bank_t *get_flash_bank_by_num(int num); struct flash_bank *get_flash_bank_by_num(int num);
/** /**
* Retreives @a bank from a command argument, reporting errors parsing * Retreives @a bank from a command argument, reporting errors parsing
* the bank identifier or retreiving the specified bank. * the bank identifier or retreiving the specified bank.
@ -324,20 +324,20 @@ flash_bank_t *get_flash_bank_by_num(int num);
* @returns ERROR_OK on success, or an error indicating the problem. * @returns ERROR_OK on success, or an error indicating the problem.
*/ */
int flash_command_get_bank_by_num(struct command_context_s *cmd_ctx, int flash_command_get_bank_by_num(struct command_context_s *cmd_ctx,
const char *str, flash_bank_t **bank); const char *str, struct flash_bank **bank);
/** /**
* Returns the flash bank like get_flash_bank_by_num(), without probing. * Returns the flash bank like get_flash_bank_by_num(), without probing.
* @param num The flash bank number. * @param num The flash bank number.
* @returns A flash_bank_t for flash bank @a num, or NULL. * @returns A struct flash_bank for flash bank @a num, or NULL.
*/ */
flash_bank_t *get_flash_bank_by_num_noprobe(int num); struct flash_bank *get_flash_bank_by_num_noprobe(int num);
/** /**
* Returns the flash bank located at a specified address. * Returns the flash bank located at a specified address.
* @param target The target, presumed to contain one or more banks. * @param target The target, presumed to contain one or more banks.
* @param addr An address that is within the range of the bank. * @param addr An address that is within the range of the bank.
* @returns The flash_bank_t located at @a addr, or NULL. * @returns The struct flash_bank located at @a addr, or NULL.
*/ */
struct flash_bank_s *get_flash_bank_by_addr(struct target *target, uint32_t addr); struct flash_bank *get_flash_bank_by_addr(struct target *target, uint32_t addr);
#define ERROR_FLASH_BANK_INVALID (-900) #define ERROR_FLASH_BANK_INVALID (-900)
#define ERROR_FLASH_SECTOR_INVALID (-901) #define ERROR_FLASH_SECTOR_INVALID (-901)

View File

@ -53,7 +53,7 @@
* - 176x (tested with LPC1768) * - 176x (tested with LPC1768)
*/ */
static int lpc2000_build_sector_list(struct flash_bank_s *bank) static int lpc2000_build_sector_list(struct flash_bank *bank)
{ {
struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv; struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
int i; int i;
@ -234,7 +234,7 @@ static int lpc2000_build_sector_list(struct flash_bank_s *bank)
* 0x20 to 0x33: command result table (1+4 words) * 0x20 to 0x33: command result table (1+4 words)
* 0x34 to 0xb3: stack (only 128b needed) * 0x34 to 0xb3: stack (only 128b needed)
*/ */
static int lpc2000_iap_call(flash_bank_t *bank, int code, uint32_t param_table[5], uint32_t result_table[4]) static int lpc2000_iap_call(struct flash_bank *bank, int code, uint32_t param_table[5], uint32_t result_table[4])
{ {
int retval; int retval;
struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv; struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
@ -375,7 +375,7 @@ static int lpc2000_iap_call(flash_bank_t *bank, int code, uint32_t param_table[5
return status_code; return status_code;
} }
static int lpc2000_iap_blank_check(struct flash_bank_s *bank, int first, int last) static int lpc2000_iap_blank_check(struct flash_bank *bank, int first, int last)
{ {
uint32_t param_table[5]; uint32_t param_table[5];
uint32_t result_table[4]; uint32_t result_table[4];
@ -477,7 +477,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int lpc2000_erase(struct flash_bank_s *bank, int first, int last) static int lpc2000_erase(struct flash_bank *bank, int first, int last)
{ {
struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv; struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
uint32_t param_table[5]; uint32_t param_table[5];
@ -529,13 +529,13 @@ static int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int lpc2000_protect(struct flash_bank_s *bank, int set, int first, int last) static int lpc2000_protect(struct flash_bank *bank, int set, int first, int last)
{ {
/* can't protect/unprotect on the lpc2000 */ /* can't protect/unprotect on the lpc2000 */
return ERROR_OK; return ERROR_OK;
} }
static int lpc2000_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int lpc2000_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv; struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -703,7 +703,7 @@ static int lpc2000_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
return retval; return retval;
} }
static int lpc2000_probe(struct flash_bank_s *bank) static int lpc2000_probe(struct flash_bank *bank)
{ {
/* we can't probe on an lpc2000 /* we can't probe on an lpc2000
* if this is an lpc2xxx, it has the configured flash * if this is an lpc2xxx, it has the configured flash
@ -711,7 +711,7 @@ static int lpc2000_probe(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int lpc2000_erase_check(struct flash_bank_s *bank) static int lpc2000_erase_check(struct flash_bank *bank)
{ {
if (bank->target->state != TARGET_HALTED) if (bank->target->state != TARGET_HALTED)
{ {
@ -722,13 +722,13 @@ static int lpc2000_erase_check(struct flash_bank_s *bank)
return lpc2000_iap_blank_check(bank, 0, bank->num_sectors - 1); return lpc2000_iap_blank_check(bank, 0, bank->num_sectors - 1);
} }
static int lpc2000_protect_check(struct flash_bank_s *bank) static int lpc2000_protect_check(struct flash_bank *bank)
{ {
/* sectors are always protected */ /* sectors are always protected */
return ERROR_OK; return ERROR_OK;
} }
static int lpc2000_info(struct flash_bank_s *bank, char *buf, int buf_size) static int lpc2000_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv; struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
@ -748,7 +748,7 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;

View File

@ -84,12 +84,12 @@
/* F_CLK_TIME */ /* F_CLK_TIME */
#define FCT_CLK_DIV_MASK 0x0FFF #define FCT_CLK_DIV_MASK 0x0FFF
static uint32_t lpc288x_wait_status_busy(struct flash_bank_s *bank, int timeout); 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_load_timer(int erase, struct target *target);
static void lpc288x_set_flash_clk(struct flash_bank_s *bank); static void lpc288x_set_flash_clk(struct flash_bank *bank);
static uint32_t lpc288x_system_ready(struct flash_bank_s *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; uint32_t status;
struct target *target = bank->target; struct target *target = bank->target;
@ -109,7 +109,7 @@ static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout)
} }
/* Read device id register and fill in driver info structure */ /* 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)
{ {
struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv; struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -159,7 +159,7 @@ static int lpc288x_read_part_info(struct flash_bank_s *bank)
return ERROR_OK; 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; return ERROR_OK;
} }
@ -190,7 +190,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc288x_flash_bank_command)
* AHB = 12 MHz ? * AHB = 12 MHz ?
* 12000000/66000 = 182 * 12000000/66000 = 182
* CLK_DIV = 60 ? */ * 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; uint32_t clk_time;
struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv; struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv;
@ -217,7 +217,7 @@ static void lpc288x_load_timer(int erase, struct target *target)
} }
} }
static uint32_t lpc288x_system_ready(struct flash_bank_s *bank) static uint32_t lpc288x_system_ready(struct flash_bank *bank)
{ {
struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv; struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv;
if (lpc288x_info->cidr == 0) if (lpc288x_info->cidr == 0)
@ -233,7 +233,7 @@ static uint32_t lpc288x_system_ready(struct flash_bank_s *bank)
return ERROR_OK; 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? */ uint32_t status = lpc288x_system_ready(bank); /* probed? halted? */
if (status != ERROR_OK) if (status != ERROR_OK)
@ -245,7 +245,7 @@ static int lpc288x_erase_check(struct flash_bank_s *bank)
return ERROR_OK; 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; uint32_t status;
int sector; int sector;
@ -286,7 +286,7 @@ static int lpc288x_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; 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]; uint8_t page_buffer[FLASH_PAGE_SIZE];
uint32_t status, source_offset,dest_offset; uint32_t status, source_offset,dest_offset;
@ -402,7 +402,7 @@ static int lpc288x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
return ERROR_OK; 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 */ /* we only deal with LPC2888 so flash config is fixed */
struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv; struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv;
@ -425,13 +425,13 @@ static int lpc288x_probe(struct flash_bank_s *bank)
return ERROR_OK; 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"); snprintf(buf, buf_size, "lpc288x flash driver");
return ERROR_OK; 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; int lockregion, status;
uint32_t value; uint32_t value;

View File

@ -171,14 +171,14 @@ struct lpc2900_flash_bank
}; };
static uint32_t lpc2900_wait_status(flash_bank_t *bank, uint32_t mask, int timeout); static uint32_t lpc2900_wait_status(struct flash_bank *bank, uint32_t mask, int timeout);
static void lpc2900_setup(struct flash_bank_s *bank); static void lpc2900_setup(struct flash_bank *bank);
static uint32_t lpc2900_is_ready(struct flash_bank_s *bank); static uint32_t lpc2900_is_ready(struct flash_bank *bank);
static uint32_t lpc2900_read_security_status(struct flash_bank_s *bank); static uint32_t lpc2900_read_security_status(struct flash_bank *bank);
static uint32_t lpc2900_run_bist128(struct flash_bank_s *bank, static uint32_t lpc2900_run_bist128(struct flash_bank *bank,
uint32_t addr_from, uint32_t addr_to, uint32_t addr_from, uint32_t addr_to,
uint32_t (*signature)[4] ); uint32_t (*signature)[4] );
static uint32_t lpc2900_address2sector(struct flash_bank_s *bank, uint32_t offset); static uint32_t lpc2900_address2sector(struct flash_bank *bank, uint32_t offset);
static uint32_t lpc2900_calc_tr( uint32_t clock, uint32_t time ); static uint32_t lpc2900_calc_tr( uint32_t clock, uint32_t time );
@ -194,7 +194,7 @@ static uint32_t lpc2900_calc_tr( uint32_t clock, uint32_t time );
* @param[in] mask Mask to be used for INT_STATUS * @param[in] mask Mask to be used for INT_STATUS
* @param[in] timeout Timeout in ms * @param[in] timeout Timeout in ms
*/ */
static uint32_t lpc2900_wait_status( flash_bank_t *bank, static uint32_t lpc2900_wait_status( struct flash_bank *bank,
uint32_t mask, uint32_t mask,
int timeout ) int timeout )
{ {
@ -228,7 +228,7 @@ static uint32_t lpc2900_wait_status( flash_bank_t *bank,
* *
* @param bank Pointer to the flash bank descriptor * @param bank Pointer to the flash bank descriptor
*/ */
static void lpc2900_setup( struct flash_bank_s *bank ) static void lpc2900_setup( struct flash_bank *bank )
{ {
uint32_t fcra; uint32_t fcra;
struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv; struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
@ -251,7 +251,7 @@ static void lpc2900_setup( struct flash_bank_s *bank )
* Must have been successfully probed. * Must have been successfully probed.
* Must be halted. * Must be halted.
*/ */
static uint32_t lpc2900_is_ready( struct flash_bank_s *bank ) static uint32_t lpc2900_is_ready( struct flash_bank *bank )
{ {
struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv; struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
@ -275,7 +275,7 @@ static uint32_t lpc2900_is_ready( struct flash_bank_s *bank )
* *
* @param bank Pointer to the flash bank descriptor * @param bank Pointer to the flash bank descriptor
*/ */
static uint32_t lpc2900_read_security_status( struct flash_bank_s *bank ) static uint32_t lpc2900_read_security_status( struct flash_bank *bank )
{ {
uint32_t status; uint32_t status;
if( (status = lpc2900_is_ready( bank )) != ERROR_OK ) if( (status = lpc2900_is_ready( bank )) != ERROR_OK )
@ -356,7 +356,7 @@ static uint32_t lpc2900_read_security_status( struct flash_bank_s *bank )
* @param addr_to * @param addr_to
* @param signature * @param signature
*/ */
static uint32_t lpc2900_run_bist128(struct flash_bank_s *bank, static uint32_t lpc2900_run_bist128(struct flash_bank *bank,
uint32_t addr_from, uint32_t addr_from,
uint32_t addr_to, uint32_t addr_to,
uint32_t (*signature)[4] ) uint32_t (*signature)[4] )
@ -393,7 +393,7 @@ static uint32_t lpc2900_run_bist128(struct flash_bank_s *bank,
* @param bank Pointer to the flash bank descriptor * @param bank Pointer to the flash bank descriptor
* @param offset Offset address relative to bank start * @param offset Offset address relative to bank start
*/ */
static uint32_t lpc2900_address2sector( struct flash_bank_s *bank, static uint32_t lpc2900_address2sector( struct flash_bank *bank,
uint32_t offset ) uint32_t offset )
{ {
uint32_t address = bank->base + offset; uint32_t address = bank->base + offset;
@ -424,7 +424,7 @@ static uint32_t lpc2900_address2sector( struct flash_bank_s *bank,
* @param pagenum Page number (0...7) * @param pagenum Page number (0...7)
* @param page Page array (FLASH_PAGE_SIZE bytes) * @param page Page array (FLASH_PAGE_SIZE bytes)
*/ */
static int lpc2900_write_index_page( struct flash_bank_s *bank, static int lpc2900_write_index_page( struct flash_bank *bank,
int pagenum, int pagenum,
uint8_t (*page)[FLASH_PAGE_SIZE] ) uint8_t (*page)[FLASH_PAGE_SIZE] )
{ {
@ -543,7 +543,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command)
return ERROR_FLASH_BANK_INVALID; return ERROR_FLASH_BANK_INVALID;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -588,7 +588,7 @@ COMMAND_HANDLER(lpc2900_handle_read_custom_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -659,7 +659,7 @@ COMMAND_HANDLER(lpc2900_handle_password_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -694,7 +694,7 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -805,7 +805,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
} }
/* Get the bank descriptor */ /* Get the bank descriptor */
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -904,7 +904,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command)
} }
/* Get the bank descriptor */ /* Get the bank descriptor */
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -1070,7 +1070,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2900_flash_bank_command)
* @param first First sector to be erased * @param first First sector to be erased
* @param last Last sector (including) to be erased * @param last Last sector (including) to be erased
*/ */
static int lpc2900_erase(struct flash_bank_s *bank, int first, int last) static int lpc2900_erase(struct flash_bank *bank, int first, int last)
{ {
uint32_t status; uint32_t status;
int sector; int sector;
@ -1177,7 +1177,7 @@ static int lpc2900_erase(struct flash_bank_s *bank, int first, int last)
static int lpc2900_protect(struct flash_bank_s *bank, int set, int first, int last) static int lpc2900_protect(struct flash_bank *bank, int set, int first, int last)
{ {
/* This command is not supported. /* This command is not supported.
* "Protection" in LPC2900 terms is handled transparently. Sectors will * "Protection" in LPC2900 terms is handled transparently. Sectors will
@ -1199,7 +1199,7 @@ static int lpc2900_protect(struct flash_bank_s *bank, int set, int first, int la
* @param offset Start address (relative to bank start) * @param offset Start address (relative to bank start)
* @param count Number of bytes to be programmed * @param count Number of bytes to be programmed
*/ */
static int lpc2900_write(struct flash_bank_s *bank, uint8_t *buffer, static int lpc2900_write(struct flash_bank *bank, uint8_t *buffer,
uint32_t offset, uint32_t count) uint32_t offset, uint32_t count)
{ {
uint8_t page[FLASH_PAGE_SIZE]; uint8_t page[FLASH_PAGE_SIZE];
@ -1548,7 +1548,7 @@ static int lpc2900_write(struct flash_bank_s *bank, uint8_t *buffer,
* *
* @param bank Pointer to the flash bank descriptor * @param bank Pointer to the flash bank descriptor
*/ */
static int lpc2900_probe(struct flash_bank_s *bank) static int lpc2900_probe(struct flash_bank *bank)
{ {
struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv; struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -1751,7 +1751,7 @@ static int lpc2900_probe(struct flash_bank_s *bank)
* *
* @param bank Pointer to the flash bank descriptor * @param bank Pointer to the flash bank descriptor
*/ */
static int lpc2900_erase_check(struct flash_bank_s *bank) static int lpc2900_erase_check(struct flash_bank *bank)
{ {
uint32_t status = lpc2900_is_ready(bank); uint32_t status = lpc2900_is_ready(bank);
if (status != ERROR_OK) if (status != ERROR_OK)
@ -1809,7 +1809,7 @@ static int lpc2900_erase_check(struct flash_bank_s *bank)
* *
* @param bank Pointer to the flash bank descriptor * @param bank Pointer to the flash bank descriptor
*/ */
static int lpc2900_protect_check(struct flash_bank_s *bank) static int lpc2900_protect_check(struct flash_bank *bank)
{ {
return lpc2900_read_security_status(bank); return lpc2900_read_security_status(bank);
} }
@ -1822,7 +1822,7 @@ static int lpc2900_protect_check(struct flash_bank_s *bank)
* @param buf Buffer to take the string * @param buf Buffer to take the string
* @param buf_size Maximum number of characters that the buffer can take * @param buf_size Maximum number of characters that the buffer can take
*/ */
static int lpc2900_info(struct flash_bank_s *bank, char *buf, int buf_size) static int lpc2900_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
snprintf(buf, buf_size, "lpc2900 flash driver"); snprintf(buf, buf_size, "lpc2900 flash driver");

View File

@ -403,7 +403,7 @@ static struct non_cfi non_cfi_flashes[] = {
} }
}; };
void cfi_fixup_non_cfi(flash_bank_t *bank) void cfi_fixup_non_cfi(struct flash_bank *bank)
{ {
struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_flash_bank *cfi_info = bank->driver_priv;
struct non_cfi *non_cfi = non_cfi_flashes; struct non_cfi *non_cfi = non_cfi_flashes;

View File

@ -35,6 +35,6 @@ struct non_cfi
uint8_t status_poll_mask; uint8_t status_poll_mask;
}; };
void cfi_fixup_non_cfi(flash_bank_t *bank); void cfi_fixup_non_cfi(struct flash_bank *bank);
#endif /* NON_CFI_H */ #endif /* NON_CFI_H */

View File

@ -33,12 +33,12 @@ struct ocl_priv
unsigned int bufalign; unsigned int bufalign;
}; };
static int ocl_erase_check(struct flash_bank_s *bank) static int ocl_erase_check(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
static int ocl_protect_check(struct flash_bank_s *bank) static int ocl_protect_check(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
@ -68,7 +68,7 @@ FLASH_BANK_COMMAND_HANDLER(ocl_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int ocl_erase(struct flash_bank_s *bank, int first, int last) static int ocl_erase(struct flash_bank *bank, int first, int last)
{ {
struct ocl_priv *ocl = bank->driver_priv; struct ocl_priv *ocl = bank->driver_priv;
int retval; int retval;
@ -123,12 +123,12 @@ static int ocl_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int ocl_protect(struct flash_bank_s *bank, int set, int first, int last) static int ocl_protect(struct flash_bank *bank, int set, int first, int last)
{ {
return ERROR_OK; return ERROR_OK;
} }
static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int ocl_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct ocl_priv *ocl = bank->driver_priv; struct ocl_priv *ocl = bank->driver_priv;
int retval; int retval;
@ -235,7 +235,7 @@ static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset
return ERROR_OK; return ERROR_OK;
} }
static int ocl_probe(struct flash_bank_s *bank) static int ocl_probe(struct flash_bank *bank)
{ {
struct ocl_priv *ocl = bank->driver_priv; struct ocl_priv *ocl = bank->driver_priv;
int retval; int retval;
@ -333,12 +333,12 @@ static int ocl_probe(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int ocl_info(struct flash_bank_s *bank, char *buf, int buf_size) static int ocl_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
return ERROR_OK; return ERROR_OK;
} }
static int ocl_auto_probe(struct flash_bank_s *bank) static int ocl_auto_probe(struct flash_bank *bank)
{ {
struct ocl_priv *ocl = bank->driver_priv; struct ocl_priv *ocl = bank->driver_priv;

View File

@ -57,8 +57,8 @@ struct pic32mx_devs_s {
{ 0x00, NULL, 0 } { 0x00, NULL, 0 }
}; };
static int pic32mx_write_row(struct flash_bank_s *bank, uint32_t address, uint32_t srcaddr); static int pic32mx_write_row(struct flash_bank *bank, uint32_t address, uint32_t srcaddr);
static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint32_t word); static int pic32mx_write_word(struct flash_bank *bank, uint32_t address, uint32_t word);
/* flash bank pic32mx <base> <size> 0 0 <target#> /* flash bank pic32mx <base> <size> 0 0 <target#>
*/ */
@ -81,7 +81,7 @@ FLASH_BANK_COMMAND_HANDLER(pic32mx_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static uint32_t pic32mx_get_flash_status(flash_bank_t *bank) static uint32_t pic32mx_get_flash_status(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t status; uint32_t status;
@ -91,7 +91,7 @@ static uint32_t pic32mx_get_flash_status(flash_bank_t *bank)
return status; return status;
} }
static uint32_t pic32mx_wait_status_busy(flash_bank_t *bank, int timeout) static uint32_t pic32mx_wait_status_busy(struct flash_bank *bank, int timeout)
{ {
uint32_t status; uint32_t status;
@ -107,7 +107,7 @@ static uint32_t pic32mx_wait_status_busy(flash_bank_t *bank, int timeout)
return status; return status;
} }
static int pic32mx_nvm_exec(struct flash_bank_s *bank, uint32_t op, uint32_t timeout) static int pic32mx_nvm_exec(struct flash_bank *bank, uint32_t op, uint32_t timeout)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t status; uint32_t status;
@ -129,7 +129,7 @@ static int pic32mx_nvm_exec(struct flash_bank_s *bank, uint32_t op, uint32_t tim
return status; return status;
} }
static int pic32mx_protect_check(struct flash_bank_s *bank) static int pic32mx_protect_check(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
@ -163,7 +163,7 @@ static int pic32mx_protect_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int pic32mx_erase(struct flash_bank_s *bank, int first, int last) static int pic32mx_erase(struct flash_bank *bank, int first, int last)
{ {
struct target *target = bank->target; struct target *target = bank->target;
int i; int i;
@ -205,7 +205,7 @@ static int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last) static int pic32mx_protect(struct flash_bank *bank, int set, int first, int last)
{ {
struct pic32mx_flash_bank *pic32mx_info = NULL; struct pic32mx_flash_bank *pic32mx_info = NULL;
struct target *target = bank->target; struct target *target = bank->target;
@ -298,7 +298,7 @@ static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int la
#endif #endif
} }
static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t buffer_size = 512; uint32_t buffer_size = 512;
@ -427,7 +427,7 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3
return retval; return retval;
} }
static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint32_t word) static int pic32mx_write_word(struct flash_bank *bank, uint32_t address, uint32_t word)
{ {
struct target *target = bank->target; struct target *target = bank->target;
@ -443,7 +443,7 @@ static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint3
/* /*
* Write a 128 word (512 byte) row to flash address from RAM srcaddr. * Write a 128 word (512 byte) row to flash address from RAM srcaddr.
*/ */
static int pic32mx_write_row(struct flash_bank_s *bank, uint32_t address, uint32_t srcaddr) static int pic32mx_write_row(struct flash_bank *bank, uint32_t address, uint32_t srcaddr)
{ {
struct target *target = bank->target; struct target *target = bank->target;
@ -461,7 +461,7 @@ static int pic32mx_write_row(struct flash_bank_s *bank, uint32_t address, uint32
return pic32mx_nvm_exec(bank, NVMCON_OP_ROW_PROG, 100); return pic32mx_nvm_exec(bank, NVMCON_OP_ROW_PROG, 100);
} }
static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int pic32mx_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
uint32_t words_remaining = (count / 4); uint32_t words_remaining = (count / 4);
uint32_t bytes_remaining = (count & 0x00000003); uint32_t bytes_remaining = (count & 0x00000003);
@ -539,7 +539,7 @@ static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
return ERROR_OK; return ERROR_OK;
} }
static int pic32mx_probe(struct flash_bank_s *bank) static int pic32mx_probe(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv; struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv;
@ -622,7 +622,7 @@ static int pic32mx_probe(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int pic32mx_auto_probe(struct flash_bank_s *bank) static int pic32mx_auto_probe(struct flash_bank *bank)
{ {
struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv; struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv;
if (pic32mx_info->probed) if (pic32mx_info->probed)
@ -637,7 +637,7 @@ COMMAND_HANDLER(pic32mx_handle_part_id_command)
} }
#endif #endif
static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size) static int pic32mx_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct mips32_common *mips32 = target->arch_info; struct mips32_common *mips32 = target->arch_info;
@ -683,7 +683,7 @@ COMMAND_HANDLER(pic32mx_handle_lock_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -729,7 +729,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -763,7 +763,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
#endif #endif
#if 0 #if 0
static int pic32mx_chip_erase(struct flash_bank_s *bank) static int pic32mx_chip_erase(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
#if 0 #if 0
@ -819,7 +819,7 @@ COMMAND_HANDLER(pic32mx_handle_chip_erase_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -857,7 +857,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)
COMMAND_PARSE_NUMBER(u32, args[0], address); COMMAND_PARSE_NUMBER(u32, args[0], address);
COMMAND_PARSE_NUMBER(u32, args[1], value); COMMAND_PARSE_NUMBER(u32, args[1], value);
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[2], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[2], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;

View File

@ -35,12 +35,12 @@
#define DID0_VER(did0) ((did0 >> 28)&0x07) #define DID0_VER(did0) ((did0 >> 28)&0x07)
static int stellaris_read_part_info(struct flash_bank_s *bank); static int stellaris_read_part_info(struct flash_bank *bank);
static uint32_t stellaris_get_flash_status(flash_bank_t *bank); static uint32_t stellaris_get_flash_status(struct flash_bank *bank);
static void stellaris_set_flash_mode(flash_bank_t *bank,int mode); static void stellaris_set_flash_mode(struct flash_bank *bank,int mode);
//static uint32_t stellaris_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout); //static uint32_t stellaris_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout);
static int stellaris_mass_erase(struct flash_bank_s *bank); static int stellaris_mass_erase(struct flash_bank *bank);
static struct { static struct {
uint32_t partno; uint32_t partno;
@ -239,7 +239,7 @@ FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size) static int stellaris_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
int printed, device_class; int printed, device_class;
struct stellaris_flash_bank *stellaris_info = bank->driver_priv; struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
@ -316,7 +316,7 @@ static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size)
* chip identification and status * * chip identification and status *
***************************************************************************/ ***************************************************************************/
static uint32_t stellaris_get_flash_status(flash_bank_t *bank) static uint32_t stellaris_get_flash_status(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t fmc; uint32_t fmc;
@ -361,7 +361,7 @@ static const unsigned rcc_xtal[32] = {
[0x16] = 16384000, [0x16] = 16384000,
}; };
static void stellaris_read_clock_info(flash_bank_t *bank) static void stellaris_read_clock_info(struct flash_bank *bank)
{ {
struct stellaris_flash_bank *stellaris_info = bank->driver_priv; struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -448,7 +448,7 @@ static void stellaris_read_clock_info(flash_bank_t *bank)
} }
/* Setup the timimg registers */ /* Setup the timimg registers */
static void stellaris_set_flash_mode(flash_bank_t *bank,int mode) static void stellaris_set_flash_mode(struct flash_bank *bank,int mode)
{ {
struct stellaris_flash_bank *stellaris_info = bank->driver_priv; struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -459,7 +459,7 @@ static void stellaris_set_flash_mode(flash_bank_t *bank,int mode)
} }
#if 0 #if 0
static uint32_t stellaris_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout) static uint32_t stellaris_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout)
{ {
uint32_t status; uint32_t status;
@ -476,7 +476,7 @@ static uint32_t stellaris_wait_status_busy(flash_bank_t *bank, uint32_t waitbits
} }
/* Send one command to the flash controller */ /* Send one command to the flash controller */
static int stellaris_flash_command(struct flash_bank_s *bank,uint8_t cmd,uint16_t pagen) static int stellaris_flash_command(struct flash_bank *bank,uint8_t cmd,uint16_t pagen)
{ {
uint32_t fmc; uint32_t fmc;
struct target *target = bank->target; struct target *target = bank->target;
@ -495,7 +495,7 @@ static int stellaris_flash_command(struct flash_bank_s *bank,uint8_t cmd,uint16_
#endif #endif
/* Read device id register, main clock frequency register and fill in driver info structure */ /* Read device id register, main clock frequency register and fill in driver info structure */
static int stellaris_read_part_info(struct flash_bank_s *bank) static int stellaris_read_part_info(struct flash_bank *bank)
{ {
struct stellaris_flash_bank *stellaris_info = bank->driver_priv; struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -613,7 +613,7 @@ static int stellaris_read_part_info(struct flash_bank_s *bank)
* flash operations * * flash operations *
***************************************************************************/ ***************************************************************************/
static int stellaris_protect_check(struct flash_bank_s *bank) static int stellaris_protect_check(struct flash_bank *bank)
{ {
uint32_t status; uint32_t status;
@ -642,7 +642,7 @@ static int stellaris_protect_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int stellaris_erase(struct flash_bank_s *bank, int first, int last) static int stellaris_erase(struct flash_bank *bank, int first, int last)
{ {
int banknr; int banknr;
uint32_t flash_fmc, flash_cris; uint32_t flash_fmc, flash_cris;
@ -712,7 +712,7 @@ static int stellaris_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int stellaris_protect(struct flash_bank_s *bank, int set, int first, int last) static int stellaris_protect(struct flash_bank *bank, int set, int first, int last)
{ {
uint32_t fmppe, flash_fmc, flash_cris; uint32_t fmppe, flash_fmc, flash_cris;
int lockregion; int lockregion;
@ -828,7 +828,7 @@ static uint8_t stellaris_write_code[] =
0x01,0x00,0x42,0xA4 /* .word 0xA4420001 */ 0x01,0x00,0x42,0xA4 /* .word 0xA4420001 */
}; };
static int stellaris_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t wcount) static int stellaris_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t wcount)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t buffer_size = 8192; uint32_t buffer_size = 8192;
@ -908,7 +908,7 @@ static int stellaris_write_block(struct flash_bank_s *bank, uint8_t *buffer, uin
return retval; return retval;
} }
static int stellaris_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int stellaris_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct stellaris_flash_bank *stellaris_info = bank->driver_priv; struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -1043,7 +1043,7 @@ static int stellaris_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t
return ERROR_OK; return ERROR_OK;
} }
static int stellaris_probe(struct flash_bank_s *bank) static int stellaris_probe(struct flash_bank *bank)
{ {
/* we can't probe on an stellaris /* we can't probe on an stellaris
* if this is an stellaris, it has the configured flash * if this is an stellaris, it has the configured flash
@ -1059,7 +1059,7 @@ static int stellaris_probe(struct flash_bank_s *bank)
return stellaris_read_part_info(bank); return stellaris_read_part_info(bank);
} }
static int stellaris_auto_probe(struct flash_bank_s *bank) static int stellaris_auto_probe(struct flash_bank *bank)
{ {
struct stellaris_flash_bank *stellaris_info = bank->driver_priv; struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
if (stellaris_info->did1) if (stellaris_info->did1)
@ -1067,7 +1067,7 @@ static int stellaris_auto_probe(struct flash_bank_s *bank)
return stellaris_probe(bank); return stellaris_probe(bank);
} }
static int stellaris_mass_erase(struct flash_bank_s *bank) static int stellaris_mass_erase(struct flash_bank *bank)
{ {
struct target *target = NULL; struct target *target = NULL;
struct stellaris_flash_bank *stellaris_info = NULL; struct stellaris_flash_bank *stellaris_info = NULL;
@ -1137,7 +1137,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;

View File

@ -29,7 +29,7 @@
#include "binarybuffer.h" #include "binarybuffer.h"
static int stm32x_mass_erase(struct flash_bank_s *bank); static int stm32x_mass_erase(struct flash_bank *bank);
/* flash bank stm32x <base> <size> 0 0 <target#> /* flash bank stm32x <base> <size> 0 0 <target#>
*/ */
@ -52,7 +52,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static uint32_t stm32x_get_flash_status(flash_bank_t *bank) static uint32_t stm32x_get_flash_status(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t status; uint32_t status;
@ -62,7 +62,7 @@ static uint32_t stm32x_get_flash_status(flash_bank_t *bank)
return status; return status;
} }
static uint32_t stm32x_wait_status_busy(flash_bank_t *bank, int timeout) static uint32_t stm32x_wait_status_busy(struct flash_bank *bank, int timeout)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t status; uint32_t status;
@ -81,7 +81,7 @@ static uint32_t stm32x_wait_status_busy(flash_bank_t *bank, int timeout)
return status; return status;
} }
static int stm32x_read_options(struct flash_bank_s *bank) static int stm32x_read_options(struct flash_bank *bank)
{ {
uint32_t optiondata; uint32_t optiondata;
struct stm32x_flash_bank *stm32x_info = NULL; struct stm32x_flash_bank *stm32x_info = NULL;
@ -109,7 +109,7 @@ static int stm32x_read_options(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int stm32x_erase_options(struct flash_bank_s *bank) static int stm32x_erase_options(struct flash_bank *bank)
{ {
struct stm32x_flash_bank *stm32x_info = NULL; struct stm32x_flash_bank *stm32x_info = NULL;
struct target *target = bank->target; struct target *target = bank->target;
@ -146,7 +146,7 @@ static int stm32x_erase_options(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int stm32x_write_options(struct flash_bank_s *bank) static int stm32x_write_options(struct flash_bank *bank)
{ {
struct stm32x_flash_bank *stm32x_info = NULL; struct stm32x_flash_bank *stm32x_info = NULL;
struct target *target = bank->target; struct target *target = bank->target;
@ -230,7 +230,7 @@ static int stm32x_write_options(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int stm32x_protect_check(struct flash_bank_s *bank) static int stm32x_protect_check(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct stm32x_flash_bank *stm32x_info = bank->driver_priv; struct stm32x_flash_bank *stm32x_info = bank->driver_priv;
@ -302,7 +302,7 @@ static int stm32x_protect_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int stm32x_erase(struct flash_bank_s *bank, int first, int last) static int stm32x_erase(struct flash_bank *bank, int first, int last)
{ {
struct target *target = bank->target; struct target *target = bank->target;
int i; int i;
@ -343,7 +343,7 @@ static int stm32x_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int stm32x_protect(struct flash_bank_s *bank, int set, int first, int last) static int stm32x_protect(struct flash_bank *bank, int set, int first, int last)
{ {
struct stm32x_flash_bank *stm32x_info = NULL; struct stm32x_flash_bank *stm32x_info = NULL;
struct target *target = bank->target; struct target *target = bank->target;
@ -430,7 +430,7 @@ static int stm32x_protect(struct flash_bank_s *bank, int set, int first, int las
return stm32x_write_options(bank); return stm32x_write_options(bank);
} }
static int stm32x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct stm32x_flash_bank *stm32x_info = bank->driver_priv; struct stm32x_flash_bank *stm32x_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -549,7 +549,7 @@ static int stm32x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32
return retval; return retval;
} }
static int stm32x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int stm32x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t words_remaining = (count / 2); uint32_t words_remaining = (count / 2);
@ -654,7 +654,7 @@ static int stm32x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t off
return ERROR_OK; return ERROR_OK;
} }
static int stm32x_probe(struct flash_bank_s *bank) static int stm32x_probe(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct stm32x_flash_bank *stm32x_info = bank->driver_priv; struct stm32x_flash_bank *stm32x_info = bank->driver_priv;
@ -771,7 +771,7 @@ static int stm32x_probe(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int stm32x_auto_probe(struct flash_bank_s *bank) static int stm32x_auto_probe(struct flash_bank *bank)
{ {
struct stm32x_flash_bank *stm32x_info = bank->driver_priv; struct stm32x_flash_bank *stm32x_info = bank->driver_priv;
if (stm32x_info->probed) if (stm32x_info->probed)
@ -786,7 +786,7 @@ COMMAND_HANDLER(stm32x_handle_part_id_command)
} }
#endif #endif
static int stm32x_info(struct flash_bank_s *bank, char *buf, int buf_size) static int stm32x_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t device_id; uint32_t device_id;
@ -903,7 +903,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -949,7 +949,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -993,7 +993,7 @@ COMMAND_HANDLER(stm32x_handle_options_read_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -1049,7 +1049,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -1110,7 +1110,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)
return ERROR_OK; return ERROR_OK;
} }
static int stm32x_mass_erase(struct flash_bank_s *bank) static int stm32x_mass_erase(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t status; uint32_t status;
@ -1158,7 +1158,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;

View File

@ -45,13 +45,13 @@ struct str7x_mem_layout mem_layout_str7bank1[] = {
{0x00002000, 0x02000, 0x20000} {0x00002000, 0x02000, 0x20000}
}; };
static int str7x_get_flash_adr(struct flash_bank_s *bank, uint32_t reg) static int str7x_get_flash_adr(struct flash_bank *bank, uint32_t reg)
{ {
struct str7x_flash_bank *str7x_info = bank->driver_priv; struct str7x_flash_bank *str7x_info = bank->driver_priv;
return (str7x_info->register_base | reg); return (str7x_info->register_base | reg);
} }
static int str7x_build_block_list(struct flash_bank_s *bank) static int str7x_build_block_list(struct flash_bank *bank)
{ {
struct str7x_flash_bank *str7x_info = bank->driver_priv; struct str7x_flash_bank *str7x_info = bank->driver_priv;
@ -154,7 +154,7 @@ FLASH_BANK_COMMAND_HANDLER(str7x_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static uint32_t str7x_status(struct flash_bank_s *bank) static uint32_t str7x_status(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t retval; uint32_t retval;
@ -164,7 +164,7 @@ static uint32_t str7x_status(struct flash_bank_s *bank)
return retval; return retval;
} }
static uint32_t str7x_result(struct flash_bank_s *bank) static uint32_t str7x_result(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t retval; uint32_t retval;
@ -174,7 +174,7 @@ static uint32_t str7x_result(struct flash_bank_s *bank)
return retval; return retval;
} }
static int str7x_protect_check(struct flash_bank_s *bank) static int str7x_protect_check(struct flash_bank *bank)
{ {
struct str7x_flash_bank *str7x_info = bank->driver_priv; struct str7x_flash_bank *str7x_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -201,7 +201,7 @@ static int str7x_protect_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int str7x_erase(struct flash_bank_s *bank, int first, int last) static int str7x_erase(struct flash_bank *bank, int first, int last)
{ {
struct str7x_flash_bank *str7x_info = bank->driver_priv; struct str7x_flash_bank *str7x_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -254,7 +254,7 @@ static int str7x_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int str7x_protect(struct flash_bank_s *bank, int set, int first, int last) static int str7x_protect(struct flash_bank *bank, int set, int first, int last)
{ {
struct str7x_flash_bank *str7x_info = bank->driver_priv; struct str7x_flash_bank *str7x_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -308,7 +308,7 @@ static int str7x_protect(struct flash_bank_s *bank, int set, int first, int last
return ERROR_OK; return ERROR_OK;
} }
static int str7x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct str7x_flash_bank *str7x_info = bank->driver_priv; struct str7x_flash_bank *str7x_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -423,7 +423,7 @@ static int str7x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_
return retval; return retval;
} }
static int str7x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int str7x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct str7x_flash_bank *str7x_info = bank->driver_priv; struct str7x_flash_bank *str7x_info = bank->driver_priv;
@ -583,7 +583,7 @@ static int str7x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offs
return ERROR_OK; return ERROR_OK;
} }
static int str7x_probe(struct flash_bank_s *bank) static int str7x_probe(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
@ -595,7 +595,7 @@ COMMAND_HANDLER(str7x_handle_part_id_command)
} }
#endif #endif
static int str7x_info(struct flash_bank_s *bank, char *buf, int buf_size) static int str7x_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
snprintf(buf, buf_size, "str7x flash driver info"); snprintf(buf, buf_size, "str7x flash driver info");
return ERROR_OK; return ERROR_OK;
@ -616,7 +616,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;

View File

@ -33,7 +33,7 @@
static uint32_t bank1start = 0x00080000; static uint32_t bank1start = 0x00080000;
static int str9x_build_block_list(struct flash_bank_s *bank) static int str9x_build_block_list(struct flash_bank *bank)
{ {
struct str9x_flash_bank *str9x_info = bank->driver_priv; struct str9x_flash_bank *str9x_info = bank->driver_priv;
@ -136,7 +136,7 @@ FLASH_BANK_COMMAND_HANDLER(str9x_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int str9x_protect_check(struct flash_bank_s *bank) static int str9x_protect_check(struct flash_bank *bank)
{ {
int retval; int retval;
struct str9x_flash_bank *str9x_info = bank->driver_priv; struct str9x_flash_bank *str9x_info = bank->driver_priv;
@ -214,7 +214,7 @@ static int str9x_protect_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int str9x_erase(struct flash_bank_s *bank, int first, int last) static int str9x_erase(struct flash_bank *bank, int first, int last)
{ {
struct target *target = bank->target; struct target *target = bank->target;
int i; int i;
@ -306,7 +306,7 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int str9x_protect(struct flash_bank_s *bank, static int str9x_protect(struct flash_bank *bank,
int set, int first, int last) int set, int first, int last)
{ {
struct target *target = bank->target; struct target *target = bank->target;
@ -345,7 +345,7 @@ static int str9x_protect(struct flash_bank_s *bank,
return ERROR_OK; return ERROR_OK;
} }
static int str9x_write_block(struct flash_bank_s *bank, static int str9x_write_block(struct flash_bank *bank,
uint8_t *buffer, uint32_t offset, uint32_t count) uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct str9x_flash_bank *str9x_info = bank->driver_priv; struct str9x_flash_bank *str9x_info = bank->driver_priv;
@ -454,7 +454,7 @@ static int str9x_write_block(struct flash_bank_s *bank,
return retval; return retval;
} }
static int str9x_write(struct flash_bank_s *bank, static int str9x_write(struct flash_bank *bank,
uint8_t *buffer, uint32_t offset, uint32_t count) uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct target *target = bank->target; struct target *target = bank->target;
@ -612,7 +612,7 @@ static int str9x_write(struct flash_bank_s *bank,
return ERROR_OK; return ERROR_OK;
} }
static int str9x_probe(struct flash_bank_s *bank) static int str9x_probe(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
@ -624,7 +624,7 @@ COMMAND_HANDLER(str9x_handle_part_id_command)
} }
#endif #endif
static int str9x_info(struct flash_bank_s *bank, char *buf, int buf_size) static int str9x_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
snprintf(buf, buf_size, "str9x flash driver info"); snprintf(buf, buf_size, "str9x flash driver info");
return ERROR_OK; return ERROR_OK;
@ -640,7 +640,7 @@ COMMAND_HANDLER(str9x_handle_flash_config_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;

View File

@ -28,9 +28,9 @@
#include "arm7_9_common.h" #include "arm7_9_common.h"
static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last); static int str9xpec_erase_area(struct flash_bank *bank, int first, int last);
static int str9xpec_set_address(struct flash_bank_s *bank, uint8_t sector); static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector);
static int str9xpec_write_options(struct flash_bank_s *bank); static int str9xpec_write_options(struct flash_bank *bank);
int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state) int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state)
{ {
@ -81,7 +81,7 @@ static uint8_t str9xpec_isc_status(struct jtag_tap *tap)
return status; return status;
} }
static int str9xpec_isc_enable(struct flash_bank_s *bank) static int str9xpec_isc_enable(struct flash_bank *bank)
{ {
uint8_t status; uint8_t status;
struct jtag_tap *tap; struct jtag_tap *tap;
@ -108,7 +108,7 @@ static int str9xpec_isc_enable(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_isc_disable(struct flash_bank_s *bank) static int str9xpec_isc_disable(struct flash_bank *bank)
{ {
uint8_t status; uint8_t status;
struct jtag_tap *tap; struct jtag_tap *tap;
@ -137,7 +137,7 @@ static int str9xpec_isc_disable(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_read_config(struct flash_bank_s *bank) static int str9xpec_read_config(struct flash_bank *bank)
{ {
struct scan_field field; struct scan_field field;
uint8_t status; uint8_t status;
@ -166,7 +166,7 @@ static int str9xpec_read_config(struct flash_bank_s *bank)
return status; return status;
} }
static int str9xpec_build_block_list(struct flash_bank_s *bank) static int str9xpec_build_block_list(struct flash_bank *bank)
{ {
struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv; struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv;
@ -269,7 +269,7 @@ FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_blank_check(struct flash_bank_s *bank, int first, int last) static int str9xpec_blank_check(struct flash_bank *bank, int first, int last)
{ {
struct scan_field field; struct scan_field field;
uint8_t status; uint8_t status;
@ -336,7 +336,7 @@ static int str9xpec_blank_check(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_protect_check(struct flash_bank_s *bank) static int str9xpec_protect_check(struct flash_bank *bank)
{ {
uint8_t status; uint8_t status;
int i; int i;
@ -358,7 +358,7 @@ static int str9xpec_protect_check(struct flash_bank_s *bank)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last) static int str9xpec_erase_area(struct flash_bank *bank, int first, int last)
{ {
struct scan_field field; struct scan_field field;
uint8_t status; uint8_t status;
@ -428,7 +428,7 @@ static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last)
return status; return status;
} }
static int str9xpec_erase(struct flash_bank_s *bank, int first, int last) static int str9xpec_erase(struct flash_bank *bank, int first, int last)
{ {
int status; int status;
@ -440,7 +440,7 @@ static int str9xpec_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_lock_device(struct flash_bank_s *bank) static int str9xpec_lock_device(struct flash_bank *bank)
{ {
struct scan_field field; struct scan_field field;
uint8_t status; uint8_t status;
@ -482,7 +482,7 @@ static int str9xpec_lock_device(struct flash_bank_s *bank)
return status; return status;
} }
static int str9xpec_unlock_device(struct flash_bank_s *bank) static int str9xpec_unlock_device(struct flash_bank *bank)
{ {
uint8_t status; uint8_t status;
@ -491,7 +491,7 @@ static int str9xpec_unlock_device(struct flash_bank_s *bank)
return status; return status;
} }
static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int last) static int str9xpec_protect(struct flash_bank *bank, int set, int first, int last)
{ {
uint8_t status; uint8_t status;
int i; int i;
@ -537,7 +537,7 @@ static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int l
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_set_address(struct flash_bank_s *bank, uint8_t sector) static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector)
{ {
struct jtag_tap *tap; struct jtag_tap *tap;
struct scan_field field; struct scan_field field;
@ -558,7 +558,7 @@ static int str9xpec_set_address(struct flash_bank_s *bank, uint8_t sector)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{ {
struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv; struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv;
uint32_t dwords_remaining = (count / 8); uint32_t dwords_remaining = (count / 8);
@ -721,7 +721,7 @@ static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_probe(struct flash_bank_s *bank) static int str9xpec_probe(struct flash_bank *bank)
{ {
return ERROR_OK; return ERROR_OK;
} }
@ -737,7 +737,7 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
if (argc < 1) if (argc < 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -766,12 +766,12 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_erase_check(struct flash_bank_s *bank) static int str9xpec_erase_check(struct flash_bank *bank)
{ {
return str9xpec_blank_check(bank, 0, bank->num_sectors - 1); return str9xpec_blank_check(bank, 0, bank->num_sectors - 1);
} }
static int str9xpec_info(struct flash_bank_s *bank, char *buf, int buf_size) static int str9xpec_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
snprintf(buf, buf_size, "str9xpec flash driver info"); snprintf(buf, buf_size, "str9xpec flash driver info");
return ERROR_OK; return ERROR_OK;
@ -788,7 +788,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -833,7 +833,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
return ERROR_OK; return ERROR_OK;
} }
static int str9xpec_write_options(struct flash_bank_s *bank) static int str9xpec_write_options(struct flash_bank *bank)
{ {
struct scan_field field; struct scan_field field;
uint8_t status; uint8_t status;
@ -904,7 +904,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -927,7 +927,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -956,7 +956,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -985,7 +985,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -1014,7 +1014,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -1043,7 +1043,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_lock_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -1066,7 +1066,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -1092,7 +1092,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;
@ -1139,7 +1139,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)
return ERROR_OK; return ERROR_OK;
} }
flash_bank_t *bank; struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval) if (ERROR_OK != retval)
return retval; return retval;

View File

@ -106,7 +106,7 @@ const struct flash_sector TMS470R1A384_BANK2_SECTORS[] = {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_read_part_info(struct flash_bank_s *bank) static int tms470_read_part_info(struct flash_bank *bank)
{ {
struct tms470_flash_bank *tms470_info = bank->driver_priv; struct tms470_flash_bank *tms470_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -491,7 +491,7 @@ static int tms470_try_flash_keys(struct target * target, const uint32_t * key_se
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_unlock_flash(struct flash_bank_s *bank) static int tms470_unlock_flash(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
const uint32_t *p_key_sets[5]; const uint32_t *p_key_sets[5];
@ -530,7 +530,7 @@ static int tms470_unlock_flash(struct flash_bank_s *bank)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_flash_initialize_internal_state_machine(struct flash_bank_s *bank) static int tms470_flash_initialize_internal_state_machine(struct flash_bank *bank)
{ {
uint32_t fmmac2, fmmac1, fmmaxep, k, delay, glbctrl, sysclk; uint32_t fmmac2, fmmac1, fmmaxep, k, delay, glbctrl, sysclk;
struct target *target = bank->target; struct target *target = bank->target;
@ -666,7 +666,7 @@ static int tms470_flash_initialize_internal_state_machine(struct flash_bank_s *b
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int tms470_flash_status(struct flash_bank_s *bank) int tms470_flash_status(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
int result = ERROR_OK; int result = ERROR_OK;
@ -722,7 +722,7 @@ int tms470_flash_status(struct flash_bank_s *bank)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_erase_sector(struct flash_bank_s *bank, int sector) static int tms470_erase_sector(struct flash_bank *bank, int sector)
{ {
uint32_t glbctrl, orig_fmregopt, fmbsea, fmbseb, fmmstat; uint32_t glbctrl, orig_fmregopt, fmbsea, fmbseb, fmmstat;
struct target *target = bank->target; struct target *target = bank->target;
@ -830,7 +830,7 @@ static int tms470_register_commands(struct command_context_s *cmd_ctx)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_erase(struct flash_bank_s *bank, int first, int last) static int tms470_erase(struct flash_bank *bank, int first, int last)
{ {
struct tms470_flash_bank *tms470_info = bank->driver_priv; struct tms470_flash_bank *tms470_info = bank->driver_priv;
int sector, result = ERROR_OK; int sector, result = ERROR_OK;
@ -877,7 +877,7 @@ static int tms470_erase(struct flash_bank_s *bank, int first, int last)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_protect(struct flash_bank_s *bank, int set, int first, int last) static int tms470_protect(struct flash_bank *bank, int set, int first, int last)
{ {
struct tms470_flash_bank *tms470_info = bank->driver_priv; struct tms470_flash_bank *tms470_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
@ -929,7 +929,7 @@ static int tms470_protect(struct flash_bank_s *bank, int set, int first, int las
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_write(struct flash_bank_s *bank, uint8_t * buffer, uint32_t offset, uint32_t count) static int tms470_write(struct flash_bank *bank, uint8_t * buffer, uint32_t offset, uint32_t count)
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint32_t glbctrl, fmbac2, orig_fmregopt, fmbsea, fmbseb, fmmaxpp, fmmstat; uint32_t glbctrl, fmbac2, orig_fmregopt, fmbsea, fmbseb, fmmaxpp, fmmstat;
@ -1027,7 +1027,7 @@ static int tms470_write(struct flash_bank_s *bank, uint8_t * buffer, uint32_t of
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_probe(struct flash_bank_s *bank) static int tms470_probe(struct flash_bank *bank)
{ {
if (bank->target->state != TARGET_HALTED) if (bank->target->state != TARGET_HALTED)
{ {
@ -1038,7 +1038,7 @@ static int tms470_probe(struct flash_bank_s *bank)
return tms470_read_part_info(bank); return tms470_read_part_info(bank);
} }
static int tms470_auto_probe(struct flash_bank_s *bank) static int tms470_auto_probe(struct flash_bank *bank)
{ {
struct tms470_flash_bank *tms470_info = bank->driver_priv; struct tms470_flash_bank *tms470_info = bank->driver_priv;
@ -1049,7 +1049,7 @@ static int tms470_auto_probe(struct flash_bank_s *bank)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_erase_check(struct flash_bank_s *bank) static int tms470_erase_check(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct tms470_flash_bank *tms470_info = bank->driver_priv; struct tms470_flash_bank *tms470_info = bank->driver_priv;
@ -1140,7 +1140,7 @@ static int tms470_erase_check(struct flash_bank_s *bank)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_protect_check(struct flash_bank_s *bank) static int tms470_protect_check(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct tms470_flash_bank *tms470_info = bank->driver_priv; struct tms470_flash_bank *tms470_info = bank->driver_priv;
@ -1188,7 +1188,7 @@ static int tms470_protect_check(struct flash_bank_s *bank)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int tms470_info(struct flash_bank_s *bank, char *buf, int buf_size) static int tms470_info(struct flash_bank *bank, char *buf, int buf_size)
{ {
int used = 0; int used = 0;
struct tms470_flash_bank *tms470_info = bank->driver_priv; struct tms470_flash_bank *tms470_info = bank->driver_priv;

View File

@ -1520,7 +1520,7 @@ static int decode_xfer_read(char *buf, char **annex, int *ofs, unsigned int *len
return 0; return 0;
} }
int gdb_calc_blocksize(flash_bank_t *bank) int gdb_calc_blocksize(struct flash_bank *bank)
{ {
uint32_t i; uint32_t i;
uint32_t block_size = 0xffffffff; uint32_t block_size = 0xffffffff;
@ -1538,9 +1538,9 @@ int gdb_calc_blocksize(flash_bank_t *bank)
static int compare_bank (const void * a, const void * b) static int compare_bank (const void * a, const void * b)
{ {
flash_bank_t *b1, *b2; struct flash_bank *b1, *b2;
b1=*((flash_bank_t **)a); b1=*((struct flash_bank **)a);
b2=*((flash_bank_t **)b); b2=*((struct flash_bank **)b);
if (b1->base == b2->base) if (b1->base == b2->base)
{ {
@ -1661,7 +1661,7 @@ int gdb_query_packet(struct connection *connection, struct target *target, char
* Normally we only execute this code once, but no big deal if we * Normally we only execute this code once, but no big deal if we
* have to regenerate it a couple of times. */ * have to regenerate it a couple of times. */
flash_bank_t *p; struct flash_bank *p;
char *xml = NULL; char *xml = NULL;
int size = 0; int size = 0;
int pos = 0; int pos = 0;
@ -1685,7 +1685,7 @@ int gdb_query_packet(struct connection *connection, struct target *target, char
read/write) by default for GDB. read/write) by default for GDB.
GDB does not have a concept of non-cacheable read/write memory. GDB does not have a concept of non-cacheable read/write memory.
*/ */
flash_bank_t **banks = malloc(sizeof(flash_bank_t *)*flash_get_bank_count()); struct flash_bank **banks = malloc(sizeof(struct flash_bank *)*flash_get_bank_count());
int i; int i;
for (i = 0; i < flash_get_bank_count(); i++) for (i = 0; i < flash_get_bank_count(); i++)
@ -1701,7 +1701,7 @@ int gdb_query_packet(struct connection *connection, struct target *target, char
banks[i]=p; banks[i]=p;
} }
qsort(banks, flash_get_bank_count(), sizeof(flash_bank_t *), compare_bank); qsort(banks, flash_get_bank_count(), sizeof(struct flash_bank *), compare_bank);
uint32_t ram_start = 0; uint32_t ram_start = 0;
for (i = 0; i < flash_get_bank_count(); i++) for (i = 0; i < flash_get_bank_count(); i++)