diff options
author | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-03-26 21:47:26 +0000 |
---|---|---|
committer | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-03-26 21:47:26 +0000 |
commit | 5ed126c4f90948fbf53d186dc4ef49018fb5ecfc (patch) | |
tree | 40a1444d10e0413a202440b595b3a707df22a513 /src/flash | |
parent | 9b13ffe4e2edc1eabdf52c2d117396b1b21de968 (diff) | |
download | riscv-openocd-5ed126c4f90948fbf53d186dc4ef49018fb5ecfc.zip riscv-openocd-5ed126c4f90948fbf53d186dc4ef49018fb5ecfc.tar.gz riscv-openocd-5ed126c4f90948fbf53d186dc4ef49018fb5ecfc.tar.bz2 |
- fixed arm926 cp15 command bug (thanks to Vincent Palatin for this patch)
- fixed compiler warnings throughout the code (thanks to Vincent Palatin for this patch)
- added support for accessing ETB (embedded trace buffer) registers
git-svn-id: svn://svn.berlios.de/openocd/trunk@134 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/at91sam7.c | 15 | ||||
-rw-r--r-- | src/flash/cfi.c | 11 | ||||
-rw-r--r-- | src/flash/nand.c | 4 | ||||
-rw-r--r-- | src/flash/nand.h | 4 |
4 files changed, 12 insertions, 22 deletions
diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index dc9c2d7..6d96c87 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -146,7 +146,7 @@ void at91sam7_read_clock_info(flash_bank_t *bank) at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv; target_t *target = at91sam7_info->target; u32 mckr, mcfr, pllr; - unsigned long tmp, mainfreq; + unsigned long tmp = 0, mainfreq; /* Read main clock freqency register */ target_read_u32(target, CKGR_MCFR, &mcfr); @@ -276,7 +276,7 @@ int at91sam7_flash_command(struct flash_bank_s *bank,u8 cmd,u16 pagen) fcr = (0x5A<<24) | (pagen<<8) | cmd; target_write_u32(target, MC_FCR, fcr); - DEBUG("Flash command: 0x%x, pagenumber:", fcr, pagen); + DEBUG("Flash command: 0x%x, pagenumber:%u", fcr, pagen); if ((at91sam7_info->cidr_arch == 0x60)&&((cmd==SLB)|(cmd==CLB))) { @@ -328,7 +328,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank) bank->size = NVPSIZ[at91sam7_info->cidr_nvpsiz]; at91sam7_info->target_name = "Unknown"; - DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x, alt_id: 0x%4.4x, alt_addr: 0x%4.4x", at91sam7_info->cidr_nvptyp, at91sam7_info->cidr_arch ); + DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_info->cidr_nvptyp, at91sam7_info->cidr_arch ); /* Read main and master clock freqency register */ at91sam7_read_clock_info(bank); @@ -491,8 +491,6 @@ int at91sam7_read_part_info(struct flash_bank_s *bank) int at91sam7_erase_check(struct flash_bank_s *bank) { at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv; - target_t *target = at91sam7_info->target; - int i; if (!at91sam7_info->working_area_size) { @@ -509,7 +507,6 @@ int at91sam7_protect_check(struct flash_bank_s *bank) u32 status; at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv; - target_t *target = at91sam7_info->target; if (at91sam7_info->cidr == 0) { @@ -544,7 +541,7 @@ int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, ch at91sam7_info->target = get_target_by_num(strtoul(args[5], NULL, 0)); if (!at91sam7_info->target) { - ERROR("no target '%i' configured", args[5]); + ERROR("no target '%s' configured", args[5]); exit(-1); } @@ -598,7 +595,6 @@ int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last) int lockregion; at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv; - target_t *target = at91sam7_info->target; if (at91sam7_info->target->state != TARGET_HALTED) { @@ -651,7 +647,6 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) target_t *target = at91sam7_info->target; u32 dst_min_alignment, wcount, bytes_remaining = count; u32 first_page, last_page, pagen, buffer_pos; - u32 fcr; if (at91sam7_info->target->state != TARGET_HALTED) { @@ -712,7 +707,7 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) { return ERROR_FLASH_OPERATION_FAILED; } - DEBUG("Flash command: 0x%x, pagenumber:", fcr, pagen); + DEBUG("Write page number:%i", pagen); } return ERROR_OK; diff --git a/src/flash/cfi.c b/src/flash/cfi.c index 7f2313d..b8b7eb5 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -329,7 +329,7 @@ int cfi_intel_info(struct flash_bank_s *bank, char *buf, int buf_size) int cfi_register_commands(struct command_context_s *cmd_ctx) { - command_t *cfi_cmd = register_command(cmd_ctx, NULL, "cfi", NULL, COMMAND_ANY, NULL); + /*command_t *cfi_cmd = */register_command(cmd_ctx, NULL, "cfi", NULL, COMMAND_ANY, NULL); /* register_command(cmd_ctx, cfi_cmd, "part_id", cfi_handle_part_id_command, COMMAND_EXEC, "print part id of cfi flash bank <num>"); @@ -362,7 +362,7 @@ int cfi_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char ** cfi_info->target = get_target_by_num(strtoul(args[5], NULL, 0)); if (!cfi_info->target) { - ERROR("no target '%i' configured", args[5]); + ERROR("no target '%s' configured", args[5]); exit(-1); } @@ -377,7 +377,6 @@ int cfi_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char ** int cfi_intel_erase(struct flash_bank_s *bank, int first, int last) { cfi_flash_bank_t *cfi_info = bank->driver_priv; - cfi_intel_pri_ext_t *pri_ext = cfi_info->pri_ext; target_t *target = cfi_info->target; u8 command[8]; int i; @@ -593,7 +592,6 @@ void cfi_add_byte(struct flash_bank_s *bank, u8 *word, u8 byte) int cfi_intel_write_block(struct flash_bank_s *bank, u8 *buffer, u32 address, u32 count) { cfi_flash_bank_t *cfi_info = bank->driver_priv; - cfi_intel_pri_ext_t *pri_ext = cfi_info->pri_ext; target_t *target = cfi_info->target; reg_param_t reg_params[7]; armv4_5_algorithm_t armv4_5_info; @@ -602,7 +600,6 @@ int cfi_intel_write_block(struct flash_bank_s *bank, u8 *buffer, u32 address, u3 u8 write_command[CFI_MAX_BUS_WIDTH]; u8 busy_pattern[CFI_MAX_BUS_WIDTH]; u8 error_pattern[CFI_MAX_BUS_WIDTH]; - int i; int retval; /* algorithm register usage: @@ -774,7 +771,6 @@ int cfi_intel_write_block(struct flash_bank_s *bank, u8 *buffer, u32 address, u3 int cfi_intel_write_word(struct flash_bank_s *bank, u8 *word, u32 address) { cfi_flash_bank_t *cfi_info = bank->driver_priv; - cfi_intel_pri_ext_t *pri_ext = cfi_info->pri_ext; target_t *target = cfi_info->target; u8 command[8]; @@ -799,7 +795,6 @@ int cfi_intel_write_word(struct flash_bank_s *bank, u8 *word, u32 address) int cfi_write_word(struct flash_bank_s *bank, u8 *word, u32 address) { cfi_flash_bank_t *cfi_info = bank->driver_priv; - target_t *target = cfi_info->target; switch(cfi_info->pri_id) { @@ -885,6 +880,7 @@ int cfi_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) break; default: ERROR("cfi primary command set %i unsupported", cfi_info->pri_id); + retval = ERROR_FLASH_OPERATION_FAILED; break; } if (retval != ERROR_OK) @@ -1216,7 +1212,6 @@ int cfi_intel_protect_check(struct flash_bank_s *bank) int cfi_protect_check(struct flash_bank_s *bank) { cfi_flash_bank_t *cfi_info = bank->driver_priv; - target_t *target = cfi_info->target; if (cfi_info->qry[0] != 'Q') return ERROR_FLASH_BANK_NOT_PROBED; diff --git a/src/flash/nand.c b/src/flash/nand.c index 221d2a4..e0dfa22 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -368,7 +368,6 @@ int nand_read_status(struct nand_device_s *device, u8 *status) int nand_probe(struct nand_device_s *device) { u8 manufacturer_id, device_id; - nand_manufacturer_t *manufacturer; int retval; int i; @@ -419,8 +418,6 @@ int nand_probe(struct nand_device_s *device) device_id = data_buf & 0xff; } - device->manufacturer = manufacturer; - for (i = 0; nand_flash_ids[i].name; i++) { if (nand_flash_ids[i].id == device_id) @@ -1139,7 +1136,6 @@ int handle_nand_check_bad_blocks_command(struct command_context_s *cmd_ctx, char int handle_nand_copy_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { nand_device_t *p; - int retval; if (argc != 4) { diff --git a/src/flash/nand.h b/src/flash/nand.h index 65f1589..7161c50 100644 --- a/src/flash/nand.h +++ b/src/flash/nand.h @@ -196,6 +196,10 @@ enum oob_formats extern nand_device_t *get_nand_device_by_num(int num); extern int nand_read_page_raw(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size); extern int nand_write_page_raw(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size); +extern int nand_read_status(struct nand_device_s *device, u8 *status); + +extern int nand_register_commands(struct command_context_s *cmd_ctx); +extern int nand_init(struct command_context_s *cmd_ctx); #define ERROR_NAND_DEVICE_INVALID (-1100) #define ERROR_NAND_OPERATION_FAILED (-1101) |