aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/at91sam3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/flash/nor/at91sam3.c')
-rw-r--r--src/flash/nor/at91sam3.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/flash/nor/at91sam3.c b/src/flash/nor/at91sam3.c
index b1cb8f1..b86a18d 100644
--- a/src/flash/nor/at91sam3.c
+++ b/src/flash/nor/at91sam3.c
@@ -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;
@@ -2051,7 +2051,7 @@ do_retry:
case AT91C_EFC_FCMD_CLB:
n = (private->size_bytes / private->page_size);
if (argument >= n)
- LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n));
+ LOG_ERROR("*BUG*: Embedded flash has only %" PRIu32 " pages", n);
break;
case AT91C_EFC_FCMD_SFB:
@@ -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" },
@@ -2867,8 +2867,8 @@ static int sam3_read_this_reg(struct sam3_chip *chip, uint32_t *goes_here)
r = target_read_u32(chip->target, reg->address, goes_here);
if (r != ERROR_OK) {
- LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Err: %d",
- reg->name, (unsigned)(reg->address), r);
+ LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08" PRIx32 ", Err: %d",
+ reg->name, reg->address, r);
}
return r;
}
@@ -2883,8 +2883,8 @@ static int sam3_read_all_regs(struct sam3_chip *chip)
r = sam3_read_this_reg(chip,
sam3_get_reg_ptr(&(chip->cfg), reg));
if (r != ERROR_OK) {
- LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Error: %d",
- reg->name, ((unsigned)(reg->address)), r);
+ LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08" PRIx32 ", Error: %d",
+ reg->name, reg->address, r);
return r;
}
reg++;
@@ -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;