#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <inttypes.h>
return mflash_bank->gpio_drv->set_gpio_output_val(mflash_bank->rst_pin, level);
}
-static int mg_dump_task_reg (void)
-{
- target_t *target = mflash_bank->target;
- u32 address = mflash_bank->base + MG_REG_OFFSET + MG_REG_ERROR;
- u8 value, i;
- char *reg_name[9] = {
- "error ",
- "sector count ",
- "sector num (LBA 7- 0) ",
- "cyl. low (LBA 15- 8) ",
- "cyl. high (LBA 23-16) ",
- "drv/head ",
- "status ",
- "dev control ",
- "burst control "
- };
-
- for (i = 0; i < 9; i++) {
- target_read_u8(target, address + i * 2, &value);
- LOG_INFO("%s : 0x%2.2x", reg_name[i], value);
- }
-
- return ERROR_OK;
-
-}
static int mflash_init_gpio (void)
{
mflash_gpio_drv_t *gpio_drv = mflash_bank->gpio_drv;
residue = sect_cnt % 256;
for (i = 0; i < quotient; i++) {
- LOG_DEBUG("sect num : %u buff : 0x%8.8x", sect_num, (u32)buff_ptr);
+ LOG_DEBUG("sect num : %u buff : 0x%0lx", sect_num,
+ (unsigned long)buff_ptr);
mg_mflash_do_read_sects(buff_ptr, sect_num, 256);
sect_num += 256;
buff_ptr += 256 * MG_MFLASH_SECTOR_SIZE;
}
if (residue) {
- LOG_DEBUG("sect num : %u buff : %8.8x", sect_num, (u32)buff_ptr);
+ LOG_DEBUG("sect num : %u buff : %0lx", sect_num,
+ (unsigned long)buff_ptr);
mg_mflash_do_read_sects(buff_ptr, sect_num, residue);
}
residue = sect_cnt % 256;
for (i = 0; i < quotient; i++) {
- LOG_DEBUG("sect num : %u buff : %8.8x", sect_num, (u32)buff_ptr);
+ LOG_DEBUG("sect num : %u buff : %0lx", sect_num,
+ (unsigned long)buff_ptr);
mg_mflash_do_write_sects(buff_ptr, sect_num, 256);
sect_num += 256;
buff_ptr += 256 * MG_MFLASH_SECTOR_SIZE;
}
if (residue) {
- LOG_DEBUG("sect num : %u buff : %8.8x", sect_num, (u32)buff_ptr);
+ LOG_DEBUG("sect num : %u buff : %0lx", sect_num,
+ (unsigned long)buff_ptr);
mg_mflash_do_write_sects(buff_ptr, sect_num, residue);
}