summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-09 23:20:34 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-11 11:53:22 -0800
commit39ab1c1a41cf6adfaeb936931a771e6b2d5fbdcb (patch)
treebd3b863ba2f019b26f16cacce6fc31caf17dbf1a /src
parente9974316027097ff7984924676d70d33b7b674ed (diff)
downloadopenocd_libswd-39ab1c1a41cf6adfaeb936931a771e6b2d5fbdcb.tar.gz
openocd_libswd-39ab1c1a41cf6adfaeb936931a771e6b2d5fbdcb.tar.bz2
openocd_libswd-39ab1c1a41cf6adfaeb936931a771e6b2d5fbdcb.tar.xz
openocd_libswd-39ab1c1a41cf6adfaeb936931a771e6b2d5fbdcb.zip
remove more useless declarations
Removes forward declarations by moving command registration after defintion of the command handlers.
Diffstat (limited to 'src')
-rw-r--r--src/flash/lpc288x.c11
-rw-r--r--src/flash/mx3_nand.c47
-rw-r--r--src/pld/pld.c35
-rw-r--r--src/pld/virtex2.c41
-rw-r--r--src/target/etb.c25
5 files changed, 62 insertions, 97 deletions
diff --git a/src/flash/lpc288x.c b/src/flash/lpc288x.c
index 4827c219..36444fb1 100644
--- a/src/flash/lpc288x.c
+++ b/src/flash/lpc288x.c
@@ -84,17 +84,6 @@
/* F_CLK_TIME */
#define FCT_CLK_DIV_MASK 0x0FFF
-#if 0
-static int lpc288x_register_commands(struct command_context_s *cmd_ctx);
-static int lpc288x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
-static int lpc288x_erase(struct flash_bank_s *bank, int first, int last);
-static int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int last);
-static int lpc288x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
-static int lpc288x_probe(struct flash_bank_s *bank);
-static int lpc288x_erase_check(struct flash_bank_s *bank);
-static int lpc288x_protect_check(struct flash_bank_s *bank);
-static int lpc288x_info(struct flash_bank_s *bank, char *buf, int buf_size);
-#endif
static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout);
static void lpc288x_load_timer(int erase, struct target_s *target);
static void lpc288x_set_flash_clk(struct flash_bank_s *bank);
diff --git a/src/flash/mx3_nand.c b/src/flash/mx3_nand.c
index a5df0033..62603d94 100644
--- a/src/flash/mx3_nand.c
+++ b/src/flash/mx3_nand.c
@@ -57,40 +57,9 @@ static int poll_for_complete_op (target_t * target, const char *text);
static int validate_target_state (struct nand_device_s *device);
static int do_data_output (struct nand_device_s *device);
-static int imx31_nand_device_command (struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc,
- struct nand_device_s *device);
-static int imx31_init (struct nand_device_s *device);
-static int imx31_read_data (struct nand_device_s *device, void *data);
-static int imx31_write_data (struct nand_device_s *device, uint16_t data);
-static int imx31_nand_ready (struct nand_device_s *device, int timeout);
-static int imx31_register_commands (struct command_context_s *cmd_ctx);
-static int imx31_reset (struct nand_device_s *device);
static int imx31_command (struct nand_device_s *device, uint8_t command);
static int imx31_address (struct nand_device_s *device, uint8_t address);
static int imx31_controller_ready (struct nand_device_s *device, int tout);
-static int imx31_write_page (struct nand_device_s *device, uint32_t page,
- uint8_t * data, uint32_t data_size, uint8_t * oob,
- uint32_t oob_size);
-static int imx31_read_page (struct nand_device_s *device, uint32_t page,
- uint8_t * data, uint32_t data_size, uint8_t * oob,
- uint32_t oob_size);
-
-nand_flash_controller_t imx31_nand_flash_controller = {
- .name = "imx31",
- .nand_device_command = imx31_nand_device_command,
- .register_commands = imx31_register_commands,
- .init = imx31_init,
- .reset = imx31_reset,
- .command = imx31_command,
- .address = imx31_address,
- .write_data = imx31_write_data,
- .read_data = imx31_read_data,
- .write_page = imx31_write_page,
- .read_page = imx31_read_page,
- .controller_ready = imx31_controller_ready,
- .nand_ready = imx31_nand_ready,
-};
static int imx31_nand_device_command (struct command_context_s *cmd_ctx,
char *cmd, char **args, int argc,
@@ -900,3 +869,19 @@ static int do_data_output (struct nand_device_s *device)
}
return ERROR_OK;
}
+
+nand_flash_controller_t imx31_nand_flash_controller = {
+ .name = "imx31",
+ .nand_device_command = &imx31_nand_device_command,
+ .register_commands = &imx31_register_commands,
+ .init = &imx31_init,
+ .reset = &imx31_reset,
+ .command = &imx31_command,
+ .address = &imx31_address,
+ .write_data = &imx31_write_data,
+ .read_data = &imx31_read_data,
+ .write_page = &imx31_write_page,
+ .read_page = &imx31_read_page,
+ .controller_ready = &imx31_controller_ready,
+ .nand_ready = &imx31_nand_ready,
+ };
diff --git a/src/pld/pld.c b/src/pld/pld.c
index 2bfb4016..df7e2fda 100644
--- a/src/pld/pld.c
+++ b/src/pld/pld.c
@@ -39,26 +39,6 @@ static pld_driver_t *pld_drivers[] =
static pld_device_t *pld_devices;
static command_t *pld_cmd;
-static int handle_pld_devices_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc);
-static int handle_pld_device_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc);
-static int handle_pld_load_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc);
-
-int pld_init(struct command_context_s *cmd_ctx)
-{
- if (pld_devices)
- {
- register_command(cmd_ctx, pld_cmd, "devices", handle_pld_devices_command, COMMAND_EXEC,
- "list configured pld devices");
- register_command(cmd_ctx, pld_cmd, "load", handle_pld_load_command, COMMAND_EXEC,
- "load configuration <file> into programmable logic device");
- }
-
- return ERROR_OK;
-}
-
pld_device_t *get_pld_device_by_num(int num)
{
pld_device_t *p;
@@ -206,6 +186,21 @@ static int handle_pld_load_command(struct command_context_s *cmd_ctx,
return ERROR_OK;
}
+int pld_init(struct command_context_s *cmd_ctx)
+{
+ if (!pld_devices)
+ return ERROR_OK;
+
+ register_command(cmd_ctx, pld_cmd, "devices",
+ handle_pld_devices_command, COMMAND_EXEC,
+ "list configured pld devices");
+ register_command(cmd_ctx, pld_cmd, "load",
+ handle_pld_load_command, COMMAND_EXEC,
+ "load configuration <file> into programmable logic device");
+
+ return ERROR_OK;
+}
+
int pld_register_commands(struct command_context_s *cmd_ctx)
{
pld_cmd = register_command(cmd_ctx, NULL, "pld", NULL, COMMAND_ANY, "programmable logic device commands");
diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c
index ec0847fe..fa646505 100644
--- a/src/pld/virtex2.c
+++ b/src/pld/virtex2.c
@@ -26,18 +26,6 @@
#include "pld.h"
-static int virtex2_register_commands(struct command_context_s *cmd_ctx);
-static int virtex2_pld_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct pld_device_s *pld_device);
-static int virtex2_load(struct pld_device_s *pld_device, char *filename);
-
-pld_driver_t virtex2_pld =
-{
- .name = "virtex2",
- .register_commands = virtex2_register_commands,
- .pld_device_command = virtex2_pld_device_command,
- .load = virtex2_load,
-};
-
static int virtex2_set_instr(jtag_tap_t *tap, uint32_t new_instr)
{
if (tap == NULL)
@@ -220,16 +208,6 @@ static int virtex2_handle_read_stat_command(struct command_context_s *cmd_ctx,
return ERROR_OK;
}
-static int virtex2_register_commands(struct command_context_s *cmd_ctx)
-{
- command_t *virtex2_cmd = register_command(cmd_ctx, NULL, "virtex2", NULL, COMMAND_ANY, "virtex2 specific commands");
-
- register_command(cmd_ctx, virtex2_cmd, "read_stat", virtex2_handle_read_stat_command, COMMAND_EXEC,
- "read Virtex-II status register");
-
- return ERROR_OK;
-}
-
static int virtex2_pld_device_command(struct command_context_s *cmd_ctx,
char *cmd, char **args, int argc, struct pld_device_s *pld_device)
{
@@ -255,3 +233,22 @@ static int virtex2_pld_device_command(struct command_context_s *cmd_ctx,
return ERROR_OK;
}
+
+static int virtex2_register_commands(struct command_context_s *cmd_ctx)
+{
+ command_t *virtex2_cmd = register_command(cmd_ctx, NULL, "virtex2",
+ NULL, COMMAND_ANY, "virtex2 specific commands");
+
+ register_command(cmd_ctx, virtex2_cmd, "read_stat",
+ &virtex2_handle_read_stat_command, COMMAND_EXEC,
+ "read Virtex-II status register");
+
+ return ERROR_OK;
+}
+
+pld_driver_t virtex2_pld = {
+ .name = "virtex2",
+ .register_commands = &virtex2_register_commands,
+ .pld_device_command = &virtex2_pld_device_command,
+ .load = &virtex2_load,
+ };
diff --git a/src/target/etb.c b/src/target/etb.c
index 5b81895d..41312bed 100644
--- a/src/target/etb.c
+++ b/src/target/etb.c
@@ -42,8 +42,6 @@ static int etb_reg_arch_type = -1;
static int etb_get_reg(reg_t *reg);
-static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
static int etb_set_instr(etb_t *etb, uint32_t new_instr)
{
jtag_tap_t *tap;
@@ -351,17 +349,6 @@ static int etb_write_reg(reg_t *reg, uint32_t value)
return ERROR_OK;
}
-static int etb_register_commands(struct command_context_s *cmd_ctx)
-{
- command_t *etb_cmd;
-
- etb_cmd = register_command(cmd_ctx, NULL, "etb", NULL, COMMAND_ANY, "Embedded Trace Buffer");
-
- register_command(cmd_ctx, etb_cmd, "config", handle_etb_config_command, COMMAND_CONFIG, NULL);
-
- return ERROR_OK;
-}
-
static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
target_t *target;
@@ -416,6 +403,18 @@ static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cm
return ERROR_OK;
}
+static int etb_register_commands(struct command_context_s *cmd_ctx)
+{
+ command_t *etb_cmd = register_command(cmd_ctx, NULL, "etb",
+ NULL, COMMAND_ANY, "Embedded Trace Buffer");
+
+ register_command(cmd_ctx, etb_cmd, "config",
+ handle_etb_config_command, COMMAND_CONFIG,
+ NULL);
+
+ return ERROR_OK;
+}
+
static int etb_init(etm_context_t *etm_ctx)
{
etb_t *etb = etm_ctx->capture_driver_priv;