Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.
Signed-off-by: Zachary T Welch <zw@superlucidity.net>
#include "time_support.h"
-static int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
-static int aduc702x_register_commands(struct command_context_s *cmd_ctx);
-static int aduc702x_erase(struct flash_bank_s *bank, int first, int last);
-static int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int last);
-static int aduc702x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
-static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
-static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
-static int aduc702x_probe(struct flash_bank_s *bank);
-static int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size);
-static int aduc702x_protect_check(struct flash_bank_s *bank);
static int aduc702x_build_sector_list(struct flash_bank_s *bank);
static int aduc702x_check_flash_completion(target_t* target, unsigned int timeout_ms);
static int aduc702x_set_write_enable(target_t *target, int enable);
working_area_t *write_algorithm;
} aduc702x_flash_bank_t;
-flash_driver_t aduc702x_flash =
-{
- .name = "aduc702x",
- .register_commands = aduc702x_register_commands,
- .flash_bank_command = aduc702x_flash_bank_command,
- .erase = aduc702x_erase,
- .protect = aduc702x_protect,
- .write = aduc702x_write,
- .probe = aduc702x_probe,
- .auto_probe = aduc702x_probe,
- .erase_check = default_flash_blank_check,
- .protect_check = aduc702x_protect_check,
- .info = aduc702x_info
-};
-
-static int aduc702x_register_commands(struct command_context_s *cmd_ctx)
-{
- return ERROR_OK;
-}
-
/* flash bank aduc702x 0 0 0 0 <target#>
* The ADC7019-28 devices all have the same flash layout */
static int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
else return ERROR_OK;
}
+flash_driver_t aduc702x_flash = {
+ .name = "aduc702x",
+ .flash_bank_command = &aduc702x_flash_bank_command,
+ .erase = &aduc702x_erase,
+ .protect = &aduc702x_protect,
+ .write = &aduc702x_write,
+ .probe = &aduc702x_probe,
+ .auto_probe = &aduc702x_probe,
+ .erase_check = &default_flash_blank_check,
+ .protect_check = &aduc702x_protect_check,
+ .info = &aduc702x_info
+ };
{"atmega128", 0x9702, 256, 512, 8, 512},
};
-static int avrf_register_commands(struct command_context_s *cmd_ctx);
-static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
-static int avrf_erase(struct flash_bank_s *bank, int first, int last);
-static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last);
-static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
-static int avrf_probe(struct flash_bank_s *bank);
-static int avrf_auto_probe(struct flash_bank_s *bank);
-//static int avrf_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int avrf_protect_check(struct flash_bank_s *bank);
-static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size);
-
-static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-extern int avr_jtag_sendinstr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out);
-extern int avr_jtag_senddat(jtag_tap_t *tap, uint32_t *dr_in, uint32_t dr_out, int len);
-
-extern int mcu_write_ir(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int ir_len, int rti);
-extern int mcu_write_dr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int dr_len, int rti);
-extern int mcu_write_ir_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int ir_len, int rti);
-extern int mcu_write_dr_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int dr_len, int rti);
-extern int mcu_write_ir_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int ir_len, int rti);
-extern int mcu_write_dr_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int dr_len, int rti);
-extern int mcu_write_ir_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int ir_len, int rti);
-extern int mcu_write_dr_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int dr_len, int rti);
-extern int mcu_execute_queue(void);
-
-flash_driver_t avr_flash =
-{
- .name = "avr",
- .register_commands = avrf_register_commands,
- .flash_bank_command = avrf_flash_bank_command,
- .erase = avrf_erase,
- .protect = avrf_protect,
- .write = avrf_write,
- .probe = avrf_probe,
- .auto_probe = avrf_auto_probe,
- .erase_check = default_flash_mem_blank_check,
- .protect_check = avrf_protect_check,
- .info = avrf_info
-};
+int avr_jtag_sendinstr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out);
+int avr_jtag_senddat(jtag_tap_t *tap, uint32_t *dr_in, uint32_t dr_out, int len);
+
+int mcu_write_ir(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int ir_len, int rti);
+int mcu_write_dr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int dr_len, int rti);
+int mcu_write_ir_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int ir_len, int rti);
+int mcu_write_dr_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int dr_len, int rti);
+int mcu_write_ir_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int ir_len, int rti);
+int mcu_write_dr_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int dr_len, int rti);
+int mcu_write_ir_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int ir_len, int rti);
+int mcu_write_dr_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int dr_len, int rti);
+int mcu_execute_queue(void);
/* avr program functions */
static int avr_jtag_reset(avr_common_t *avr, uint32_t reset)
return ERROR_OK;
}
-/* interface command */
-static int avrf_register_commands(struct command_context_s *cmd_ctx)
-{
- command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr", NULL, COMMAND_ANY, "avr flash specific commands");
-
- register_command(cmd_ctx, avr_cmd, "mass_erase", avrf_handle_mass_erase_command, COMMAND_EXEC,
- "mass erase device");
-
- return ERROR_OK;
-}
-
static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
avrf_flash_bank_t *avrf_info;
LOG_DEBUG("%s", __FUNCTION__);
return ERROR_OK;
}
+
+static int avrf_register_commands(struct command_context_s *cmd_ctx)
+{
+ command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr",
+ NULL, COMMAND_ANY, "avr flash specific commands");
+
+ register_command(cmd_ctx, avr_cmd, "mass_erase",
+ avrf_handle_mass_erase_command, COMMAND_EXEC,
+ "mass erase device");
+
+ return ERROR_OK;
+}
+
+flash_driver_t avr_flash = {
+ .name = "avr",
+ .register_commands = &avrf_register_commands,
+ .flash_bank_command = &avrf_flash_bank_command,
+ .erase = &avrf_erase,
+ .protect = &avrf_protect,
+ .write = &avrf_write,
+ .probe = &avrf_probe,
+ .auto_probe = &avrf_auto_probe,
+ .erase_check = &default_flash_mem_blank_check,
+ .protect_check = &avrf_protect_check,
+ .info = &avrf_info,
+ };
#include "embeddedice.h"
-static int ocl_register_commands(struct command_context_s *cmd_ctx);
-static int ocl_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
-static int ocl_erase(struct flash_bank_s *bank, int first, int last);
-static int ocl_protect(struct flash_bank_s *bank, int set, int first, int last);
-static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
-static int ocl_probe(struct flash_bank_s *bank);
-static int ocl_erase_check(struct flash_bank_s *bank);
-static int ocl_protect_check(struct flash_bank_s *bank);
-static int ocl_info(struct flash_bank_s *bank, char *buf, int buf_size);
-static int ocl_auto_probe(struct flash_bank_s *bank);
-
-flash_driver_t ocl_flash =
-{
- .name = "ocl",
- .register_commands = ocl_register_commands,
- .flash_bank_command = ocl_flash_bank_command,
- .erase = ocl_erase,
- .protect = ocl_protect,
- .write = ocl_write,
- .probe = ocl_probe,
- .erase_check = ocl_erase_check,
- .protect_check = ocl_protect_check,
- .info = ocl_info,
- .auto_probe = ocl_auto_probe
-};
-
typedef struct ocl_priv_s
{
arm_jtag_t *jtag_info;
unsigned int bufalign;
} ocl_priv_t;
-static int ocl_register_commands(struct command_context_s *cmd_ctx)
-{
- return ERROR_OK;
-}
-
static int ocl_erase_check(struct flash_bank_s *bank)
{
return ERROR_OK;
return ERROR_OK;
}
+
+flash_driver_t ocl_flash = {
+ .name = "ocl",
+ .flash_bank_command = &ocl_flash_bank_command,
+ .erase = &ocl_erase,
+ .protect = &ocl_protect,
+ .write = &ocl_write,
+ .probe = &ocl_probe,
+ .erase_check = &ocl_erase_check,
+ .protect_check = &ocl_protect_check,
+ .info = &ocl_info,
+ .auto_probe = &ocl_auto_probe,
+ };
#define DID0_VER(did0) ((did0 >> 28)&0x07)
-static int stellaris_register_commands(struct command_context_s *cmd_ctx);
-static int stellaris_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
-static int stellaris_erase(struct flash_bank_s *bank, int first, int last);
-static int stellaris_protect(struct flash_bank_s *bank, int set, int first, int last);
-static int stellaris_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
-static int stellaris_auto_probe(struct flash_bank_s *bank);
-static int stellaris_probe(struct flash_bank_s *bank);
-static int stellaris_protect_check(struct flash_bank_s *bank);
-static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size);
static int stellaris_read_part_info(struct flash_bank_s *bank);
static uint32_t stellaris_get_flash_status(flash_bank_t *bank);
static void stellaris_set_flash_mode(flash_bank_t *bank,int mode);
//static uint32_t stellaris_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout);
-static int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int stellaris_mass_erase(struct flash_bank_s *bank);
-flash_driver_t stellaris_flash =
-{
- .name = "stellaris",
- .register_commands = stellaris_register_commands,
- .flash_bank_command = stellaris_flash_bank_command,
- .erase = stellaris_erase,
- .protect = stellaris_protect,
- .write = stellaris_write,
- .probe = stellaris_probe,
- .auto_probe = stellaris_auto_probe,
- .erase_check = default_flash_mem_blank_check,
- .protect_check = stellaris_protect_check,
- .info = stellaris_info
-};
-
static struct {
uint32_t partno;
char *partname;
return ERROR_OK;
}
-static int stellaris_register_commands(struct command_context_s *cmd_ctx)
-{
- command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris", NULL, COMMAND_ANY, "stellaris flash specific commands");
-
- register_command(cmd_ctx, stm32x_cmd, "mass_erase", stellaris_handle_mass_erase_command, COMMAND_EXEC, "mass erase device");
- return ERROR_OK;
-}
-
static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
int printed, device_class;
return ERROR_OK;
}
+
+static int stellaris_register_commands(struct command_context_s *cmd_ctx)
+{
+ command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris",
+ NULL, COMMAND_ANY, "stellaris flash specific commands");
+
+ register_command(cmd_ctx, stm32x_cmd, "mass_erase",
+ stellaris_handle_mass_erase_command, COMMAND_EXEC,
+ "mass erase device");
+ return ERROR_OK;
+}
+
+
+flash_driver_t stellaris_flash = {
+ .name = "stellaris",
+ .register_commands = &stellaris_register_commands,
+ .flash_bank_command = &stellaris_flash_bank_command,
+ .erase = &stellaris_erase,
+ .protect = &stellaris_protect,
+ .write = &stellaris_write,
+ .probe = &stellaris_probe,
+ .auto_probe = &stellaris_auto_probe,
+ .erase_check = &default_flash_mem_blank_check,
+ .protect_check = &stellaris_protect_check,
+ .info = &stellaris_info,
+ };
#include "tms470.h"
-static int tms470_register_commands(struct command_context_s *cmd_ctx);
-static int tms470_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
-static int tms470_erase(struct flash_bank_s *bank, int first, int last);
-static int tms470_protect(struct flash_bank_s *bank, int set, int first, int last);
-static int tms470_write(struct flash_bank_s *bank, uint8_t * buffer, uint32_t offset, uint32_t count);
-static int tms470_probe(struct flash_bank_s *bank);
-static int tms470_auto_probe(struct flash_bank_s *bank);
-static int tms470_erase_check(struct flash_bank_s *bank);
-static int tms470_protect_check(struct flash_bank_s *bank);
-static int tms470_info(struct flash_bank_s *bank, char *buf, int buf_size);
-
-flash_driver_t tms470_flash = {
- .name = "tms470",
- .register_commands = tms470_register_commands,
- .flash_bank_command = tms470_flash_bank_command,
- .erase = tms470_erase,
- .protect = tms470_protect,
- .write = tms470_write,
- .probe = tms470_probe,
- .auto_probe = tms470_auto_probe,
- .erase_check = tms470_erase_check,
- .protect_check = tms470_protect_check,
- .info = tms470_info
-};
-
/* ----------------------------------------------------------------------
Internal Support, Helpers
---------------------------------------------------------------------- */
return ERROR_OK;
}
+
+flash_driver_t tms470_flash = {
+ .name = "tms470",
+ .register_commands = &tms470_register_commands,
+ .flash_bank_command = &tms470_flash_bank_command,
+ .erase = &tms470_erase,
+ .protect = &tms470_protect,
+ .write = &tms470_write,
+ .probe = &tms470_probe,
+ .auto_probe = &tms470_auto_probe,
+ .erase_check = &tms470_erase_check,
+ .protect_check = &tms470_protect_check,
+ .info = &tms470_info,
+ };