aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/at91sam4.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/flash/nor/at91sam4.c')
-rw-r--r--src/flash/nor/at91sam4.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/flash/nor/at91sam4.c b/src/flash/nor/at91sam4.c
index 6212753..26a8037 100644
--- a/src/flash/nor/at91sam4.c
+++ b/src/flash/nor/at91sam4.c
@@ -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;
@@ -1501,7 +1501,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:
@@ -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" },
@@ -2374,8 +2374,8 @@ static int sam4_read_this_reg(struct sam4_chip *chip, uint32_t *goes_here)
r = target_read_u32(chip->target, reg->address, goes_here);
if (r != ERROR_OK) {
- LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08x, Err: %d",
- reg->name, (unsigned)(reg->address), r);
+ LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08" PRIx32 ", Err: %d",
+ reg->name, reg->address, r);
}
return r;
}
@@ -2390,8 +2390,8 @@ static int sam4_read_all_regs(struct sam4_chip *chip)
r = sam4_read_this_reg(chip,
sam4_get_reg_ptr(&(chip->cfg), reg));
if (r != ERROR_OK) {
- LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08x, Error: %d",
- reg->name, ((unsigned)(reg->address)), r);
+ LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08" PRIx32 ", Error: %d",
+ reg->name, reg->address, r);
return r;
}
reg++;
@@ -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;