Remove misleading typedef and redundant suffix from struct flash_bank.
#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_set_write_enable(struct target *target, int enable);
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;
uint32_t offset = 0;
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");
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 x;
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");
return ERROR_FLASH_OPERATION_FAILED;
*
* 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 target *target = bank->target;
/* All-JTAG, single-access method. Very slow. Used only if there is no
* 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;
uint8_t b;
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;
return retval;
}
-static int aduc702x_probe(struct flash_bank_s *bank)
+static int aduc702x_probe(struct flash_bank *bank)
{
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");
return ERROR_OK;
// so we can find the chip we belong to
struct sam3_chip *pChip;
// so we can find the orginal bank pointer
- flash_bank_t *pBank;
+ struct flash_bank *pBank;
unsigned bank_number;
uint32_t controller_address;
uint32_t base_address;
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);
}
static int
-sam3_erase_check(struct flash_bank_s *bank)
+sam3_erase_check(struct flash_bank *bank)
{
int x;
}
static int
-sam3_protect_check(struct flash_bank_s *bank)
+sam3_protect_check(struct flash_bank *bank)
{
int r;
uint32_t v=0;
const struct sam3_chip_details *pDetails;
struct sam3_chip *pChip;
void *vp;
- flash_bank_t *saved_banks[SAM3_MAX_FLASH_BANKS];
+ struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS];
unsigned x;
const char *cp;
static int
-_sam3_probe(struct flash_bank_s *bank, int noise)
+_sam3_probe(struct flash_bank *bank, int noise)
{
unsigned x;
int r;
}
static int
-sam3_probe(struct flash_bank_s *bank)
+sam3_probe(struct flash_bank *bank)
{
return _sam3_probe(bank, 1);
}
static int
-sam3_auto_probe(struct flash_bank_s *bank)
+sam3_auto_probe(struct flash_bank *bank)
{
return _sam3_probe(bank, 0);
}
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;
int r;
}
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;
int r;
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) {
LOG_ERROR("Target not halted");
static int
-sam3_write(struct flash_bank_s *bank,
+sam3_write(struct flash_bank *bank,
uint8_t *buffer,
uint32_t offset,
uint32_t count)
#include "at91sam7.h"
#include "binarybuffer.h"
-static int at91sam7_protect_check(struct flash_bank_s *bank);
-static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
+static int at91sam7_protect_check(struct flash_bank *bank);
+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 void at91sam7_set_flash_mode(struct flash_bank_s *bank, int mode);
-static uint32_t at91sam7_wait_status_busy(struct flash_bank_s *bank, uint32_t waitbits, int timeout);
-static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen);
+static void at91sam7_set_flash_mode(struct flash_bank *bank, int mode);
+static uint32_t at91sam7_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout);
+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_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 };
}
/* 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 target *target = bank->target;
}
/* 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;
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
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;
}
/* 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;
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
}
/* 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 target *target = t_bank->target;
if (at91sam7_info->cidr != 0)
{
/* flash already configured, update clock and check for protected sectors */
- flash_bank_t *fb = bank;
+ struct flash_bank *fb = bank;
t_bank = fb;
while (t_bank)
if (at91sam7_info->flash_autodetection == 0)
{
/* 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;
while (t_bank)
{
if (bnk > 0)
{
/* 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->driver = bank->driver;
fb->driver_priv = malloc(sizeof(struct at91sam7_flash_bank));
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;
uint16_t retval;
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;
uint32_t status;
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 target *target = t_bank->target;
if (bnk > 0)
{
/* 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->driver = bank->driver;
fb->driver_priv = malloc(sizeof(struct at91sam7_flash_bank));
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;
int sec;
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;
int sector;
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;
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
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
* if this is an at91sam7, it has the configured flash */
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;
struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv;
*/
COMMAND_HANDLER(at91sam7_handle_gpnvm_command)
{
- flash_bank_t *bank;
+ struct flash_bank *bank;
int bit;
uint8_t flashcmd;
uint32_t status;
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__);
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__);
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 avr_common *avr = target->arch_info;
#define EXTRACT_MFG(X) (((X) & 0xffe) >> 1)
#define EXTRACT_PART(X) (((X) & 0xffff000) >> 12)
#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 avrf_flash_bank *avrf_info = bank->driver_priv;
}
}
-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;
if (avrf_info->probed)
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__);
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 avr_common *avr = target->arch_info;
}
}
-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 avr_common *avr = target->arch_info;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
};
/* CFI fixups foward declarations */
-static void cfi_fixup_0002_erase_regions(flash_bank_t *flash, void *param);
-static void cfi_fixup_0002_unlock_addresses(flash_bank_t *flash, void *param);
-static void cfi_fixup_atmel_reversed_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(struct flash_bank *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 */
static const struct cfi_fixup cfi_0002_fixups[] = {
{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;
const struct cfi_fixup *f;
}
}
-/* inline uint32_t flash_address(flash_bank_t *bank, int sector, uint32_t offset) */
-static __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(struct flash_bank *bank, int sector, uint32_t offset)
{
struct cfi_flash_bank *cfi_info = bank->driver_priv;
}
-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;
* flash banks are expected to be made of similar chips
* 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;
uint8_t data[CFI_MAX_BUS_WIDTH];
* in case of a bank made of multiple chips,
* 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;
uint8_t data[CFI_MAX_BUS_WIDTH];
}
}
-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 cfi_flash_bank *cfi_info = bank->driver_priv;
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 cfi_flash_bank *cfi_info = bank->driver_priv;
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;
uint8_t command[8];
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;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_atmel_pri_ext atmel_pri_ext;
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;
}
}
-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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
}
-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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
}
/* 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; */
}
}
-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;
}
}
-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 target *target = bank->target;
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_spansion_pri_ext *pri_ext = cfi_info->pri_ext;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
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;
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 target *target = bank->target;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
}
}
-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_spansion_pri_ext *pri_ext = cfi_info->pri_ext;
}
-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 target *target = bank->target;
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 target *target = bank->target;
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;
if (cfi_info->probed)
}
-static int cfi_intel_protect_check(struct flash_bank_s *bank)
+static int cfi_intel_protect_check(struct flash_bank *bank)
{
int retval;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
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;
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;
struct cfi_flash_bank *cfi_info = bank->driver_priv;
{
uint16_t mfr;
uint16_t id;
- void (*fixup)(flash_bank_t *flash, void *param);
+ void (*fixup)(struct flash_bank *flash, void *param);
void *param;
};
#if 0
-static uint32_t ecosflash_get_flash_status(flash_bank_t *bank);
-static void ecosflash_set_flash_mode(flash_bank_t *bank,int mode);
-static uint32_t ecosflash_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout);
+static uint32_t ecosflash_get_flash_status(struct flash_bank *bank);
+static void ecosflash_set_flash_mode(struct flash_bank *bank,int mode);
+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);
#endif
return ERROR_OK;
}
-static int ecosflash_probe(struct flash_bank_s *bank)
+static int ecosflash_probe(struct flash_bank *bank)
{
return ERROR_OK;
}
}
#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;
int i;
#endif
#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;
switch (bank->bus_width)
}
#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;
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;
}
-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 flash_bank_s *c = bank;
+ struct flash_bank *c = bank;
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;
}
-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;
snprintf(buf, buf_size, "eCos flash driver: %s", info->driverPath);
}
#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;
}
-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;
}
-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;
memset(info->memory + first*sectorSize, 0xff, sectorSize*(last-first + 1));
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");
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;
memcpy(info->memory + offset, buffer, count);
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;
}
-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");
return ERROR_OK;
}
-static int faux_probe(struct flash_bank_s *bank)
+static int faux_probe(struct flash_bank *bank)
{
return ERROR_OK;
}
NULL,
};
-flash_bank_t *flash_banks;
+struct flash_bank *flash_banks;
static command_t *flash_cmd;
/* 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;
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;
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;
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) {
Jim_WrongNumArgs(interp, 1, argv, "no arguments to flash_banks command");
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;
for (p = flash_banks; p; p = p->next)
int flash_get_bank_count(void)
{
- flash_bank_t *p;
+ struct flash_bank *p;
int i = 0;
for (p = flash_banks; p; p = p->next)
{
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;
if (p == NULL)
}
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;
COMMAND_PARSE_NUMBER(uint, str, bank_num);
if (strcmp(args[0], flash_drivers[i]->name) != 0)
continue;
- flash_bank_t *p, *c;
+ struct flash_bank *p, *c;
/* register flash specific commands */
if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
return ERROR_FAIL;
}
- c = malloc(sizeof(flash_bank_t));
+ c = malloc(sizeof(struct flash_bank));
c->target = target;
c->driver = flash_drivers[i];
c->driver_priv = NULL;
COMMAND_HANDLER(handle_flash_info_command)
{
- flash_bank_t *p;
+ struct flash_bank *p;
uint32_t i = 0;
int j = 0;
int retval;
unsigned 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 ((retval = p->driver->probe(p)) == ERROR_OK)
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);
if (ERROR_OK != retval)
return retval;
COMMAND_HANDLER(handle_flash_erase_address_command)
{
- flash_bank_t *p;
+ struct flash_bank *p;
int retval;
int address;
int length;
if (argc != 1)
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);
if (ERROR_OK != retval)
return retval;
uint32_t last;
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)
return ERROR_OK;
int set;
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)
return ERROR_OK;
for (wrote = 0; wrote < (count*wordsize); wrote += cur_size)
{
cur_size = MIN((count*wordsize - wrote), sizeof(chunk));
- flash_bank_t *bank;
+ struct flash_bank *bank;
bank = get_flash_bank_by_addr(target, address);
if (bank == NULL)
{
struct duration 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);
if (ERROR_OK != retval)
return retval;
void flash_set_dirty(void)
{
- flash_bank_t *c;
+ struct flash_bank *c;
int i;
/* set all flash to require erasing */
}
/* 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 */
for (c = flash_banks; c; c = c->next)
/* 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,
- 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 last = -1;
int i;
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);
}
int section;
uint32_t section_offset;
- flash_bank_t *c;
+ struct flash_bank *c;
int *padding;
section = 0;
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;
uint8_t buffer[1024];
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;
int i;
int is_protected;
};
-struct flash_bank_s;
+struct flash_bank;
#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
* Finish the "flash bank" command for @a bank. The
* @a bank parameter will have been filled in by the core flash
* 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
* @code
* @param last The number of the last sector to erase, typically N-1.
* @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).
* @param last The last sector to (un)project, typically N-1.
* @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
* @param count The number of bytes to write.
* @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);
/**
* @param bank The bank to probe
* @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.
* @param bank The bank to check
* @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.
* @param bank - the bank to check
* @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
* @param buf_size - the size of the human buffer.
* @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
* @param bank - the bank to probe
* @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)
* may use the @c driver_priv member to store additional data on a
* per-bank basis, if required.
*/
-typedef struct flash_bank_s
+struct flash_bank
{
struct target *target; /**< Target to which this bank belongs. */
/// Array of sectors, allocated and initilized by the flash driver
struct flash_sector *sectors;
- struct flash_bank_s *next; /**< The next flash bank on this chip */
-} flash_bank_t;
+ struct flash_bank *next; /**< The next flash bank on this chip */
+};
/// Registers the 'flash' subsystem commands
int flash_register_commands(struct command_context_s *cmd_ctx);
* this routine will call default_flash_mem_blank_check() to confirm.
* @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
* of the given bank have truly been erased.
* @param bank The flash bank.
* @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.
* @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
* the bank identifier or retreiving the specified bank.
* @returns ERROR_OK on success, or an error indicating the problem.
*/
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.
* @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.
* @param target The target, presumed to contain one or more banks.
* @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_SECTOR_INVALID (-901)
* - 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;
int i;
* 0x20 to 0x33: command result table (1+4 words)
* 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;
struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
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 result_table[4];
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;
uint32_t param_table[5];
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 */
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 target *target = bank->target;
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
* if this is an lpc2xxx, it has the configured flash
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)
{
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 */
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;
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);
if (ERROR_OK != retval)
return retval;
/* F_CLK_TIME */
#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_set_flash_clk(struct flash_bank_s *bank);
-static uint32_t lpc288x_system_ready(struct flash_bank_s *bank);
+static void lpc288x_set_flash_clk(struct flash_bank *bank);
+static uint32_t lpc288x_system_ready(struct flash_bank *bank);
-static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout)
+static uint32_t lpc288x_wait_status_busy(struct flash_bank *bank, int timeout)
{
uint32_t status;
struct target *target = bank->target;
}
/* 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 target *target = bank->target;
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;
}
* AHB = 12 MHz ?
* 12000000/66000 = 182
* CLK_DIV = 60 ? */
-static void lpc288x_set_flash_clk(struct flash_bank_s *bank)
+static void lpc288x_set_flash_clk(struct flash_bank *bank)
{
uint32_t clk_time;
struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv;
}
}
-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;
if (lpc288x_info->cidr == 0)
return ERROR_OK;
}
-static int lpc288x_erase_check(struct flash_bank_s *bank)
+static int lpc288x_erase_check(struct flash_bank *bank)
{
uint32_t status = lpc288x_system_ready(bank); /* probed? halted? */
if (status != ERROR_OK)
return ERROR_OK;
}
-static int lpc288x_erase(struct flash_bank_s *bank, int first, int last)
+static int lpc288x_erase(struct flash_bank *bank, int first, int last)
{
uint32_t status;
int sector;
return ERROR_OK;
}
-static int lpc288x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
+static int lpc288x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
uint8_t page_buffer[FLASH_PAGE_SIZE];
uint32_t status, source_offset,dest_offset;
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 */
struct lpc288x_flash_bank *lpc288x_info = bank->driver_priv;
return ERROR_OK;
}
-static int lpc288x_info(struct flash_bank_s *bank, char *buf, int buf_size)
+static int lpc288x_info(struct flash_bank *bank, char *buf, int buf_size)
{
snprintf(buf, buf_size, "lpc288x flash driver");
return ERROR_OK;
}
-static int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int last)
+static int lpc288x_protect(struct flash_bank *bank, int set, int first, int last)
{
int lockregion, status;
uint32_t value;
};
-static uint32_t lpc2900_wait_status(flash_bank_t *bank, uint32_t mask, int timeout);
-static void lpc2900_setup(struct flash_bank_s *bank);
-static uint32_t lpc2900_is_ready(struct flash_bank_s *bank);
-static uint32_t lpc2900_read_security_status(struct flash_bank_s *bank);
-static uint32_t lpc2900_run_bist128(struct flash_bank_s *bank,
+static uint32_t lpc2900_wait_status(struct flash_bank *bank, uint32_t mask, int timeout);
+static void lpc2900_setup(struct flash_bank *bank);
+static uint32_t lpc2900_is_ready(struct flash_bank *bank);
+static uint32_t lpc2900_read_security_status(struct flash_bank *bank);
+static uint32_t lpc2900_run_bist128(struct flash_bank *bank,
uint32_t addr_from, uint32_t addr_to,
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 );
* @param[in] mask Mask to be used for INT_STATUS
* @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,
int timeout )
{
*
* @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;
struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
* Must have been successfully probed.
* 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;
*
* @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;
if( (status = lpc2900_is_ready( bank )) != ERROR_OK )
* @param addr_to
* @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_to,
uint32_t (*signature)[4] )
* @param bank Pointer to the flash bank descriptor
* @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 address = bank->base + offset;
* @param pagenum Page number (0...7)
* @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,
uint8_t (*page)[FLASH_PAGE_SIZE] )
{
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);
if (ERROR_OK != retval)
return retval;
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);
if (ERROR_OK != retval)
return retval;
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);
if (ERROR_OK != retval)
return retval;
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);
if (ERROR_OK != retval)
return retval;
}
/* 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);
if (ERROR_OK != retval)
return retval;
}
/* 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);
if (ERROR_OK != retval)
return retval;
* @param first First sector 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;
int sector;
-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.
* "Protection" in LPC2900 terms is handled transparently. Sectors will
* @param offset Start address (relative to bank start)
* @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)
{
uint8_t page[FLASH_PAGE_SIZE];
*
* @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 target *target = bank->target;
*
* @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);
if (status != ERROR_OK)
*
* @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);
}
* @param buf Buffer to take the string
* @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");
}
};
-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 non_cfi *non_cfi = non_cfi_flashes;
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 */
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;
}
-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;
}
-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;
int retval;
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;
}
-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;
int retval;
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;
int retval;
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;
}
-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;
{ 0x00, NULL, 0 }
};
-static int pic32mx_write_row(struct flash_bank_s *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_row(struct flash_bank *bank, uint32_t address, uint32_t srcaddr);
+static int pic32mx_write_word(struct flash_bank *bank, uint32_t address, uint32_t word);
/* flash bank pic32mx <base> <size> 0 0 <target#>
*/
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;
uint32_t 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;
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;
uint32_t 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;
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;
int i;
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 target *target = bank->target;
#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;
uint32_t buffer_size = 512;
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;
/*
* 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;
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 bytes_remaining = (count & 0x00000003);
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 pic32mx_flash_bank *pic32mx_info = bank->driver_priv;
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;
if (pic32mx_info->probed)
}
#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 mips32_common *mips32 = target->arch_info;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
#endif
#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;
#if 0
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
COMMAND_PARSE_NUMBER(u32, args[0], address);
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);
if (ERROR_OK != retval)
return retval;
#define DID0_VER(did0) ((did0 >> 28)&0x07)
-static int stellaris_read_part_info(struct flash_bank_s *bank);
-static uint32_t stellaris_get_flash_status(flash_bank_t *bank);
-static void stellaris_set_flash_mode(flash_bank_t *bank,int mode);
-//static uint32_t stellaris_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout);
+static int stellaris_read_part_info(struct flash_bank *bank);
+static uint32_t stellaris_get_flash_status(struct flash_bank *bank);
+static void stellaris_set_flash_mode(struct flash_bank *bank,int mode);
+//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 {
uint32_t partno;
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;
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
* 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;
uint32_t fmc;
[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 target *target = bank->target;
}
/* 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 target *target = bank->target;
}
#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;
}
/* 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;
struct target *target = bank->target;
#endif
/* 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 target *target = bank->target;
* flash operations *
***************************************************************************/
-static int stellaris_protect_check(struct flash_bank_s *bank)
+static int stellaris_protect_check(struct flash_bank *bank)
{
uint32_t status;
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;
uint32_t flash_fmc, flash_cris;
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;
int lockregion;
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;
uint32_t buffer_size = 8192;
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 target *target = bank->target;
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
* if this is an stellaris, it has the configured flash
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;
if (stellaris_info->did1)
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 stellaris_flash_bank *stellaris_info = NULL;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
#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#>
*/
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;
uint32_t 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;
uint32_t 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;
struct stm32x_flash_bank *stm32x_info = NULL;
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 target *target = bank->target;
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 target *target = bank->target;
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 stm32x_flash_bank *stm32x_info = bank->driver_priv;
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;
int i;
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 target *target = bank->target;
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 target *target = bank->target;
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;
uint32_t words_remaining = (count / 2);
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 stm32x_flash_bank *stm32x_info = bank->driver_priv;
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;
if (stm32x_info->probed)
}
#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;
uint32_t device_id;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
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;
uint32_t status;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
{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;
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;
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;
uint32_t 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;
uint32_t 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 target *target = bank->target;
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 target *target = bank->target;
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 target *target = bank->target;
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 target *target = bank->target;
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 str7x_flash_bank *str7x_info = bank->driver_priv;
return ERROR_OK;
}
-static int str7x_probe(struct flash_bank_s *bank)
+static int str7x_probe(struct flash_bank *bank)
{
return ERROR_OK;
}
}
#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");
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);
if (ERROR_OK != retval)
return retval;
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;
return ERROR_OK;
}
-static int str9x_protect_check(struct flash_bank_s *bank)
+static int str9x_protect_check(struct flash_bank *bank)
{
int retval;
struct str9x_flash_bank *str9x_info = bank->driver_priv;
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;
int i;
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)
{
struct target *target = bank->target;
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)
{
struct str9x_flash_bank *str9x_info = bank->driver_priv;
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)
{
struct target *target = bank->target;
return ERROR_OK;
}
-static int str9x_probe(struct flash_bank_s *bank)
+static int str9x_probe(struct flash_bank *bank)
{
return ERROR_OK;
}
}
#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");
return ERROR_OK;
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);
if (ERROR_OK != retval)
return retval;
#include "arm7_9_common.h"
-static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last);
-static int str9xpec_set_address(struct flash_bank_s *bank, uint8_t sector);
-static int str9xpec_write_options(struct flash_bank_s *bank);
+static int str9xpec_erase_area(struct flash_bank *bank, int first, int last);
+static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector);
+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)
{
return status;
}
-static int str9xpec_isc_enable(struct flash_bank_s *bank)
+static int str9xpec_isc_enable(struct flash_bank *bank)
{
uint8_t status;
struct jtag_tap *tap;
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;
struct jtag_tap *tap;
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;
uint8_t 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;
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;
uint8_t status;
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;
int i;
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;
uint8_t 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;
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;
uint8_t 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;
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;
int i;
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 scan_field field;
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;
uint32_t dwords_remaining = (count / 8);
return ERROR_OK;
}
-static int str9xpec_probe(struct flash_bank_s *bank)
+static int str9xpec_probe(struct flash_bank *bank)
{
return ERROR_OK;
}
if (argc < 1)
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);
if (ERROR_OK != retval)
return retval;
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);
}
-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");
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);
if (ERROR_OK != retval)
return retval;
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;
uint8_t status;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;
/* ---------------------------------------------------------------------- */
-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 target *target = bank->target;
/* ---------------------------------------------------------------------- */
-static int tms470_unlock_flash(struct flash_bank_s *bank)
+static int tms470_unlock_flash(struct flash_bank *bank)
{
struct target *target = bank->target;
const uint32_t *p_key_sets[5];
/* ---------------------------------------------------------------------- */
-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;
struct target *target = bank->target;
/* ---------------------------------------------------------------------- */
-int tms470_flash_status(struct flash_bank_s *bank)
+int tms470_flash_status(struct flash_bank *bank)
{
struct target *target = bank->target;
int result = ERROR_OK;
/* ---------------------------------------------------------------------- */
-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;
struct target *target = bank->target;
/* ---------------------------------------------------------------------- */
-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;
int sector, result = ERROR_OK;
/* ---------------------------------------------------------------------- */
-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 target *target = bank->target;
/* ---------------------------------------------------------------------- */
-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;
uint32_t glbctrl, fmbac2, orig_fmregopt, fmbsea, fmbseb, fmmaxpp, fmmstat;
/* ---------------------------------------------------------------------- */
-static int tms470_probe(struct flash_bank_s *bank)
+static int tms470_probe(struct flash_bank *bank)
{
if (bank->target->state != TARGET_HALTED)
{
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;
/* ---------------------------------------------------------------------- */
-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 tms470_flash_bank *tms470_info = bank->driver_priv;
/* ---------------------------------------------------------------------- */
-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 tms470_flash_bank *tms470_info = bank->driver_priv;
/* ---------------------------------------------------------------------- */
-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;
struct tms470_flash_bank *tms470_info = bank->driver_priv;
return 0;
}
-int gdb_calc_blocksize(flash_bank_t *bank)
+int gdb_calc_blocksize(struct flash_bank *bank)
{
uint32_t i;
uint32_t block_size = 0xffffffff;
static int compare_bank (const void * a, const void * b)
{
- flash_bank_t *b1, *b2;
- b1=*((flash_bank_t **)a);
- b2=*((flash_bank_t **)b);
+ struct flash_bank *b1, *b2;
+ b1=*((struct flash_bank **)a);
+ b2=*((struct flash_bank **)b);
if (b1->base == b2->base)
{
* Normally we only execute this code once, but no big deal if we
* have to regenerate it a couple of times. */
- flash_bank_t *p;
+ struct flash_bank *p;
char *xml = NULL;
int size = 0;
int pos = 0;
read/write) by default for GDB.
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;
for (i = 0; i < flash_get_bank_count(); i++)
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;
for (i = 0; i < flash_get_bank_count(); i++)