flash: convert 'unsigned' to 'unsigned int'
Conversion done with checkpatch --fix-inplace -types UNSPECIFIED_INT Ignore the cast as they could be better addressed. Fix only minor additional checkpatch issue (spacing and line length). Change-Id: Id808747855a02052f3738e2d232bff4dd99b27f1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8479 Tested-by: jenkins Reviewed-by: zapb <dev@zapb.de>
This commit is contained in:
parent
50586c9a06
commit
2ad48b78d4
|
@ -11,14 +11,14 @@
|
|||
#include "common.h"
|
||||
#include <helper/log.h>
|
||||
|
||||
unsigned get_flash_name_index(const char *name)
|
||||
unsigned int get_flash_name_index(const char *name)
|
||||
{
|
||||
const char *name_index = strrchr(name, '.');
|
||||
if (!name_index)
|
||||
return 0;
|
||||
if (name_index[1] < '0' || name_index[1] > '9')
|
||||
return ~0U;
|
||||
unsigned requested;
|
||||
unsigned int requested;
|
||||
int retval = parse_uint(name_index + 1, &requested);
|
||||
/* detect parsing error by forcing past end of bank list */
|
||||
return (retval == ERROR_OK) ? requested : ~0U;
|
||||
|
@ -26,7 +26,7 @@ unsigned get_flash_name_index(const char *name)
|
|||
|
||||
bool flash_driver_name_matches(const char *name, const char *expected)
|
||||
{
|
||||
unsigned blen = strlen(name);
|
||||
unsigned int blen = strlen(name);
|
||||
/* only match up to the length of the driver name... */
|
||||
if (strncmp(name, expected, blen) != 0)
|
||||
return false;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* name provides a suffix but it does not parse as an unsigned integer,
|
||||
* the routine returns ~0U. This will prevent further matching.
|
||||
*/
|
||||
unsigned get_flash_name_index(const char *name);
|
||||
unsigned int get_flash_name_index(const char *name);
|
||||
/**
|
||||
* Attempt to match the @c expected name with the @c name of a driver.
|
||||
* @param name The name of the driver (from the bank's device structure).
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
* @return Success or failure of the operation
|
||||
*/
|
||||
static int arm_code_to_working_area(struct target *target,
|
||||
const uint32_t *code, unsigned code_size,
|
||||
unsigned additional, struct working_area **area)
|
||||
const uint32_t *code, unsigned int code_size,
|
||||
unsigned int additional, struct working_area **area)
|
||||
{
|
||||
uint8_t code_buf[code_size];
|
||||
int retval;
|
||||
unsigned size = code_size + additional;
|
||||
unsigned int size = code_size + additional;
|
||||
|
||||
/* REVISIT this assumes size doesn't ever change.
|
||||
* That's usually correct; but there are boards with
|
||||
|
|
|
@ -27,7 +27,7 @@ struct arm_nand_data {
|
|||
struct working_area *copy_area;
|
||||
|
||||
/** The chunk size is the page size or ECC chunk. */
|
||||
unsigned chunk_size;
|
||||
unsigned int chunk_size;
|
||||
|
||||
/** Where data is read from or written to. */
|
||||
uint32_t data;
|
||||
|
|
|
@ -532,7 +532,7 @@ COMMAND_HANDLER(handle_at91sam9_cle_command)
|
|||
{
|
||||
struct nand_device *nand = NULL;
|
||||
struct at91sam9_nand *info = NULL;
|
||||
unsigned num, address_line;
|
||||
unsigned int num, address_line;
|
||||
|
||||
if (CMD_ARGC != 2) {
|
||||
command_print(CMD, "incorrect number of arguments for 'at91sam9 cle' command");
|
||||
|
@ -562,7 +562,7 @@ COMMAND_HANDLER(handle_at91sam9_ale_command)
|
|||
{
|
||||
struct nand_device *nand = NULL;
|
||||
struct at91sam9_nand *info = NULL;
|
||||
unsigned num, address_line;
|
||||
unsigned int num, address_line;
|
||||
|
||||
if (CMD_ARGC != 2)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
@ -590,7 +590,7 @@ COMMAND_HANDLER(handle_at91sam9_rdy_busy_command)
|
|||
{
|
||||
struct nand_device *nand = NULL;
|
||||
struct at91sam9_nand *info = NULL;
|
||||
unsigned num, base_pioc, pin_num;
|
||||
unsigned int num, base_pioc, pin_num;
|
||||
|
||||
if (CMD_ARGC != 3)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
@ -621,7 +621,7 @@ COMMAND_HANDLER(handle_at91sam9_ce_command)
|
|||
{
|
||||
struct nand_device *nand = NULL;
|
||||
struct at91sam9_nand *info = NULL;
|
||||
unsigned num, base_pioc, pin_num;
|
||||
unsigned int num, base_pioc, pin_num;
|
||||
|
||||
if (CMD_ARGC != 3)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
|
|
@ -165,8 +165,8 @@ static struct nand_ecclayout nand_oob_8 = {
|
|||
*/
|
||||
static struct nand_device *get_nand_device_by_name(const char *name)
|
||||
{
|
||||
unsigned requested = get_flash_name_index(name);
|
||||
unsigned found = 0;
|
||||
unsigned int requested = get_flash_name_index(name);
|
||||
unsigned int found = 0;
|
||||
|
||||
struct nand_device *nand;
|
||||
for (nand = nand_devices; nand; nand = nand->next) {
|
||||
|
@ -194,7 +194,7 @@ struct nand_device *get_nand_device_by_num(int num)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
COMMAND_HELPER(nand_command_get_device, unsigned name_index,
|
||||
COMMAND_HELPER(nand_command_get_device, unsigned int name_index,
|
||||
struct nand_device **nand)
|
||||
{
|
||||
const char *str = CMD_ARGV[name_index];
|
||||
|
@ -202,7 +202,7 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index,
|
|||
if (*nand)
|
||||
return ERROR_OK;
|
||||
|
||||
unsigned num;
|
||||
unsigned int num;
|
||||
COMMAND_PARSE_NUMBER(uint, str, num);
|
||||
*nand = get_nand_device_by_num(num);
|
||||
if (!*nand) {
|
||||
|
|
|
@ -209,7 +209,7 @@ int nand_correct_data(struct nand_device *nand, u_char *dat,
|
|||
int nand_register_commands(struct command_context *cmd_ctx);
|
||||
|
||||
/** helper for parsing a nand device command argument string */
|
||||
COMMAND_HELPER(nand_command_get_device, unsigned name_index,
|
||||
COMMAND_HELPER(nand_command_get_device, unsigned int name_index,
|
||||
struct nand_device **nand);
|
||||
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ static int davinci_writepage_tail(struct nand_device *nand,
|
|||
static int davinci_write_page_ecc1(struct nand_device *nand, uint32_t page,
|
||||
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
|
||||
{
|
||||
unsigned oob_offset;
|
||||
unsigned int oob_offset;
|
||||
struct davinci_nand *info = nand->controller_priv;
|
||||
struct target *target = nand->target;
|
||||
const uint32_t fcr_addr = info->aemif + NANDFCR;
|
||||
|
|
|
@ -33,7 +33,7 @@ static struct nand_flash_controller *nand_flash_controllers[] = {
|
|||
|
||||
struct nand_flash_controller *nand_driver_find_by_name(const char *name)
|
||||
{
|
||||
for (unsigned i = 0; nand_flash_controllers[i]; i++) {
|
||||
for (unsigned int i = 0; nand_flash_controllers[i]; i++) {
|
||||
struct nand_flash_controller *controller = nand_flash_controllers[i];
|
||||
if (strcmp(name, controller->name) == 0)
|
||||
return controller;
|
||||
|
@ -42,7 +42,7 @@ struct nand_flash_controller *nand_driver_find_by_name(const char *name)
|
|||
}
|
||||
int nand_driver_walk(nand_driver_walker_t f, void *x)
|
||||
{
|
||||
for (unsigned i = 0; nand_flash_controllers[i]; i++) {
|
||||
for (unsigned int i = 0; nand_flash_controllers[i]; i++) {
|
||||
int retval = (*f)(nand_flash_controllers[i], x);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
|
|
@ -107,7 +107,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
|
|||
{
|
||||
nand_fileio_init(state);
|
||||
|
||||
unsigned minargs = need_size ? 4 : 3;
|
||||
unsigned int minargs = need_size ? 4 : 3;
|
||||
if (minargs > CMD_ARGC)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
|
@ -131,7 +131,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
|
|||
}
|
||||
|
||||
if (minargs < CMD_ARGC) {
|
||||
for (unsigned i = minargs; i < CMD_ARGC; i++) {
|
||||
for (unsigned int i = minargs; i < CMD_ARGC; i++) {
|
||||
if (!strcmp(CMD_ARGV[i], "oob_raw"))
|
||||
state->oob_format |= NAND_OOB_RAW;
|
||||
else if (!strcmp(CMD_ARGV[i], "oob_only"))
|
||||
|
|
|
@ -1274,7 +1274,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
|
|||
if ((CMD_ARGC < 1) || (CMD_ARGC > 3))
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
unsigned num;
|
||||
unsigned int num;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
||||
struct nand_device *nand = get_nand_device_by_num(num);
|
||||
if (!nand) {
|
||||
|
|
|
@ -1742,7 +1742,7 @@ COMMAND_HANDLER(handle_lpc32xx_select_command)
|
|||
if ((CMD_ARGC < 1) || (CMD_ARGC > 3))
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
unsigned num;
|
||||
unsigned int num;
|
||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
||||
struct nand_device *nand = get_nand_device_by_num(num);
|
||||
if (!nand) {
|
||||
|
|
|
@ -79,7 +79,7 @@ static int aducm360_build_sector_list(struct flash_bank *bank)
|
|||
/* sector size is 512 */
|
||||
bank->num_sectors = bank->size / FLASH_SECTOR_SIZE;
|
||||
bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
|
||||
for (unsigned i = 0; i < bank->num_sectors; ++i) {
|
||||
for (unsigned int i = 0; i < bank->num_sectors; ++i) {
|
||||
bank->sectors[i].offset = offset;
|
||||
bank->sectors[i].size = FLASH_SECTOR_SIZE;
|
||||
offset += bank->sectors[i].size;
|
||||
|
|
|
@ -154,15 +154,15 @@ struct sam3_bank_private {
|
|||
struct sam3_chip *chip;
|
||||
/* so we can find the original bank pointer */
|
||||
struct flash_bank *bank;
|
||||
unsigned bank_number;
|
||||
unsigned int bank_number;
|
||||
uint32_t controller_address;
|
||||
uint32_t base_address;
|
||||
uint32_t flash_wait_states;
|
||||
bool present;
|
||||
unsigned size_bytes;
|
||||
unsigned nsectors;
|
||||
unsigned sector_size;
|
||||
unsigned page_size;
|
||||
unsigned int size_bytes;
|
||||
unsigned int nsectors;
|
||||
unsigned int sector_size;
|
||||
unsigned int page_size;
|
||||
};
|
||||
|
||||
struct sam3_chip_details {
|
||||
|
@ -176,12 +176,12 @@ struct sam3_chip_details {
|
|||
uint32_t chipid_cidr;
|
||||
const char *name;
|
||||
|
||||
unsigned n_gpnvms;
|
||||
unsigned int n_gpnvms;
|
||||
#define SAM3_N_NVM_BITS 3
|
||||
unsigned gpnvm[SAM3_N_NVM_BITS];
|
||||
unsigned total_flash_size;
|
||||
unsigned total_sram_size;
|
||||
unsigned n_banks;
|
||||
unsigned int gpnvm[SAM3_N_NVM_BITS];
|
||||
unsigned int total_flash_size;
|
||||
unsigned int total_sram_size;
|
||||
unsigned int n_banks;
|
||||
#define SAM3_MAX_FLASH_BANKS 2
|
||||
/* these are "initialized" from the global const data */
|
||||
struct sam3_bank_private bank[SAM3_MAX_FLASH_BANKS];
|
||||
|
@ -2029,7 +2029,7 @@ static int efc_get_result(struct sam3_bank_private *private, uint32_t *v)
|
|||
}
|
||||
|
||||
static int efc_start_command(struct sam3_bank_private *private,
|
||||
unsigned command, unsigned argument)
|
||||
unsigned int command, unsigned int argument)
|
||||
{
|
||||
uint32_t n, v;
|
||||
int r;
|
||||
|
@ -2124,8 +2124,8 @@ do_retry:
|
|||
* @param status - put command status bits here
|
||||
*/
|
||||
static int efc_perform_command(struct sam3_bank_private *private,
|
||||
unsigned command,
|
||||
unsigned argument,
|
||||
unsigned int command,
|
||||
unsigned int argument,
|
||||
uint32_t *status)
|
||||
{
|
||||
|
||||
|
@ -2220,7 +2220,7 @@ static int flashd_erase_entire_bank(struct sam3_bank_private *private)
|
|||
* @param puthere - result stored here.
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned gpnvm, unsigned *puthere)
|
||||
static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm, unsigned int *puthere)
|
||||
{
|
||||
uint32_t v;
|
||||
int r;
|
||||
|
@ -2261,10 +2261,10 @@ static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned gpnvm, u
|
|||
* @param gpnvm GPNVM index.
|
||||
* @returns 0 if successful; otherwise returns an error code.
|
||||
*/
|
||||
static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned gpnvm)
|
||||
static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm)
|
||||
{
|
||||
int r;
|
||||
unsigned v;
|
||||
unsigned int v;
|
||||
|
||||
LOG_DEBUG("Here");
|
||||
if (private->bank_number != 0) {
|
||||
|
@ -2293,10 +2293,10 @@ static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned gpnvm)
|
|||
* @param private info about the bank
|
||||
* @param gpnvm GPNVM index.
|
||||
*/
|
||||
static int flashd_set_gpnvm(struct sam3_bank_private *private, unsigned gpnvm)
|
||||
static int flashd_set_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm)
|
||||
{
|
||||
int r;
|
||||
unsigned v;
|
||||
unsigned int v;
|
||||
|
||||
if (private->bank_number != 0) {
|
||||
LOG_ERROR("GPNVM only works with Bank0");
|
||||
|
@ -2346,8 +2346,8 @@ static int flashd_get_lock_bits(struct sam3_bank_private *private, uint32_t *v)
|
|||
*/
|
||||
|
||||
static int flashd_unlock(struct sam3_bank_private *private,
|
||||
unsigned start_sector,
|
||||
unsigned end_sector)
|
||||
unsigned int start_sector,
|
||||
unsigned int end_sector)
|
||||
{
|
||||
int r;
|
||||
uint32_t status;
|
||||
|
@ -2376,8 +2376,8 @@ static int flashd_unlock(struct sam3_bank_private *private,
|
|||
* @param end_sector - last sector (inclusive) to lock
|
||||
*/
|
||||
static int flashd_lock(struct sam3_bank_private *private,
|
||||
unsigned start_sector,
|
||||
unsigned end_sector)
|
||||
unsigned int start_sector,
|
||||
unsigned int end_sector)
|
||||
{
|
||||
uint32_t status;
|
||||
uint32_t pg;
|
||||
|
@ -2405,8 +2405,8 @@ static int flashd_lock(struct sam3_bank_private *private,
|
|||
static uint32_t sam3_reg_fieldname(struct sam3_chip *chip,
|
||||
const char *regname,
|
||||
uint32_t value,
|
||||
unsigned shift,
|
||||
unsigned width)
|
||||
unsigned int shift,
|
||||
unsigned int width)
|
||||
{
|
||||
uint32_t v;
|
||||
int hwidth, dwidth;
|
||||
|
@ -2491,7 +2491,7 @@ static const char *const sramsize[] = {
|
|||
|
||||
};
|
||||
|
||||
static const struct archnames { unsigned value; const char *name; } archnames[] = {
|
||||
static const struct archnames { unsigned int value; const char *name; } archnames[] = {
|
||||
{ 0x19, "AT91SAM9xx Series" },
|
||||
{ 0x29, "AT91SAM9XExx Series" },
|
||||
{ 0x34, "AT91x34 Series" },
|
||||
|
@ -2951,7 +2951,7 @@ static int sam3_protect_check(struct flash_bank *bank)
|
|||
{
|
||||
int r;
|
||||
uint32_t v = 0;
|
||||
unsigned x;
|
||||
unsigned int x;
|
||||
struct sam3_bank_private *private;
|
||||
|
||||
LOG_DEBUG("Begin");
|
||||
|
@ -3071,7 +3071,7 @@ static int sam3_get_details(struct sam3_bank_private *private)
|
|||
const struct sam3_chip_details *details;
|
||||
struct sam3_chip *chip;
|
||||
struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS];
|
||||
unsigned x;
|
||||
unsigned int x;
|
||||
|
||||
LOG_DEBUG("Begin");
|
||||
details = all_sam3_details;
|
||||
|
@ -3264,7 +3264,7 @@ static int sam3_protect(struct flash_bank *bank, int set, unsigned int first,
|
|||
|
||||
}
|
||||
|
||||
static int sam3_page_read(struct sam3_bank_private *private, unsigned pagenum, uint8_t *buf)
|
||||
static int sam3_page_read(struct sam3_bank_private *private, unsigned int pagenum, uint8_t *buf)
|
||||
{
|
||||
uint32_t adr;
|
||||
int r;
|
||||
|
@ -3283,7 +3283,7 @@ static int sam3_page_read(struct sam3_bank_private *private, unsigned pagenum, u
|
|||
return r;
|
||||
}
|
||||
|
||||
static int sam3_page_write(struct sam3_bank_private *private, unsigned pagenum, const uint8_t *buf)
|
||||
static int sam3_page_write(struct sam3_bank_private *private, unsigned int pagenum, const uint8_t *buf)
|
||||
{
|
||||
uint32_t adr;
|
||||
uint32_t status;
|
||||
|
@ -3347,10 +3347,10 @@ static int sam3_write(struct flash_bank *bank,
|
|||
uint32_t count)
|
||||
{
|
||||
int n;
|
||||
unsigned page_cur;
|
||||
unsigned page_end;
|
||||
unsigned int page_cur;
|
||||
unsigned int page_end;
|
||||
int r;
|
||||
unsigned page_offset;
|
||||
unsigned int page_offset;
|
||||
struct sam3_bank_private *private;
|
||||
uint8_t *pagebuffer;
|
||||
|
||||
|
@ -3497,7 +3497,7 @@ COMMAND_HANDLER(sam3_handle_info_command)
|
|||
if (!chip)
|
||||
return ERROR_OK;
|
||||
|
||||
unsigned x;
|
||||
unsigned int x;
|
||||
int r;
|
||||
|
||||
/* bank0 must exist before we can do anything */
|
||||
|
@ -3549,7 +3549,7 @@ need_define:
|
|||
|
||||
COMMAND_HANDLER(sam3_handle_gpnvm_command)
|
||||
{
|
||||
unsigned x, v;
|
||||
unsigned int x, v;
|
||||
int r, who;
|
||||
struct sam3_chip *chip;
|
||||
|
||||
|
|
|
@ -134,15 +134,15 @@ struct sam4_bank_private {
|
|||
struct sam4_chip *chip;
|
||||
/* so we can find the original bank pointer */
|
||||
struct flash_bank *bank;
|
||||
unsigned bank_number;
|
||||
unsigned int bank_number;
|
||||
uint32_t controller_address;
|
||||
uint32_t base_address;
|
||||
uint32_t flash_wait_states;
|
||||
bool present;
|
||||
unsigned size_bytes;
|
||||
unsigned nsectors;
|
||||
unsigned sector_size;
|
||||
unsigned page_size;
|
||||
unsigned int size_bytes;
|
||||
unsigned int nsectors;
|
||||
unsigned int sector_size;
|
||||
unsigned int page_size;
|
||||
};
|
||||
|
||||
struct sam4_chip_details {
|
||||
|
@ -156,12 +156,12 @@ struct sam4_chip_details {
|
|||
uint32_t chipid_cidr;
|
||||
const char *name;
|
||||
|
||||
unsigned n_gpnvms;
|
||||
unsigned int n_gpnvms;
|
||||
#define SAM4_N_NVM_BITS 3
|
||||
unsigned gpnvm[SAM4_N_NVM_BITS];
|
||||
unsigned total_flash_size;
|
||||
unsigned total_sram_size;
|
||||
unsigned n_banks;
|
||||
unsigned int gpnvm[SAM4_N_NVM_BITS];
|
||||
unsigned int total_flash_size;
|
||||
unsigned int total_sram_size;
|
||||
unsigned int n_banks;
|
||||
#define SAM4_MAX_FLASH_BANKS 2
|
||||
/* these are "initialized" from the global const data */
|
||||
struct sam4_bank_private bank[SAM4_MAX_FLASH_BANKS];
|
||||
|
@ -1479,7 +1479,7 @@ static int efc_get_result(struct sam4_bank_private *private, uint32_t *v)
|
|||
}
|
||||
|
||||
static int efc_start_command(struct sam4_bank_private *private,
|
||||
unsigned command, unsigned argument)
|
||||
unsigned int command, unsigned int argument)
|
||||
{
|
||||
uint32_t n, v;
|
||||
int r;
|
||||
|
@ -1574,8 +1574,8 @@ do_retry:
|
|||
* @param status - put command status bits here
|
||||
*/
|
||||
static int efc_perform_command(struct sam4_bank_private *private,
|
||||
unsigned command,
|
||||
unsigned argument,
|
||||
unsigned int command,
|
||||
unsigned int argument,
|
||||
uint32_t *status)
|
||||
{
|
||||
|
||||
|
@ -1716,7 +1716,7 @@ static int flashd_erase_pages(struct sam4_bank_private *private,
|
|||
* @param puthere - result stored here.
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned gpnvm, unsigned *puthere)
|
||||
static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm, unsigned int *puthere)
|
||||
{
|
||||
uint32_t v;
|
||||
int r;
|
||||
|
@ -1757,10 +1757,10 @@ static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned gpnvm, u
|
|||
* @param gpnvm GPNVM index.
|
||||
* @returns 0 if successful; otherwise returns an error code.
|
||||
*/
|
||||
static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned gpnvm)
|
||||
static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm)
|
||||
{
|
||||
int r;
|
||||
unsigned v;
|
||||
unsigned int v;
|
||||
|
||||
LOG_DEBUG("Here");
|
||||
if (private->bank_number != 0) {
|
||||
|
@ -1789,10 +1789,10 @@ static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned gpnvm)
|
|||
* @param private info about the bank
|
||||
* @param gpnvm GPNVM index.
|
||||
*/
|
||||
static int flashd_set_gpnvm(struct sam4_bank_private *private, unsigned gpnvm)
|
||||
static int flashd_set_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm)
|
||||
{
|
||||
int r;
|
||||
unsigned v;
|
||||
unsigned int v;
|
||||
|
||||
if (private->bank_number != 0) {
|
||||
LOG_ERROR("GPNVM only works with Bank0");
|
||||
|
@ -1846,8 +1846,8 @@ static int flashd_get_lock_bits(struct sam4_bank_private *private, uint32_t *v)
|
|||
*/
|
||||
|
||||
static int flashd_unlock(struct sam4_bank_private *private,
|
||||
unsigned start_sector,
|
||||
unsigned end_sector)
|
||||
unsigned int start_sector,
|
||||
unsigned int end_sector)
|
||||
{
|
||||
int r;
|
||||
uint32_t status;
|
||||
|
@ -1876,8 +1876,8 @@ static int flashd_unlock(struct sam4_bank_private *private,
|
|||
* @param end_sector - last sector (inclusive) to lock
|
||||
*/
|
||||
static int flashd_lock(struct sam4_bank_private *private,
|
||||
unsigned start_sector,
|
||||
unsigned end_sector)
|
||||
unsigned int start_sector,
|
||||
unsigned int end_sector)
|
||||
{
|
||||
uint32_t status;
|
||||
uint32_t pg;
|
||||
|
@ -1905,8 +1905,8 @@ static int flashd_lock(struct sam4_bank_private *private,
|
|||
static uint32_t sam4_reg_fieldname(struct sam4_chip *chip,
|
||||
const char *regname,
|
||||
uint32_t value,
|
||||
unsigned shift,
|
||||
unsigned width)
|
||||
unsigned int shift,
|
||||
unsigned int width)
|
||||
{
|
||||
uint32_t v;
|
||||
int hwidth, dwidth;
|
||||
|
@ -1991,7 +1991,7 @@ static const char *const sramsize[] = {
|
|||
|
||||
};
|
||||
|
||||
static const struct archnames { unsigned value; const char *name; } archnames[] = {
|
||||
static const struct archnames { unsigned int value; const char *name; } archnames[] = {
|
||||
{ 0x19, "AT91SAM9xx Series" },
|
||||
{ 0x29, "AT91SAM9XExx Series" },
|
||||
{ 0x34, "AT91x34 Series" },
|
||||
|
@ -2444,7 +2444,7 @@ static int sam4_protect_check(struct flash_bank *bank)
|
|||
{
|
||||
int r;
|
||||
uint32_t v[4] = {0};
|
||||
unsigned x;
|
||||
unsigned int x;
|
||||
struct sam4_bank_private *private;
|
||||
|
||||
LOG_DEBUG("Begin");
|
||||
|
@ -2557,7 +2557,7 @@ static int sam4_get_details(struct sam4_bank_private *private)
|
|||
const struct sam4_chip_details *details;
|
||||
struct sam4_chip *chip;
|
||||
struct flash_bank *saved_banks[SAM4_MAX_FLASH_BANKS];
|
||||
unsigned x;
|
||||
unsigned int x;
|
||||
|
||||
LOG_DEBUG("Begin");
|
||||
details = all_sam4_details;
|
||||
|
@ -2796,7 +2796,7 @@ static int sam4_protect(struct flash_bank *bank, int set, unsigned int first,
|
|||
|
||||
}
|
||||
|
||||
static int sam4_page_read(struct sam4_bank_private *private, unsigned pagenum, uint8_t *buf)
|
||||
static int sam4_page_read(struct sam4_bank_private *private, unsigned int pagenum, uint8_t *buf)
|
||||
{
|
||||
uint32_t adr;
|
||||
int r;
|
||||
|
@ -2841,7 +2841,7 @@ static int sam4_set_wait(struct sam4_bank_private *private)
|
|||
return r;
|
||||
}
|
||||
|
||||
static int sam4_page_write(struct sam4_bank_private *private, unsigned pagenum, const uint8_t *buf)
|
||||
static int sam4_page_write(struct sam4_bank_private *private, unsigned int pagenum, const uint8_t *buf)
|
||||
{
|
||||
uint32_t adr;
|
||||
uint32_t status;
|
||||
|
@ -2891,10 +2891,10 @@ static int sam4_write(struct flash_bank *bank,
|
|||
uint32_t count)
|
||||
{
|
||||
int n;
|
||||
unsigned page_cur;
|
||||
unsigned page_end;
|
||||
unsigned int page_cur;
|
||||
unsigned int page_end;
|
||||
int r;
|
||||
unsigned page_offset;
|
||||
unsigned int page_offset;
|
||||
struct sam4_bank_private *private;
|
||||
uint8_t *pagebuffer;
|
||||
|
||||
|
@ -3045,7 +3045,7 @@ COMMAND_HANDLER(sam4_handle_info_command)
|
|||
if (!chip)
|
||||
return ERROR_OK;
|
||||
|
||||
unsigned x;
|
||||
unsigned int x;
|
||||
int r;
|
||||
|
||||
/* bank0 must exist before we can do anything */
|
||||
|
@ -3097,7 +3097,7 @@ need_define:
|
|||
|
||||
COMMAND_HANDLER(sam4_handle_gpnvm_command)
|
||||
{
|
||||
unsigned x, v;
|
||||
unsigned int x, v;
|
||||
int r, who;
|
||||
struct sam4_chip *chip;
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ static const struct samd_family *samd_find_family(uint32_t id)
|
|||
uint8_t family = SAMD_GET_FAMILY(id);
|
||||
uint8_t series = SAMD_GET_SERIES(id);
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(samd_families); i++) {
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(samd_families); i++) {
|
||||
if (samd_families[i].processor == processor &&
|
||||
samd_families[i].series == series &&
|
||||
samd_families[i].family == family)
|
||||
|
@ -387,7 +387,7 @@ static const struct samd_part *samd_find_part(uint32_t id)
|
|||
if (!family)
|
||||
return NULL;
|
||||
|
||||
for (unsigned i = 0; i < family->num_parts; i++) {
|
||||
for (unsigned int i = 0; i < family->num_parts; i++) {
|
||||
if (family->parts[i].id == devsel)
|
||||
return &family->parts[i];
|
||||
}
|
||||
|
|
|
@ -513,7 +513,7 @@ static int ath79_erase(struct flash_bank *bank, unsigned int first,
|
|||
if (ath79_info->dev->erase_cmd == 0x00)
|
||||
return ERROR_FLASH_OPER_UNSUPPORTED;
|
||||
|
||||
for (unsigned sector = first; sector <= last; sector++) {
|
||||
for (unsigned int sector = first; sector <= last; sector++) {
|
||||
if (bank->sectors[sector].is_protected) {
|
||||
LOG_ERROR("Flash sector %u protected", sector);
|
||||
return ERROR_FAIL;
|
||||
|
|
|
@ -224,7 +224,7 @@ static const struct samd_family *samd_find_family(uint32_t id)
|
|||
uint8_t family = SAMD_GET_FAMILY(id);
|
||||
uint8_t series = SAMD_GET_SERIES(id);
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(samd_families); i++) {
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(samd_families); i++) {
|
||||
if (samd_families[i].processor == processor &&
|
||||
samd_families[i].series == series &&
|
||||
samd_families[i].family == family)
|
||||
|
@ -246,7 +246,7 @@ static const struct samd_part *samd_find_part(uint32_t id)
|
|||
if (!family)
|
||||
return NULL;
|
||||
|
||||
for (unsigned i = 0; i < family->num_parts; i++) {
|
||||
for (unsigned int i = 0; i < family->num_parts; i++) {
|
||||
if (family->parts[i].id == devsel)
|
||||
return &family->parts[i];
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
|
||||
struct samv_flash_bank {
|
||||
bool probed;
|
||||
unsigned size_bytes;
|
||||
unsigned gpnvm[SAMV_NUM_GPNVM_BITS];
|
||||
unsigned int size_bytes;
|
||||
unsigned int gpnvm[SAMV_NUM_GPNVM_BITS];
|
||||
};
|
||||
|
||||
/* The actual sector size of the SAMV7 flash memory is 128K bytes.
|
||||
|
@ -82,7 +82,7 @@ static int samv_efc_get_result(struct target *target, uint32_t *v)
|
|||
}
|
||||
|
||||
static int samv_efc_start_command(struct target *target,
|
||||
unsigned command, unsigned argument)
|
||||
unsigned int command, unsigned int argument)
|
||||
{
|
||||
uint32_t v;
|
||||
samv_efc_get_status(target, &v);
|
||||
|
@ -100,7 +100,7 @@ static int samv_efc_start_command(struct target *target,
|
|||
}
|
||||
|
||||
static int samv_efc_perform_command(struct target *target,
|
||||
unsigned command, unsigned argument, uint32_t *status)
|
||||
unsigned int command, unsigned int argument, uint32_t *status)
|
||||
{
|
||||
int r;
|
||||
uint32_t v;
|
||||
|
@ -166,7 +166,7 @@ static int samv_erase_pages(struct target *target,
|
|||
first_page | erase_pages, status);
|
||||
}
|
||||
|
||||
static int samv_get_gpnvm(struct target *target, unsigned gpnvm, unsigned *out)
|
||||
static int samv_get_gpnvm(struct target *target, unsigned int gpnvm, unsigned int *out)
|
||||
{
|
||||
uint32_t v;
|
||||
int r;
|
||||
|
@ -190,10 +190,10 @@ static int samv_get_gpnvm(struct target *target, unsigned gpnvm, unsigned *out)
|
|||
return r;
|
||||
}
|
||||
|
||||
static int samv_clear_gpnvm(struct target *target, unsigned gpnvm)
|
||||
static int samv_clear_gpnvm(struct target *target, unsigned int gpnvm)
|
||||
{
|
||||
int r;
|
||||
unsigned v;
|
||||
unsigned int v;
|
||||
|
||||
if (gpnvm >= SAMV_NUM_GPNVM_BITS) {
|
||||
LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS);
|
||||
|
@ -209,10 +209,10 @@ static int samv_clear_gpnvm(struct target *target, unsigned gpnvm)
|
|||
return r;
|
||||
}
|
||||
|
||||
static int samv_set_gpnvm(struct target *target, unsigned gpnvm)
|
||||
static int samv_set_gpnvm(struct target *target, unsigned int gpnvm)
|
||||
{
|
||||
int r;
|
||||
unsigned v;
|
||||
unsigned int v;
|
||||
if (gpnvm >= SAMV_NUM_GPNVM_BITS) {
|
||||
LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS);
|
||||
return ERROR_FAIL;
|
||||
|
@ -231,7 +231,7 @@ static int samv_set_gpnvm(struct target *target, unsigned gpnvm)
|
|||
}
|
||||
|
||||
static int samv_flash_unlock(struct target *target,
|
||||
unsigned start_sector, unsigned end_sector)
|
||||
unsigned int start_sector, unsigned int end_sector)
|
||||
{
|
||||
int r;
|
||||
uint32_t status;
|
||||
|
@ -251,7 +251,7 @@ static int samv_flash_unlock(struct target *target,
|
|||
}
|
||||
|
||||
static int samv_flash_lock(struct target *target,
|
||||
unsigned start_sector, unsigned end_sector)
|
||||
unsigned int start_sector, unsigned int end_sector)
|
||||
{
|
||||
uint32_t status;
|
||||
uint32_t pg;
|
||||
|
@ -419,7 +419,7 @@ static int samv_protect(struct flash_bank *bank, int set, unsigned int first,
|
|||
}
|
||||
|
||||
static int samv_page_read(struct target *target,
|
||||
unsigned page_num, uint8_t *buf)
|
||||
unsigned int page_num, uint8_t *buf)
|
||||
{
|
||||
uint32_t addr = SAMV_FLASH_BASE + page_num * SAMV_PAGE_SIZE;
|
||||
int r = target_read_memory(target, addr, 4, SAMV_PAGE_SIZE / 4, buf);
|
||||
|
@ -430,7 +430,7 @@ static int samv_page_read(struct target *target,
|
|||
}
|
||||
|
||||
static int samv_page_write(struct target *target,
|
||||
unsigned pagenum, const uint8_t *buf)
|
||||
unsigned int pagenum, const uint8_t *buf)
|
||||
{
|
||||
uint32_t status;
|
||||
const uint32_t addr = SAMV_FLASH_BASE + pagenum * SAMV_PAGE_SIZE;
|
||||
|
@ -618,7 +618,7 @@ COMMAND_HANDLER(samv_handle_gpnvm_command)
|
|||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
unsigned v = 0;
|
||||
unsigned int v = 0;
|
||||
if (!strcmp("show", CMD_ARGV[0])) {
|
||||
if (who == -1) {
|
||||
showall:
|
||||
|
|
|
@ -806,7 +806,7 @@ int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned int argc, const char **
|
|||
}
|
||||
bank->driver_priv = cfi_info;
|
||||
|
||||
for (unsigned i = 6; i < argc; i++) {
|
||||
for (unsigned int i = 6; i < argc; i++) {
|
||||
if (strcmp(argv[i], "x16_as_x8") == 0)
|
||||
cfi_info->x16_as_x8 = true;
|
||||
else if (strcmp(argv[i], "data_swap") == 0)
|
||||
|
|
|
@ -58,10 +58,10 @@ struct cfi_flash_bank {
|
|||
void *alt_ext;
|
||||
|
||||
/* calculated timeouts */
|
||||
unsigned word_write_timeout;
|
||||
unsigned buf_write_timeout;
|
||||
unsigned block_erase_timeout;
|
||||
unsigned chip_erase_timeout;
|
||||
unsigned int word_write_timeout;
|
||||
unsigned int buf_write_timeout;
|
||||
unsigned int block_erase_timeout;
|
||||
unsigned int chip_erase_timeout;
|
||||
|
||||
/* memory accessors */
|
||||
int (*write_mem)(struct flash_bank *bank, target_addr_t addr,
|
||||
|
|
|
@ -164,7 +164,7 @@ int default_flash_verify(struct flash_bank *bank,
|
|||
void flash_bank_add(struct flash_bank *bank)
|
||||
{
|
||||
/* put flash bank in linked list */
|
||||
unsigned bank_num = 0;
|
||||
unsigned int bank_num = 0;
|
||||
if (flash_banks) {
|
||||
/* find last flash bank */
|
||||
struct flash_bank *p = flash_banks;
|
||||
|
@ -242,8 +242,8 @@ void flash_free_all_banks(void)
|
|||
|
||||
struct flash_bank *get_flash_bank_by_name_noprobe(const char *name)
|
||||
{
|
||||
unsigned requested = get_flash_name_index(name);
|
||||
unsigned found = 0;
|
||||
unsigned int requested = get_flash_name_index(name);
|
||||
unsigned int found = 0;
|
||||
|
||||
struct flash_bank *bank;
|
||||
for (bank = flash_banks; bank; bank = bank->next) {
|
||||
|
|
|
@ -250,7 +250,7 @@ int get_flash_bank_by_num(unsigned int num, struct flash_bank **bank);
|
|||
* @param bank On output, contains a pointer to the bank or NULL.
|
||||
* @returns ERROR_OK on success, or an error indicating the problem.
|
||||
*/
|
||||
COMMAND_HELPER(flash_command_get_bank, unsigned name_index,
|
||||
COMMAND_HELPER(flash_command_get_bank, unsigned int name_index,
|
||||
struct flash_bank **bank);
|
||||
/**
|
||||
* Retrieves @a bank from a command argument, reporting errors parsing
|
||||
|
|
|
@ -91,7 +91,7 @@ static const struct flash_driver * const flash_drivers[] = {
|
|||
|
||||
const struct flash_driver *flash_driver_find_by_name(const char *name)
|
||||
{
|
||||
for (unsigned i = 0; flash_drivers[i]; i++) {
|
||||
for (unsigned int i = 0; flash_drivers[i]; i++) {
|
||||
if (strcmp(name, flash_drivers[i]->name) == 0)
|
||||
return flash_drivers[i];
|
||||
}
|
||||
|
|
|
@ -531,7 +531,7 @@ static int fespi_write(struct flash_bank *bank, const uint8_t *buffer,
|
|||
bin_size = sizeof(riscv64_bin);
|
||||
}
|
||||
|
||||
unsigned data_wa_size = 0;
|
||||
unsigned int data_wa_size = 0;
|
||||
if (target_alloc_working_area(target, bin_size, &algorithm_wa) == ERROR_OK) {
|
||||
retval = target_write_buffer(target, algorithm_wa->address,
|
||||
bin_size, bin);
|
||||
|
|
|
@ -107,7 +107,7 @@ static int fm4_flash_erase(struct flash_bank *bank, unsigned int first,
|
|||
struct working_area *workarea;
|
||||
struct reg_param reg_params[4];
|
||||
struct armv7m_algorithm armv7m_algo;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int retval;
|
||||
const uint8_t erase_sector_code[] = {
|
||||
#include "../../../contrib/loaders/flash/fm4/erase.inc"
|
||||
|
@ -207,7 +207,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
|
|||
struct armv7m_algorithm armv7m_algo;
|
||||
uint32_t halfword_count = DIV_ROUND_UP(byte_count, 2);
|
||||
uint32_t result;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int retval, retval2 = ERROR_OK;
|
||||
const uint8_t write_block_code[] = {
|
||||
#include "../../../contrib/loaders/flash/fm4/write.inc"
|
||||
|
|
|
@ -256,7 +256,7 @@
|
|||
struct kinetis_flash_bank {
|
||||
struct kinetis_chip *k_chip;
|
||||
bool probed;
|
||||
unsigned bank_number; /* bank number in particular chip */
|
||||
unsigned int bank_number; /* bank number in particular chip */
|
||||
struct flash_bank *bank;
|
||||
|
||||
uint32_t sector_size;
|
||||
|
@ -285,9 +285,9 @@ struct kinetis_chip {
|
|||
uint32_t fcfg2_maxaddr0_shifted;
|
||||
uint32_t fcfg2_maxaddr1_shifted;
|
||||
|
||||
unsigned num_pflash_blocks, num_nvm_blocks;
|
||||
unsigned pflash_sector_size, nvm_sector_size;
|
||||
unsigned max_flash_prog_size;
|
||||
unsigned int num_pflash_blocks, num_nvm_blocks;
|
||||
unsigned int pflash_sector_size, nvm_sector_size;
|
||||
unsigned int max_flash_prog_size;
|
||||
|
||||
uint32_t pflash_base;
|
||||
uint32_t pflash_size;
|
||||
|
@ -337,7 +337,7 @@ struct kinetis_chip {
|
|||
|
||||
char name[40];
|
||||
|
||||
unsigned num_banks;
|
||||
unsigned int num_banks;
|
||||
struct kinetis_flash_bank banks[KINETIS_MAX_BANKS];
|
||||
};
|
||||
|
||||
|
@ -425,7 +425,7 @@ static int kinetis_probe_chip_s32k(struct kinetis_chip *k_chip);
|
|||
static int kinetis_auto_probe(struct flash_bank *bank);
|
||||
|
||||
|
||||
static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value)
|
||||
static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
|
||||
{
|
||||
LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value);
|
||||
|
||||
|
@ -453,7 +453,7 @@ static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint3
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result)
|
||||
static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
|
||||
{
|
||||
struct adiv5_ap *ap = dap_get_ap(dap, MDM_AP);
|
||||
if (!ap) {
|
||||
|
@ -479,7 +479,7 @@ static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int kinetis_mdm_poll_register(struct adiv5_dap *dap, unsigned reg,
|
||||
static int kinetis_mdm_poll_register(struct adiv5_dap *dap, unsigned int reg,
|
||||
uint32_t mask, uint32_t value, uint32_t timeout_ms)
|
||||
{
|
||||
uint32_t val;
|
||||
|
@ -977,7 +977,7 @@ static void kinetis_free_driver_priv(struct flash_bank *bank)
|
|||
|
||||
static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
|
||||
{
|
||||
unsigned num_blocks;
|
||||
unsigned int num_blocks;
|
||||
struct kinetis_flash_bank *k_bank;
|
||||
struct flash_bank *bank;
|
||||
char base_name[69], name[87], num[11];
|
||||
|
@ -1463,7 +1463,7 @@ static int kinetis_fill_fcf(struct flash_bank *bank, uint8_t *fcf)
|
|||
uint32_t fprot = 0xffffffff;
|
||||
uint8_t fsec = 0xfe; /* set MCU unsecure */
|
||||
uint8_t fdprot = 0xff;
|
||||
unsigned num_blocks;
|
||||
unsigned int num_blocks;
|
||||
uint32_t pflash_bit;
|
||||
uint8_t dflash_bit;
|
||||
struct flash_bank *bank_iter;
|
||||
|
@ -2269,12 +2269,12 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
|
|||
uint32_t ee_size = 0;
|
||||
uint32_t pflash_size_k, nvm_size_k, dflash_size_k;
|
||||
uint32_t pflash_size_m;
|
||||
unsigned num_blocks = 0;
|
||||
unsigned maxaddr_shift = 13;
|
||||
unsigned int num_blocks = 0;
|
||||
unsigned int maxaddr_shift = 13;
|
||||
struct target *target = k_chip->target;
|
||||
|
||||
unsigned familyid = 0, subfamid = 0;
|
||||
unsigned cpu_mhz = 120;
|
||||
unsigned int familyid = 0, subfamid = 0;
|
||||
unsigned int cpu_mhz = 120;
|
||||
bool use_nvm_marking = false;
|
||||
char flash_marking[12], nvm_marking[2];
|
||||
char name[40];
|
||||
|
@ -2895,7 +2895,7 @@ static int kinetis_probe(struct flash_bank *bank)
|
|||
{
|
||||
int result;
|
||||
uint8_t fcfg2_maxaddr0, fcfg2_pflsh, fcfg2_maxaddr1;
|
||||
unsigned num_blocks, first_nvm_bank;
|
||||
unsigned int num_blocks, first_nvm_bank;
|
||||
uint32_t size_k;
|
||||
struct kinetis_flash_bank *k_bank = bank->driver_priv;
|
||||
struct kinetis_chip *k_chip;
|
||||
|
@ -2940,7 +2940,7 @@ static int kinetis_probe(struct flash_bank *bank)
|
|||
|
||||
} else if (k_bank->bank_number < num_blocks) {
|
||||
/* nvm, banks start at address 0x10000000 */
|
||||
unsigned nvm_ord = k_bank->bank_number - first_nvm_bank;
|
||||
unsigned int nvm_ord = k_bank->bank_number - first_nvm_bank;
|
||||
uint32_t limit;
|
||||
|
||||
k_bank->flash_class = FC_FLEX_NVM;
|
||||
|
@ -3139,8 +3139,8 @@ static int kinetis_blank_check(struct flash_bank *bank)
|
|||
COMMAND_HANDLER(kinetis_nvm_partition)
|
||||
{
|
||||
int result;
|
||||
unsigned bank_idx;
|
||||
unsigned num_blocks, first_nvm_bank;
|
||||
unsigned int bank_idx;
|
||||
unsigned int num_blocks, first_nvm_bank;
|
||||
unsigned long par, log2 = 0, ee1 = 0, ee2 = 0;
|
||||
enum { SHOW_INFO, DF_SIZE, EEBKP_SIZE } sz_type = SHOW_INFO;
|
||||
bool enable;
|
||||
|
|
|
@ -134,7 +134,7 @@ struct kinetis_ke_flash_bank {
|
|||
|
||||
#define MDM_ACCESS_TIMEOUT 3000 /* iterations */
|
||||
|
||||
static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value)
|
||||
static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
|
||||
{
|
||||
LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value);
|
||||
|
||||
|
@ -161,7 +161,7 @@ static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned reg, ui
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result)
|
||||
static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
|
||||
{
|
||||
struct adiv5_ap *ap = dap_get_ap(dap, 1);
|
||||
if (!ap) {
|
||||
|
@ -187,7 +187,7 @@ static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uin
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int kinetis_ke_mdm_poll_register(struct adiv5_dap *dap, unsigned reg, uint32_t mask, uint32_t value)
|
||||
static int kinetis_ke_mdm_poll_register(struct adiv5_dap *dap, unsigned int reg, uint32_t mask, uint32_t value)
|
||||
{
|
||||
uint32_t val;
|
||||
int retval;
|
||||
|
|
|
@ -202,14 +202,14 @@ static int max32xxx_protect_check(struct flash_bank *bank)
|
|||
return ERROR_FLASH_BANK_NOT_PROBED;
|
||||
|
||||
if (!info->max326xx) {
|
||||
for (unsigned i = 0; i < bank->num_sectors; i++)
|
||||
for (unsigned int i = 0; i < bank->num_sectors; i++)
|
||||
bank->sectors[i].is_protected = -1;
|
||||
|
||||
return ERROR_FLASH_OPER_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/* Check the protection */
|
||||
for (unsigned i = 0; i < bank->num_sectors; i++) {
|
||||
for (unsigned int i = 0; i < bank->num_sectors; i++) {
|
||||
if (i%32 == 0)
|
||||
target_read_u32(target, info->flc_base + FLSH_PROT + ((i/32)*4), &temp_reg);
|
||||
|
||||
|
@ -360,7 +360,7 @@ static int max32xxx_write_block(struct flash_bank *bank, const uint8_t *buffer,
|
|||
struct armv7m_algorithm armv7m_info;
|
||||
int retval = ERROR_OK;
|
||||
/* power of two, and multiple of word size */
|
||||
static const unsigned buf_min = 128;
|
||||
static const unsigned int buf_min = 128;
|
||||
|
||||
/* for small buffers it's faster not to download an algorithm */
|
||||
if (wcount * 4 < buf_min)
|
||||
|
@ -903,7 +903,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_check_command)
|
|||
}
|
||||
|
||||
LOG_WARNING("s:<sector number> a:<address> p:<protection bit>");
|
||||
for (unsigned i = 0; i < bank->num_sectors; i += 4) {
|
||||
for (unsigned int i = 0; i < bank->num_sectors; i += 4) {
|
||||
LOG_WARNING("s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d",
|
||||
(i+0), (i+0)*info->sector_size, bank->sectors[(i+0)].is_protected,
|
||||
(i+1), (i+1)*info->sector_size, bank->sectors[(i+1)].is_protected,
|
||||
|
|
|
@ -102,10 +102,10 @@
|
|||
|
||||
struct psoc5lp_device {
|
||||
uint32_t id;
|
||||
unsigned fam;
|
||||
unsigned speed_mhz;
|
||||
unsigned flash_kb;
|
||||
unsigned eeprom_kb;
|
||||
unsigned int fam;
|
||||
unsigned int speed_mhz;
|
||||
unsigned int flash_kb;
|
||||
unsigned int eeprom_kb;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -245,7 +245,7 @@ static int psoc5lp_find_device(struct target *target,
|
|||
const struct psoc5lp_device **device)
|
||||
{
|
||||
uint32_t device_id;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int retval;
|
||||
|
||||
*device = NULL;
|
||||
|
@ -381,9 +381,9 @@ static int psoc5lp_spc_load_byte(struct target *target,
|
|||
}
|
||||
|
||||
static int psoc5lp_spc_load_row(struct target *target,
|
||||
uint8_t array_id, const uint8_t *data, unsigned row_size)
|
||||
uint8_t array_id, const uint8_t *data, unsigned int row_size)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int retval;
|
||||
|
||||
retval = psoc5lp_spc_write_opcode(target, SPC_LOAD_ROW);
|
||||
|
@ -853,7 +853,7 @@ static int psoc5lp_eeprom_write(struct flash_bank *bank,
|
|||
{
|
||||
struct target *target = bank->target;
|
||||
uint8_t temp[2];
|
||||
unsigned row;
|
||||
unsigned int row;
|
||||
int retval;
|
||||
|
||||
if (offset % EEPROM_ROW_SIZE != 0) {
|
||||
|
@ -1124,7 +1124,7 @@ static int psoc5lp_write(struct flash_bank *bank, const uint8_t *buffer,
|
|||
struct working_area *code_area, *even_row_area, *odd_row_area;
|
||||
uint32_t row_size;
|
||||
uint8_t temp[2], buf[12], ecc_bytes[ROW_ECC_SIZE];
|
||||
unsigned array_id, row;
|
||||
unsigned int array_id, row;
|
||||
int i, retval;
|
||||
|
||||
if (offset + byte_count > bank->size) {
|
||||
|
@ -1183,7 +1183,7 @@ static int psoc5lp_write(struct flash_bank *bank, const uint8_t *buffer,
|
|||
row < ROWS_PER_BLOCK && byte_count > 0; row++) {
|
||||
bool even_row = (row % 2 == 0);
|
||||
struct working_area *data_area = even_row ? even_row_area : odd_row_area;
|
||||
unsigned len = MIN(ROW_SIZE, byte_count);
|
||||
unsigned int len = MIN(ROW_SIZE, byte_count);
|
||||
|
||||
LOG_DEBUG("Writing load command for array %u row %u at " TARGET_ADDR_FMT,
|
||||
array_id, row, data_area->address);
|
||||
|
@ -1307,8 +1307,8 @@ static int psoc5lp_protect_check(struct flash_bank *bank)
|
|||
{
|
||||
struct psoc5lp_flash_bank *psoc_bank = bank->driver_priv;
|
||||
uint8_t row_data[ROW_SIZE];
|
||||
const unsigned protection_bytes_per_sector = ROWS_PER_SECTOR * 2 / 8;
|
||||
unsigned i, k, num_sectors;
|
||||
const unsigned int protection_bytes_per_sector = ROWS_PER_SECTOR * 2 / 8;
|
||||
unsigned int i, k, num_sectors;
|
||||
int retval;
|
||||
|
||||
if (bank->target->state != TARGET_HALTED) {
|
||||
|
|
|
@ -859,7 +859,7 @@ static int sim3x_flash_info(struct flash_bank *bank, struct command_invocation *
|
|||
* reg 3:2 - register
|
||||
* reg 1:0 - no effect
|
||||
*/
|
||||
static int ap_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value)
|
||||
static int ap_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
|
||||
{
|
||||
LOG_DEBUG("DAP_REG[0x%02x] <- %08" PRIX32, reg, value);
|
||||
|
||||
|
@ -886,7 +886,7 @@ static int ap_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int ap_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result)
|
||||
static int ap_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
|
||||
{
|
||||
struct adiv5_ap *ap = dap_get_ap(dap, SIM3X_AP);
|
||||
if (!ap) {
|
||||
|
@ -912,7 +912,7 @@ static int ap_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *resul
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int ap_poll_register(struct adiv5_dap *dap, unsigned reg, uint32_t mask, uint32_t value, int timeout)
|
||||
static int ap_poll_register(struct adiv5_dap *dap, unsigned int reg, uint32_t mask, uint32_t value, int timeout)
|
||||
{
|
||||
uint32_t val;
|
||||
int retval;
|
||||
|
|
|
@ -530,7 +530,7 @@ static void stellaris_set_flash_timing(struct flash_bank *bank)
|
|||
target_write_u32(target, SCB_BASE | USECRL, usecrl);
|
||||
}
|
||||
|
||||
static const unsigned rcc_xtal[32] = {
|
||||
static const unsigned int rcc_xtal[32] = {
|
||||
[0x00] = 1000000, /* no pll */
|
||||
[0x01] = 1843200, /* no pll */
|
||||
[0x02] = 2000000, /* no pll */
|
||||
|
@ -569,7 +569,7 @@ static void stellaris_read_clock_info(struct flash_bank *bank)
|
|||
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
|
||||
struct target *target = bank->target;
|
||||
uint32_t rcc, rcc2, pllcfg, sysdiv, usesysdiv, bypass, oscsrc;
|
||||
unsigned xtal;
|
||||
unsigned int xtal;
|
||||
unsigned long mainfreq;
|
||||
|
||||
target_read_u32(target, SCB_BASE | RCC, &rcc);
|
||||
|
@ -1029,7 +1029,7 @@ static int stellaris_write_block(struct flash_bank *bank,
|
|||
int retval = ERROR_OK;
|
||||
|
||||
/* power of two, and multiple of word size */
|
||||
static const unsigned buf_min = 128;
|
||||
static const unsigned int buf_min = 128;
|
||||
|
||||
/* for small buffers it's faster not to download an algorithm */
|
||||
if (wcount * 4 < buf_min)
|
||||
|
|
|
@ -36,7 +36,7 @@ COMMAND_HELPER(flash_command_get_bank_probe_optional, unsigned int name_index,
|
|||
if (*bank)
|
||||
return ERROR_OK;
|
||||
|
||||
unsigned bank_num;
|
||||
unsigned int bank_num;
|
||||
COMMAND_PARSE_NUMBER(uint, name, bank_num);
|
||||
|
||||
if (do_probe) {
|
||||
|
@ -48,7 +48,7 @@ COMMAND_HELPER(flash_command_get_bank_probe_optional, unsigned int name_index,
|
|||
}
|
||||
}
|
||||
|
||||
COMMAND_HELPER(flash_command_get_bank, unsigned name_index,
|
||||
COMMAND_HELPER(flash_command_get_bank, unsigned int name_index,
|
||||
struct flash_bank **bank)
|
||||
{
|
||||
return CALL_COMMAND_HANDLER(flash_command_get_bank_probe_optional,
|
||||
|
@ -518,7 +518,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
|
|||
uint64_t pattern;
|
||||
uint32_t count;
|
||||
struct target *target = get_current_target(CMD_CTX);
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
uint32_t wordsize;
|
||||
int retval;
|
||||
|
||||
|
@ -1316,7 +1316,7 @@ COMMAND_HANDLER(handle_flash_banks_command)
|
|||
if (CMD_ARGC != 0)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
unsigned n = 0;
|
||||
unsigned int n = 0;
|
||||
for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++) {
|
||||
command_print(CMD, "#%d : %s (%s) at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32 ", "
|
||||
"buswidth %u, chipwidth %u", p->bank_number,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* ---------------------------------------------------------------------- */
|
||||
|
||||
struct tms470_flash_bank {
|
||||
unsigned ordinal;
|
||||
unsigned int ordinal;
|
||||
|
||||
/* device identification register */
|
||||
uint32_t device_ident_reg;
|
||||
|
@ -391,7 +391,7 @@ static int tms470_try_flash_keys(struct target *target, const uint32_t *key_set)
|
|||
/* only perform the key match when 3VSTAT is clear */
|
||||
target_read_u32(target, 0xFFE8BC0C, &fmmstat);
|
||||
if (!(fmmstat & 0x08)) {
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
uint32_t fmbptr, fmbac2, orig_fmregopt;
|
||||
|
||||
target_write_u32(target, 0xFFE8BC04, fmmstat & ~0x07);
|
||||
|
@ -455,7 +455,7 @@ static int tms470_unlock_flash(struct flash_bank *bank)
|
|||
{
|
||||
struct target *target = bank->target;
|
||||
const uint32_t *p_key_sets[5];
|
||||
unsigned i, key_set_count;
|
||||
unsigned int i, key_set_count;
|
||||
|
||||
if (keys_set) {
|
||||
key_set_count = 5;
|
||||
|
|
|
@ -84,7 +84,7 @@ static int xmc1xxx_erase(struct flash_bank *bank, unsigned int first,
|
|||
struct working_area *workarea;
|
||||
struct reg_param reg_params[3];
|
||||
struct armv7m_algorithm armv7m_algo;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int retval;
|
||||
const uint8_t erase_code[] = {
|
||||
#include "../../../contrib/loaders/flash/xmc1xxx/erase.inc"
|
||||
|
@ -159,7 +159,7 @@ static int xmc1xxx_erase_check(struct flash_bank *bank)
|
|||
struct reg_param reg_params[3];
|
||||
struct armv7m_algorithm armv7m_algo;
|
||||
uint16_t val;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int retval;
|
||||
const uint8_t erase_check_code[] = {
|
||||
#include "../../../contrib/loaders/flash/xmc1xxx/erase_check.inc"
|
||||
|
@ -245,7 +245,7 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
|
|||
struct reg_param reg_params[4];
|
||||
struct armv7m_algorithm armv7m_algo;
|
||||
uint32_t block_count = DIV_ROUND_UP(byte_count, NVM_BLOCK_SIZE);
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int retval;
|
||||
const uint8_t write_code[] = {
|
||||
#include "../../../contrib/loaders/flash/xmc1xxx/write.inc"
|
||||
|
|
Loading…
Reference in New Issue