Fix compilation of target_request.h when it is included first.
[openocd.git] / src / flash / lpc3180_nand_controller.c
index 2ef6f40b6cdc361a6f43d16dec6f4e8a8f9d1f34..c24e30aa1e4a51bc24e03acf2365fb632346f64b 100644 (file)
 #include "nand.h"
 #include "target.h"
 
-int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
-int lpc3180_register_commands(struct command_context_s *cmd_ctx);
-int lpc3180_init(struct nand_device_s *device);
-int lpc3180_reset(struct nand_device_s *device);
-int lpc3180_command(struct nand_device_s *device, u8 command);
-int lpc3180_address(struct nand_device_s *device, u8 address);
-int lpc3180_write_data(struct nand_device_s *device, u16 data);
-int lpc3180_read_data(struct nand_device_s *device, void *data);
-int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
-int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
-int lpc3180_controller_ready(struct nand_device_s *device, int timeout);
-int lpc3180_nand_ready(struct nand_device_s *device, int timeout);
-
-int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
+static int lpc3180_register_commands(struct command_context_s *cmd_ctx);
+static int lpc3180_init(struct nand_device_s *device);
+static int lpc3180_reset(struct nand_device_s *device);
+static int lpc3180_command(struct nand_device_s *device, u8 command);
+static int lpc3180_address(struct nand_device_s *device, u8 address);
+static int lpc3180_write_data(struct nand_device_s *device, u16 data);
+static int lpc3180_read_data(struct nand_device_s *device, void *data);
+static int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
+static int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
+static int lpc3180_controller_ready(struct nand_device_s *device, int timeout);
+static int lpc3180_nand_ready(struct nand_device_s *device, int timeout);
+
+static int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
 
 nand_flash_controller_t lpc3180_nand_controller =
 {
@@ -66,13 +66,13 @@ nand_flash_controller_t lpc3180_nand_controller =
 
 /* nand device lpc3180 <target#> <oscillator_frequency>
  */
-int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device)
+static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device)
 {
        lpc3180_nand_controller_t *lpc3180_info;
-               
+       
        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;
@@ -99,7 +99,7 @@ int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, ch
        return ERROR_OK;
 }
 
-int lpc3180_register_commands(struct command_context_s *cmd_ctx)
+static int lpc3180_register_commands(struct command_context_s *cmd_ctx)
 {
        command_t *lpc3180_cmd = register_command(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers");
        
@@ -108,7 +108,7 @@ int lpc3180_register_commands(struct command_context_s *cmd_ctx)
        return ERROR_OK;
 }
 
-int lpc3180_pll(int fclkin, u32 pll_ctrl)
+static int lpc3180_pll(int fclkin, u32 pll_ctrl)
 {
        int bypass = (pll_ctrl & 0x8000) >> 15;
        int direct = (pll_ctrl & 0x4000) >> 14;
@@ -119,14 +119,14 @@ 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;
        
        if (bypass && !direct)  /* bypass mode */
                return fclkin / (2 * p);
-               
+       
        if (bypass & direct)    /* direct bypass mode */
                return fclkin;
        
@@ -136,7 +136,7 @@ int lpc3180_pll(int fclkin, u32 pll_ctrl)
                return (m / (2 * p)) * (fclkin / n); 
 }
 
-float lpc3180_cycle_time(lpc3180_nand_controller_t *lpc3180_info)
+static float lpc3180_cycle_time(lpc3180_nand_controller_t *lpc3180_info)
 {
        target_t *target = lpc3180_info->target;
        u32 sysclk_ctrl, pwr_ctrl, hclkdiv_ctrl, hclkpll_ctrl;
@@ -179,14 +179,14 @@ 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;
        
        return cycle;
 }
 
-int lpc3180_init(struct nand_device_s *device)
+static int lpc3180_init(struct nand_device_s *device)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
@@ -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;
        }
        
@@ -273,7 +273,7 @@ int lpc3180_init(struct nand_device_s *device)
                trhz = ((30 / cycle) + 1);
                trbwb = ((100 / cycle) + 1);
                tcea = ((45 / cycle) + 1);
-                               
+               
                /* MLC_LOCK = 0xa25e (unlock protected registers) */
                target_write_u32(target, 0x200b8044, 0xa25e);
        
@@ -316,20 +316,20 @@ int lpc3180_init(struct nand_device_s *device)
        return ERROR_OK;
 }
 
-int lpc3180_reset(struct nand_device_s *device)
+static int lpc3180_reset(struct nand_device_s *device)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
        
        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;
                }
        }
@@ -358,20 +358,20 @@ int lpc3180_reset(struct nand_device_s *device)
        return ERROR_OK;
 }
 
-int lpc3180_command(struct nand_device_s *device, u8 command)
+static int lpc3180_command(struct nand_device_s *device, u8 command)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
        
        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)
@@ -388,20 +388,20 @@ int lpc3180_command(struct nand_device_s *device, u8 command)
        return ERROR_OK;
 }
 
-int lpc3180_address(struct nand_device_s *device, u8 address)
+static int lpc3180_address(struct nand_device_s *device, u8 address)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
        
        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)
@@ -418,20 +418,20 @@ int lpc3180_address(struct nand_device_s *device, u8 address)
        return ERROR_OK;
 }
 
-int lpc3180_write_data(struct nand_device_s *device, u16 data)
+static int lpc3180_write_data(struct nand_device_s *device, u16 data)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
        
        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)
@@ -448,20 +448,20 @@ int lpc3180_write_data(struct nand_device_s *device, u16 data)
        return ERROR_OK;
 }
 
-int lpc3180_read_data(struct nand_device_s *device, void *data)
+static int lpc3180_read_data(struct nand_device_s *device, void *data)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
        
        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)
@@ -479,7 +479,7 @@ int lpc3180_read_data(struct nand_device_s *device, void *data)
                }
                else
                {
-                       ERROR("BUG: bus_width neither 8 nor 16 bit");
+                       LOG_ERROR("BUG: bus_width neither 8 nor 16 bit");
                        return ERROR_NAND_OPERATION_FAILED;
                }
        }
@@ -502,7 +502,7 @@ int lpc3180_read_data(struct nand_device_s *device, void *data)
                }
                else
                {
-                       ERROR("BUG: bus_width neither 8 nor 16 bit");
+                       LOG_ERROR("BUG: bus_width neither 8 nor 16 bit");
                        return ERROR_NAND_OPERATION_FAILED;
                }
        }       
@@ -510,7 +510,7 @@ int lpc3180_read_data(struct nand_device_s *device, void *data)
        return ERROR_OK;
 }
 
-int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size)
+static int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
@@ -519,13 +519,13 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
        
        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)
@@ -536,19 +536,19 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
                
                if (!data && oob)
                {
-                       ERROR("LPC3180 MLC controller can't write OOB data only");
+                       LOG_ERROR("LPC3180 MLC controller can't write OOB data only");
                        return ERROR_NAND_OPERATION_NOT_SUPPORTED;
                }
                
                if (oob && (oob_size > 6))
                {
-                       ERROR("LPC3180 MLC controller can't write more than 6 bytes of OOB data");
+                       LOG_ERROR("LPC3180 MLC controller can't write more than 6 bytes of OOB data");
                        return ERROR_NAND_OPERATION_NOT_SUPPORTED;
                }
                
-               if (data_size > device->page_size)
+               if (data_size > (u32)device->page_size)
                {
-                       ERROR("data size exceeds page size");
+                       LOG_ERROR("data size exceeds page size");
                        return ERROR_NAND_OPERATION_NOT_SUPPORTED;
                }
                
@@ -618,7 +618,7 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
                        
                        if (!lpc3180_controller_ready(device, 1000))
                        {
-                               ERROR("timeout while waiting for completion of auto encode cycle");
+                               LOG_ERROR("timeout while waiting for completion of auto encode cycle");
                                return ERROR_NAND_OPERATION_FAILED;
                        }
                }
@@ -628,13 +628,13 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
                
                if ((retval = nand_read_status(device, &status)) != ERROR_OK)
                {
-                       ERROR("couldn't read status");
+                       LOG_ERROR("couldn't read status");
                        return ERROR_NAND_OPERATION_FAILED;
                }
                        
                if (status & NAND_STATUS_FAIL)
                {
-                       ERROR("write operation didn't pass, status: 0x%2.2x", status);
+                       LOG_ERROR("write operation didn't pass, status: 0x%2.2x", status);
                        return ERROR_NAND_OPERATION_FAILED;
                }
        
@@ -649,20 +649,20 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
        return ERROR_OK;
 }
 
-int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size)
+static int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
        
        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)
@@ -676,14 +676,14 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
 #if 0
                if (oob && (oob_size > 6))
                {
-                       ERROR("LPC3180 MLC controller can't read more than 6 bytes of OOB data");
+                       LOG_ERROR("LPC3180 MLC controller can't read more than 6 bytes of OOB data");
                        return ERROR_NAND_OPERATION_NOT_SUPPORTED;
                }
 #endif
                
-               if (data_size > device->page_size)
+               if (data_size > (u32)device->page_size)
                {
-                       ERROR("data size exceeds page size");
+                       LOG_ERROR("data size exceeds page size");
                        return ERROR_NAND_OPERATION_NOT_SUPPORTED;
                }
                
@@ -741,14 +741,14 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
                        target_write_u32(target, 0x200b8000, NAND_CMD_READSTART);
                }
                
-               while (page_bytes_done < device->page_size)
+               while (page_bytes_done < (u32)device->page_size)
                {
                        /* MLC_ECC_AUTO_DEC_REG = dummy */
                        target_write_u32(target, 0x200b8014, 0xaa55aa55);
                        
                        if (!lpc3180_controller_ready(device, 1000))
                        {
-                               ERROR("timeout while waiting for completion of auto decode cycle");
+                               LOG_ERROR("timeout while waiting for completion of auto decode cycle");
                                return ERROR_NAND_OPERATION_FAILED;
                        }
                
@@ -758,11 +758,11 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
                        {
                                if (mlc_isr & 0x40)
                                {
-                                       ERROR("uncorrectable error detected: 0x%2.2x", mlc_isr);
+                                       LOG_ERROR("uncorrectable error detected: 0x%2.2x", mlc_isr);
                                        return ERROR_NAND_OPERATION_FAILED;
                                }
                                
-                               WARNING("%i symbol error detected and corrected", ((mlc_isr & 0x30) >> 4) + 1);
+                               LOG_WARNING("%i symbol error detected and corrected", ((mlc_isr & 0x30) >> 4) + 1);
                        }
                        
                        if (data)
@@ -796,7 +796,7 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
        return ERROR_OK;
 }
 
-int lpc3180_controller_ready(struct nand_device_s *device, int timeout)
+static int lpc3180_controller_ready(struct nand_device_s *device, int timeout)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
@@ -804,7 +804,7 @@ int lpc3180_controller_ready(struct nand_device_s *device, int timeout)
        
        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;
        }
                        
@@ -824,20 +824,20 @@ int lpc3180_controller_ready(struct nand_device_s *device, int timeout)
                        return 1;
                }
 
-               usleep(1000);
+               alive_sleep(1);
        } while (timeout-- > 0);
        
        return 0;
 }
 
-int lpc3180_nand_ready(struct nand_device_s *device, int timeout)
+static int lpc3180_nand_ready(struct nand_device_s *device, int timeout)
 {
        lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
        target_t *target = lpc3180_info->target;
        
        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;
        }
                        
@@ -864,13 +864,13 @@ int lpc3180_nand_ready(struct nand_device_s *device, int timeout)
                                return 1;
                }
                
-               usleep(1000);
+               alive_sleep(1);
        } while (timeout-- > 0);
        
        return 0;       
 }
 
-int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
        nand_device_t *device = NULL;
        lpc3180_nand_controller_t *lpc3180_info = NULL;
@@ -881,8 +881,7 @@ int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd,
        
        if ((argc < 1) || (argc > 2))
        {
-               command_print(cmd_ctx, "usage: lpc3180 select <num> <'mlc'|'slc'>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        
        device = get_nand_device_by_num(strtoul(args[0], NULL, 0));
@@ -906,7 +905,7 @@ int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd,
                }
                else
                {
-                       command_print(cmd_ctx, "usage: lpc3180 select <'mlc'|'slc'>");
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
        }
        

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)