]> git.sur5r.net Git - openocd/commitdiff
remove more useless declarations
authorZachary T Welch <zw@superlucidity.net>
Tue, 10 Nov 2009 07:20:34 +0000 (23:20 -0800)
committerZachary T Welch <zw@superlucidity.net>
Wed, 11 Nov 2009 19:53:22 +0000 (11:53 -0800)
Removes forward declarations by moving command registration after
defintion of the command handlers.

src/flash/lpc288x.c
src/flash/mx3_nand.c
src/pld/pld.c
src/pld/virtex2.c
src/target/etb.c

index 4827c2198886809dc4172f7bca3addf478bc06a8..36444fb1a4e0e4dc8c6ffa784c82ef6518820c73 100644 (file)
 /* 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);
index a5df00338be9f0f3821424bb0cbb7fbf1099d226..62603d9415f2dc8e045789f9da8c04a4bd65fad8 100644 (file)
@@ -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,
+       };
index 2bfb4016880a2aa5032c0faad6fe62cc6e5897ae..df7e2fdafcf575529b231bc568c937b51c9af76c 100644 (file)
@@ -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");
index ec0847fe3e6245e383ee6794edfa87850748a8d2..fa646505f7cc74cb140eeaf72f8d6fd21e0ea865 100644 (file)
 #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,
+       };
index 5b81895dfe8c920c0f4bf1e69cd00d11e8f5ea82..41312bedd381dbbebbbdbfd9fd1c9f93baf5d589 100644 (file)
@@ -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;