Commit d47e1b8f authored by ntfreak's avatar ntfreak
Browse files

- rename log functions to stop conflicts under win32 (wingdi)

git-svn-id: svn://svn.berlios.de/openocd/trunk@523 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent a96f96d1
......@@ -243,7 +243,7 @@ void at91sam7_set_flash_mode(flash_bank_t *bank, u8 flashplane, int mode)
if (at91sam7_info->mck_freq > 30000000ul)
fws = 1;
DEBUG("fmcn[%i]: %i", flashplane, fmcn);
LOG_DEBUG("fmcn[%i]: %i", flashplane, fmcn);
fmr = fmcn << 16 | fws << 8;
target_write_u32(target, MC_FMR[flashplane], fmr);
}
......@@ -257,21 +257,21 @@ u32 at91sam7_wait_status_busy(flash_bank_t *bank, u8 flashplane, u32 waitbits, i
while ((!((status = at91sam7_get_flash_status(bank,flashplane)) & waitbits)) && (timeout-- > 0))
{
DEBUG("status[%i]: 0x%x", flashplane, status);
LOG_DEBUG("status[%i]: 0x%x", flashplane, status);
usleep(1000);
}
DEBUG("status[%i]: 0x%x", flashplane, status);
LOG_DEBUG("status[%i]: 0x%x", flashplane, status);
if (status & 0x0C)
{
ERROR("status register: 0x%x", status);
LOG_ERROR("status register: 0x%x", status);
if (status & 0x4)
ERROR("Lock Error Bit Detected, Operation Abort");
LOG_ERROR("Lock Error Bit Detected, Operation Abort");
if (status & 0x8)
ERROR("Invalid command and/or bad keyword, Operation Abort");
LOG_ERROR("Invalid command and/or bad keyword, Operation Abort");
if (status & 0x10)
ERROR("Security Bit Set, Operation Abort");
LOG_ERROR("Security Bit Set, Operation Abort");
}
return status;
......@@ -287,7 +287,7 @@ int at91sam7_flash_command(struct flash_bank_s *bank, u8 flashplane, u8 cmd, u16
fcr = (0x5A<<24) | ((pagen&0x3FF)<<8) | cmd;
target_write_u32(target, MC_FCR[flashplane], fcr);
DEBUG("Flash command: 0x%x, flashplane: %i, pagenumber:%u", fcr, flashplane, pagen);
LOG_DEBUG("Flash command: 0x%x, flashplane: %i, pagenumber:%u", fcr, flashplane, pagen);
if ((at91sam7_info->cidr_arch == 0x60)&&((cmd==SLB)|(cmd==CLB)))
{
......@@ -322,7 +322,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
if (cidr == 0)
{
WARNING("Cannot identify target as an AT91SAM");
LOG_WARNING("Cannot identify target as an AT91SAM");
return ERROR_FLASH_OPERATION_FAILED;
}
......@@ -363,7 +363,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_info->cidr_nvptyp, at91sam7_info->cidr_arch );
LOG_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);
......@@ -384,7 +384,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
at91sam7_info->target_name = "AT91SAM7S512";
at91sam7_info->num_planes = 2;
if (at91sam7_info->num_planes != bank->num_sectors)
WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
at91sam7_info->num_lockbits = 2*16;
at91sam7_info->pagesize = 256;
at91sam7_info->pages_in_lockregion = 64;
......@@ -437,7 +437,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
at91sam7_info->target_name = "AT91SAM7XC512";
at91sam7_info->num_planes = 2;
if (at91sam7_info->num_planes != bank->num_sectors)
WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
at91sam7_info->num_lockbits = 2*16;
at91sam7_info->pagesize = 256;
at91sam7_info->pages_in_lockregion = 64;
......@@ -474,7 +474,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
at91sam7_info->target_name = "AT91SAM7SE512";
at91sam7_info->num_planes = 2;
if (at91sam7_info->num_planes != bank->num_sectors)
WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
at91sam7_info->num_lockbits = 32;
at91sam7_info->pagesize = 256;
at91sam7_info->pages_in_lockregion = 64;
......@@ -511,12 +511,12 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
at91sam7_info->target_name = "AT91SAM7X512";
at91sam7_info->num_planes = 2;
if (at91sam7_info->num_planes != bank->num_sectors)
WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
at91sam7_info->num_lockbits = 32;
at91sam7_info->pagesize = 256;
at91sam7_info->pages_in_lockregion = 64;
at91sam7_info->num_pages = 2*16*64;
DEBUG("Support for AT91SAM7X512 is experimental in this version!");
LOG_DEBUG("Support for AT91SAM7X512 is experimental in this version!");
}
if (bank->size==0x40000) /* AT91SAM7X256 */
{
......@@ -556,7 +556,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
return ERROR_OK;
}
WARNING("at91sam7 flash only tested for AT91SAM7Sxx series");
LOG_WARNING("at91sam7 flash only tested for AT91SAM7Sxx series");
return ERROR_OK;
}
......@@ -609,7 +609,7 @@ int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, ch
if (argc < 6)
{
WARNING("incomplete flash_bank at91sam7 configuration");
LOG_WARNING("incomplete flash_bank at91sam7 configuration");
return ERROR_FLASH_BANK_INVALID;
}
......@@ -643,7 +643,7 @@ int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
{
if ((first == 0) && (last == (at91sam7_info->num_lockbits-1)))
{
WARNING("Sector numbers based on lockbit count, probably a deprecated script");
LOG_WARNING("Sector numbers based on lockbit count, probably a deprecated script");
last = bank->num_sectors-1;
}
else return ERROR_FLASH_SECTOR_INVALID;
......@@ -738,7 +738,7 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
if (offset % dst_min_alignment)
{
WARNING("offset 0x%x breaks required alignment 0x%x", offset, dst_min_alignment);
LOG_WARNING("offset 0x%x breaks required alignment 0x%x", offset, dst_min_alignment);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
......@@ -748,7 +748,7 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
first_page = offset/dst_min_alignment;
last_page = CEIL(offset + count, dst_min_alignment);
DEBUG("first_page: %i, last_page: %i, count %i", first_page, last_page, count);
LOG_DEBUG("first_page: %i, last_page: %i, count %i", first_page, last_page, count);
at91sam7_read_clock_info(bank);
......@@ -773,7 +773,7 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
{
return ERROR_FLASH_OPERATION_FAILED;
}
DEBUG("Write flash plane:%i page number:%i", flashplane, pagen);
LOG_DEBUG("Write flash plane:%i page number:%i", flashplane, pagen);
}
return ERROR_OK;
......@@ -914,7 +914,7 @@ int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd,
if (bank->target->state != TARGET_HALTED)
{
ERROR("target has to be halted to perform flash operation");
LOG_ERROR("target has to be halted to perform flash operation");
return ERROR_TARGET_NOT_HALTED;
}
......@@ -942,7 +942,7 @@ int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd,
}
status = at91sam7_get_flash_status(bank, 0);
DEBUG("at91sam7_handle_gpnvm_command: cmd 0x%x, value 0x%x, status 0x%x \n",flashcmd,bit,status);
LOG_DEBUG("at91sam7_handle_gpnvm_command: cmd 0x%x, value 0x%x, status 0x%x \n",flashcmd,bit,status);
at91sam7_info->nvmbits = (status>>8)&((1<<at91sam7_info->num_nvmbits)-1);
return ERROR_OK;
......
This diff is collapsed.
......@@ -147,14 +147,14 @@ int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, c
if (argc < 7)
{
WARNING("incomplete flash_bank ecosflash configuration");
LOG_WARNING("incomplete flash_bank ecosflash configuration");
return ERROR_FLASH_BANK_INVALID;
}
info = malloc(sizeof(ecosflash_flash_bank_t));
if(info == NULL)
{
ERROR("no memory for flash bank info");
LOG_ERROR("no memory for flash bank info");
exit(-1);
}
bank->driver_priv = info;
......@@ -180,7 +180,7 @@ int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, c
info->target = get_target_by_num(strtoul(args[5], NULL, 0));
if (info->target == NULL)
{
ERROR("no target '%i' configured", (int)strtoul(args[5], NULL, 0));
LOG_ERROR("no target '%i' configured", (int)strtoul(args[5], NULL, 0));
exit(-1);
}
return ERROR_OK;
......@@ -212,14 +212,14 @@ int loadDriver(ecosflash_flash_bank_t *info)
int retval;
if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK)
{
ERROR("image_read_section failed with error code: %i", retval);
LOG_ERROR("image_read_section failed with error code: %i", retval);
free(buffer);
image_close(&image);
return ERROR_FLASH_BANK_INVALID;
}
target_write_buffer(target, image.sections[i].base_address, buf_cnt, buffer);
image_size += buf_cnt;
DEBUG("%u byte written at address 0x%8.8x", buf_cnt, image.sections[i].base_address);
LOG_DEBUG("%u byte written at address 0x%8.8x", buf_cnt, image.sections[i].base_address);
free(buffer);
}
......@@ -266,7 +266,7 @@ int runCode(ecosflash_flash_bank_t *info,
codeStop, timeout,
&armv4_5_info)) != ERROR_OK)
{
ERROR("error executing eCos flash algorithm");
LOG_ERROR("error executing eCos flash algorithm");
return retval;
}
......@@ -303,7 +303,7 @@ int eCosBoard_erase(ecosflash_flash_bank_t *info, u32 address, u32 len)
if (flashErr != 0x0)
{
ERROR("Flash erase failed with %d (%s)\n", flashErr, flash_errmsg(flashErr));
LOG_ERROR("Flash erase failed with %d (%s)\n", flashErr, flash_errmsg(flashErr));
return ERROR_JTAG_DEVICE_ERROR;
}
......@@ -362,7 +362,7 @@ int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, u32 address, u32 l
if (flashErr != 0x0)
{
ERROR("Flash prog failed with %d (%s)\n", flashErr, flash_errmsg(flashErr));
LOG_ERROR("Flash prog failed with %d (%s)\n", flashErr, flash_errmsg(flashErr));
return ERROR_JTAG_DEVICE_ERROR;
}
}
......
......@@ -93,7 +93,7 @@ static int flash_driver_write(struct flash_bank_s *bank, u8 *buffer, u32 offset,
retval=bank->driver->write(bank, buffer, offset, count);
if (retval!=ERROR_OK)
{
ERROR("error writing to flash at address 0x%08x at offset 0x%8.8x (%d)", bank->base, offset, retval);
LOG_ERROR("error writing to flash at address 0x%08x at offset 0x%8.8x (%d)", bank->base, offset, retval);
}
return retval;
......@@ -106,7 +106,7 @@ static int flash_driver_erase(struct flash_bank_s *bank, int first, int last)
retval=bank->driver->erase(bank, first, last);
if (retval!=ERROR_OK)
{
ERROR("failed erasing sectors %d to %d (%d)", first, last, retval);
LOG_ERROR("failed erasing sectors %d to %d (%d)", first, last, retval);
}
return retval;
......@@ -119,7 +119,7 @@ int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last
retval=bank->driver->protect(bank, set, first, last);
if (retval!=ERROR_OK)
{
ERROR("failed setting protection for areas %d to %d (%d)", first, last, retval);
LOG_ERROR("failed setting protection for areas %d to %d (%d)", first, last, retval);
}
return retval;
......@@ -177,7 +177,7 @@ flash_bank_t *get_flash_bank_by_num_noprobe(int num)
return p;
}
}
ERROR("flash bank %d does not exist", num);
LOG_ERROR("flash bank %d does not exist", num);
return NULL;
}
......@@ -204,7 +204,7 @@ flash_bank_t *get_flash_bank_by_num(int num)
if (retval != ERROR_OK)
{
ERROR("auto_probe failed %d\n", retval);
LOG_ERROR("auto_probe failed %d\n", retval);
return NULL;
}
return p;
......@@ -223,7 +223,7 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
if ((target = get_target_by_num(strtoul(args[5], NULL, 0))) == NULL)
{
ERROR("target %lu not defined", strtoul(args[5], NULL, 0));
LOG_ERROR("target %lu not defined", strtoul(args[5], NULL, 0));
return ERROR_OK;
}
......@@ -236,7 +236,7 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
/* register flash specific commands */
if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
{
ERROR("couldn't register '%s' commands", args[0]);
LOG_ERROR("couldn't register '%s' commands", args[0]);
exit(-1);
}
......@@ -254,7 +254,7 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
if (flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c) != ERROR_OK)
{
ERROR("'%s' driver rejected flash bank at 0x%8.8x", args[0], c->base);
LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8x", args[0], c->base);
free(c);
return ERROR_OK;
}
......@@ -279,7 +279,7 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
/* no matching flash driver found */
if (!found)
{
ERROR("flash driver '%s' not found", args[0]);
LOG_ERROR("flash driver '%s' not found", args[0]);
exit(-1);
}
......@@ -356,7 +356,7 @@ int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char
retval = p->driver->info(p, buf, sizeof(buf));
command_print(cmd_ctx, "%s", buf);
if (retval != ERROR_OK)
ERROR("error retrieving flash info (%d)", retval);
LOG_ERROR("error retrieving flash info (%d)", retval);
}
}
......@@ -598,7 +598,7 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
if (!target)
{
ERROR("no target selected");
LOG_ERROR("no target selected");
return ERROR_OK;
}
......@@ -731,14 +731,14 @@ flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr)
if (retval != ERROR_OK)
{
ERROR("auto_probe failed %d\n", retval);
LOG_ERROR("auto_probe failed %d\n", retval);
return NULL;
}
/* check whether address belongs to this flash bank */
if ((addr >= c->base) && (addr < c->base + c->size) && target == c->target)
return c;
}
ERROR("No flash at address 0x%08x\n", addr);
LOG_ERROR("No flash at address 0x%08x\n", addr);
return NULL;
}
......@@ -823,7 +823,7 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
if (image->sections[section].size == 0)
{
WARNING("empty section %d", section);
LOG_WARNING("empty section %d", section);
section++;
section_offset = 0;
continue;
......@@ -845,7 +845,7 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
{
if (image->sections[section_last + 1].base_address < (run_address + run_size))
{
DEBUG("section %d out of order(very slightly surprising, but supported)", section_last + 1);
LOG_DEBUG("section %d out of order(very slightly surprising, but supported)", section_last + 1);
break;
}
if (image->sections[section_last + 1].base_address != (run_address + run_size))
......
......@@ -146,7 +146,7 @@ int lpc2000_build_sector_list(struct flash_bank_s *bank)
}
else
{
ERROR("BUG: unknown bank->size encountered");
LOG_ERROR("BUG: unknown bank->size encountered");
exit(-1);
}
}
......@@ -187,7 +187,7 @@ int lpc2000_build_sector_list(struct flash_bank_s *bank)
num_sectors = 27;
break;
default:
ERROR("BUG: unknown bank->size encountered");
LOG_ERROR("BUG: unknown bank->size encountered");
exit(-1);
break;
}
......@@ -225,7 +225,7 @@ int lpc2000_build_sector_list(struct flash_bank_s *bank)
}
else
{
ERROR("BUG: unknown lpc2000_info->variant encountered");
LOG_ERROR("BUG: unknown lpc2000_info->variant encountered");
exit(-1);
}
......@@ -256,7 +256,7 @@ int lpc2000_iap_call(flash_bank_t *bank, int code, u32 param_table[5], u32 resul
/* make sure we have a working area */
if (target_alloc_working_area(target, 172, &lpc2000_info->iap_working_area) != ERROR_OK)
{
ERROR("no working area specified, can't write LPC2000 internal flash");
LOG_ERROR("no working area specified, can't write LPC2000 internal flash");
return ERROR_FLASH_OPERATION_FAILED;
}
......@@ -351,7 +351,7 @@ int lpc2000_iap_blank_check(struct flash_bank_s *bank, int first, int last)
return ERROR_FLASH_BUSY;
break;
default:
ERROR("BUG: unknown LPC2000 status code");
LOG_ERROR("BUG: unknown LPC2000 status code");
exit(-1);
}
}
......@@ -367,7 +367,7 @@ int lpc2000_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, cha
if (argc < 8)
{
WARNING("incomplete flash_bank lpc2000 configuration");
LOG_WARNING("incomplete flash_bank lpc2000 configuration");
return ERROR_FLASH_BANK_INVALID;
}
......@@ -390,7 +390,7 @@ int lpc2000_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, cha
}
else
{
ERROR("unknown LPC2000 variant");
LOG_ERROR("unknown LPC2000 variant");
free(lpc2000_info);
return ERROR_FLASH_BANK_INVALID;
}
......@@ -437,7 +437,7 @@ int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_FLASH_SECTOR_INVALID;
break;
default:
WARNING("lpc2000 prepare sectors returned %i", status_code);
LOG_WARNING("lpc2000 prepare sectors returned %i", status_code);
return ERROR_FLASH_OPERATION_FAILED;
}
......@@ -453,7 +453,7 @@ int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_FLASH_SECTOR_INVALID;
break;
default:
WARNING("lpc2000 erase sectors returned %i", status_code);
LOG_WARNING("lpc2000 erase sectors returned %i", status_code);
return ERROR_FLASH_OPERATION_FAILED;
}
......@@ -489,7 +489,7 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
/* allocate a working area */
if (target_alloc_working_area(target, lpc2000_info->cmd51_max_buffer, &download_area) != ERROR_OK)
{
ERROR("no working area specified, can't write LPC2000 internal flash");
LOG_ERROR("no working area specified, can't write LPC2000 internal flash");
return ERROR_FLASH_OPERATION_FAILED;
}
......@@ -503,7 +503,7 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
if (offset % dst_min_alignment)
{
WARNING("offset 0x%x breaks required alignment 0x%x", offset, dst_min_alignment);
LOG_WARNING("offset 0x%x breaks required alignment 0x%x", offset, dst_min_alignment);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
......@@ -515,7 +515,7 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
last_sector = i;
}
DEBUG("first_sector: %i, last_sector: %i", first_sector, last_sector);
LOG_DEBUG("first_sector: %i, last_sector: %i", first_sector, last_sector);
/* check if exception vectors should be flashed */
if ((offset == 0) && (count >= 0x20) && lpc2000_info->calc_checksum)
......@@ -524,12 +524,12 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
int i = 0;
for (i = 0; i < 8; i++)
{
DEBUG("0x%2.2x: 0x%8.8x", i * 4, buf_get_u32(buffer + (i * 4), 0, 32));
LOG_DEBUG("0x%2.2x: 0x%8.8x", i * 4, buf_get_u32(buffer + (i * 4), 0, 32));
if (i != 5)
checksum += buf_get_u32(buffer + (i * 4), 0, 32);
}
checksum = 0 - checksum;
DEBUG("checksum: 0x%8.8x", checksum);
LOG_DEBUG("checksum: 0x%8.8x", checksum);
buf_set_u32(buffer + 0x14, 0, 32, checksum);
}
......@@ -559,7 +559,7 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
return ERROR_FLASH_SECTOR_INVALID;
break;
default:
WARNING("lpc2000 prepare sectors returned %i", status_code);
LOG_WARNING("lpc2000 prepare sectors returned %i", status_code);
return ERROR_FLASH_OPERATION_FAILED;
}
......@@ -582,7 +582,7 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
free(last_buffer);
}
DEBUG("writing 0x%x bytes to address 0x%x", thisrun_bytes, bank->base + offset + bytes_written);
LOG_DEBUG("writing 0x%x bytes to address 0x%x", thisrun_bytes, bank->base + offset + bytes_written);
/* Write data */
param_table[0] = bank->base + offset + bytes_written;
......@@ -600,7 +600,7 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
return ERROR_FLASH_SECTOR_INVALID;
break;
default:
WARNING("lpc2000 returned %i", status_code);
LOG_WARNING("lpc2000 returned %i", status_code);
return ERROR_FLASH_OPERATION_FAILED;
}
......
......@@ -72,7 +72,7 @@ int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, ch
if (argc < 3)
{
WARNING("incomplete 'lpc3180' nand flash configuration");
LOG_WARNING("incomplete 'lpc3180' nand flash configuration");
return ERROR_FLASH_BANK_INVALID;
}
......@@ -82,14 +82,14 @@ int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, ch
lpc3180_info->target = get_target_by_num(strtoul(args[1], NULL, 0));
if (!lpc3180_info->target)
{
ERROR("no target '%s' configured", args[1]);
LOG_ERROR("no target '%s' configured", args[1]);
return ERROR_NAND_DEVICE_INVALID;
}
lpc3180_info->osc_freq = strtoul(args[2], NULL, 0);
if ((lpc3180_info->osc_freq < 1000) || (lpc3180_info->osc_freq > 20000))
{
WARNING("LPC3180 oscillator frequency should be between 1000 and 20000 kHz, was %i", lpc3180_info->osc_freq);
LOG_WARNING("LPC3180 oscillator frequency should be between 1000 and 20000 kHz, was %i", lpc3180_info->osc_freq);
}
lpc3180_info->selected_controller = LPC3180_NO_CONTROLLER;
lpc3180_info->sw_write_protection = 0;
......@@ -119,7 +119,7 @@ int lpc3180_pll(int fclkin, u32 pll_ctrl)
int lock = (pll_ctrl & 0x1);
if (!lock)
WARNING("PLL is not locked");
LOG_WARNING("PLL is not locked");
if (!bypass && direct) /* direct mode */
return (m * fclkin) / n;
......@@ -179,7 +179,7 @@ float lpc3180_cycle_time(lpc3180_nand_controller_t *lpc3180_info)
}
}
DEBUG("LPC3180 HCLK currently clocked at %i kHz", hclk);
LOG_DEBUG("LPC3180 HCLK currently clocked at %i kHz", hclk);
cycle = (1.0 / hclk) * 1000000.0;
......@@ -196,14 +196,14 @@ int lpc3180_init(struct nand_device_s *device)
if (target->state != TARGET_HALTED)
{
ERROR("target must be halted to use LPC3180 NAND flash controller");
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
/* sanitize arguments */
if ((bus_width != 8) && (bus_width != 16))
{
ERROR("LPC3180 only supports 8 or 16 bit bus width, not %i", bus_width);
LOG_ERROR("LPC3180 only supports 8 or 16 bit bus width, not %i", bus_width);
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
......@@ -212,7 +212,7 @@ int lpc3180_init(struct nand_device_s *device)
*/
if (bus_width == 16)
{
WARNING("LPC3180 only supports 8 bit bus width");
LOG_WARNING("LPC3180 only supports 8 bit bus width");
}
/* inform calling code about selected bus width */
......@@ -220,20 +220,20 @@ int lpc3180_init(struct nand_device_s *device)
if ((address_cycles != 3) && (address_cycles != 4))
{
ERROR("LPC3180 only supports 3 or 4 address cycles, not %i", address_cycles);
LOG_ERROR("LPC3180 only supports 3 or 4 address cycles, not %i", address_cycles);
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
if ((page_size != 512) && (page_size != 2048))
{
ERROR("LPC3180 only supports 512 or 2048 byte pages, not %i", page_size);
LOG_ERROR("LPC3180 only supports 512 or 2048 byte pages, not %i", page_size);
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
/* select MLC controller if none is currently selected */
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
DEBUG("no LPC3180 NAND flash controller selected, using default 'mlc'");
LOG_DEBUG("no LPC3180 NAND flash controller selected, using default 'mlc'");
lpc3180_info->selected_controller = LPC3180_MLC_CONTROLLER;
}
......@@ -323,13 +323,13 @@ int lpc3180_reset(struct nand_device_s *device)
if (target->state != TARGET_HALTED)
{
ERROR("target must be halted to use LPC3180 NAND flash controller");
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
ERROR("BUG: no LPC3180 NAND flash controller selected");
LOG_ERROR("BUG: no LPC3180 NAND flash controller selected");
return ERROR_NAND_OPERATION_FAILED;
}
else if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER)
......@@ -339,7 +339,7 @@ int lpc3180_reset(struct nand_device_s *device)
if (!lpc3180_controller_ready(device, 100))
{
ERROR("LPC3180 NAND controller timed out after reset");
LOG_ERROR("LPC3180 NAND controller timed out after reset");
return ERROR_NAND_OPERATION_TIMEOUT;
}
}
......@@ -350,7 +350,7 @@ int lpc3180_reset(struct nand_device_s *device)
if (!lpc3180_controller_ready(device, 100))
{
ERROR("LPC3180 NAND controller timed out after reset");
LOG_ERROR("LPC3180 NAND controller timed out after reset");
return ERROR_NAND_OPERATION_TIMEOUT;