summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-31 09:37:35 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-31 09:37:35 +0000
commitb6db182c0020051e0dc642ca0b1040ea7453dcd0 (patch)
tree17a4074984d6f72033f252e2e3361fd90cc8b96e /src/flash
parent678519311834fd7a1126f8d217c734d4f5ffbb3d (diff)
downloadopenocd_libswd-b6db182c0020051e0dc642ca0b1040ea7453dcd0.tar.gz
openocd_libswd-b6db182c0020051e0dc642ca0b1040ea7453dcd0.tar.bz2
openocd_libswd-b6db182c0020051e0dc642ca0b1040ea7453dcd0.tar.xz
openocd_libswd-b6db182c0020051e0dc642ca0b1040ea7453dcd0.zip
Add target_read_memory wrapper:
- replaces all calls to target->type->read_memory. - add documentation in target_s to warn not to invoke callback directly. git-svn-id: svn://svn.berlios.de/openocd/trunk@1959 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/at91sam7.c2
-rw-r--r--src/flash/cfi.c18
-rw-r--r--src/flash/flash.c2
-rw-r--r--src/flash/lpc3180_nand_controller.c4
-rw-r--r--src/flash/mflash.c6
5 files changed, 16 insertions, 16 deletions
diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c
index fb87aa3b..186aa066 100644
--- a/src/flash/at91sam7.c
+++ b/src/flash/at91sam7.c
@@ -665,7 +665,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
for (nSector=0; nSector<bank->num_sectors; nSector++)
{
bank->sectors[nSector].is_erased = 1;
- retval = target->type->read_memory(target, bank->base+bank->sectors[nSector].offset, 4,
+ retval = target_read_memory(target, bank->base+bank->sectors[nSector].offset, 4,
bank->sectors[nSector].size/4, buffer);
if (retval != ERROR_OK)
return retval;
diff --git a/src/flash/cfi.c b/src/flash/cfi.c
index 6e8b96e5..999b0a73 100644
--- a/src/flash/cfi.c
+++ b/src/flash/cfi.c
@@ -166,7 +166,7 @@ static u8 cfi_query_u8(flash_bank_t *bank, int sector, u32 offset)
target_t *target = bank->target;
u8 data[CFI_MAX_BUS_WIDTH];
- target->type->read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 1, data);
+ target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 1, data);
if (bank->target->endianness == TARGET_LITTLE_ENDIAN)
return data[0];
@@ -184,7 +184,7 @@ static u8 cfi_get_u8(flash_bank_t *bank, int sector, u32 offset)
u8 data[CFI_MAX_BUS_WIDTH];
int i;
- target->type->read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 1, data);
+ target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 1, data);
if (bank->target->endianness == TARGET_LITTLE_ENDIAN)
{
@@ -213,11 +213,11 @@ static u16 cfi_query_u16(flash_bank_t *bank, int sector, u32 offset)
{
u8 i;
for(i=0;i<2;i++)
- target->type->read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1,
+ target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1,
&data[i*bank->bus_width] );
}
else
- target->type->read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 2, data);
+ target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 2, data);
if (bank->target->endianness == TARGET_LITTLE_ENDIAN)
return data[0] | data[bank->bus_width] << 8;
@@ -235,11 +235,11 @@ static u32 cfi_query_u32(flash_bank_t *bank, int sector, u32 offset)
{
u8 i;
for(i=0;i<4;i++)
- target->type->read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1,
+ target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1,
&data[i*bank->bus_width] );
}
else
- target->type->read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 4, data);
+ target_read_memory(target, flash_address(bank, sector, offset), bank->bus_width, 4, data);
if (bank->target->endianness == TARGET_LITTLE_ENDIAN)
return data[0] | data[bank->bus_width] << 8 | data[bank->bus_width * 2] << 16 | data[bank->bus_width * 3] << 24;
@@ -1889,7 +1889,7 @@ int cfi_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
for (i = 0; i < align; ++i, ++copy_p)
{
u8 byte;
- if((retval = target->type->read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
+ if((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
{
return retval;
}
@@ -1908,7 +1908,7 @@ int cfi_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
for (; (count == 0) && (i < bank->bus_width); ++i, ++copy_p)
{
u8 byte;
- if((retval = target->type->read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
+ if((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
{
return retval;
}
@@ -2039,7 +2039,7 @@ int cfi_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
for (; i < bank->bus_width; ++i, ++copy_p)
{
u8 byte;
- if((retval = target->type->read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
+ if((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
{
return retval;
}
diff --git a/src/flash/flash.c b/src/flash/flash.c
index 9beec5a1..ce920050 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -1157,7 +1157,7 @@ int default_flash_mem_blank_check(struct flash_bank_s *bank)
chunk = (j - bank->sectors[i].size);
}
- retval = target->type->read_memory(target, bank->base + bank->sectors[i].offset + j, 4, chunk/4, buffer);
+ retval = target_read_memory(target, bank->base + bank->sectors[i].offset + j, 4, chunk/4, buffer);
if (retval != ERROR_OK)
return retval;
diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c
index 1cbd9204..a074acca 100644
--- a/src/flash/lpc3180_nand_controller.c
+++ b/src/flash/lpc3180_nand_controller.c
@@ -759,12 +759,12 @@ static int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u
if (data)
{
- target->type->read_memory(target, 0x200a8000, 4, 128, page_buffer + page_bytes_done);
+ target_read_memory(target, 0x200a8000, 4, 128, page_buffer + page_bytes_done);
}
if (oob)
{
- target->type->read_memory(target, 0x200a8000, 4, 4, oob_buffer + oob_bytes_done);
+ target_read_memory(target, 0x200a8000, 4, 4, oob_buffer + oob_bytes_done);
}
page_bytes_done += 512;
diff --git a/src/flash/mflash.c b/src/flash/mflash.c
index 47c73382..cc1d1ee2 100644
--- a/src/flash/mflash.c
+++ b/src/flash/mflash.c
@@ -345,7 +345,7 @@ static int mg_dsk_drv_info(void)
if (! mflash_bank->drv_info)
mflash_bank->drv_info = malloc(sizeof(mg_drv_info_t));
- target->type->read_memory(target, mg_buff, 2, sizeof(mg_io_type_drv_info) >> 1,
+ target_read_memory(target, mg_buff, 2, sizeof(mg_io_type_drv_info) >> 1,
(u8 *)&mflash_bank->drv_info->drv_id);
mflash_bank->drv_info->tot_sects = (u32)(mflash_bank->drv_info->drv_id.total_user_addressable_sectors_hi << 16)
@@ -428,7 +428,7 @@ static int mg_mflash_do_read_sects(void *buff, u32 sect_num, u32 sect_cnt)
for (i = 0; i < sect_cnt; i++) {
mg_dsk_wait(mg_io_wait_drq, MG_OEM_DISK_WAIT_TIME_NORMAL);
- target->type->read_memory(target, address, 2, MG_MFLASH_SECTOR_SIZE / 2, buff_ptr);
+ target_read_memory(target, address, 2, MG_MFLASH_SECTOR_SIZE / 2, buff_ptr);
buff_ptr += MG_MFLASH_SECTOR_SIZE;
target_write_u8(target, mflash_bank->base + MG_REG_OFFSET + MG_REG_COMMAND, mg_io_cmd_confirm_read);
@@ -932,7 +932,7 @@ static int mg_verify_interface(void)
memset(buff, 0xff, MG_MFLASH_SECTOR_SIZE);
- target->type->read_memory(target, address, 2,
+ target_read_memory(target, address, 2,
MG_MFLASH_SECTOR_SIZE / 2, (u8 *)buff);
for (i = 0; i < MG_MFLASH_SECTOR_SIZE >> 1; i++) {