X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fmx3_nand.c;h=49e1758be63f02a2959501c1a3ef691d8723d1a4;hp=531111660f2c9a0fae694dabea8192ed700796fd;hb=7bf1a86e473a12882bf6f71cb4d0d416394b69d4;hpb=86053523875d18151f3dd0b53bf30e07eec2acf2 diff --git a/src/flash/mx3_nand.c b/src/flash/mx3_nand.c index 531111660f..49e1758be6 100644 --- a/src/flash/mx3_nand.c +++ b/src/flash/mx3_nand.c @@ -47,19 +47,19 @@ static const char get_status_register_err_msg[] = "can't get NAND status"; static uint32_t in_sram_address; unsigned char sign_of_sequental_byte_read; -static int test_iomux_settings (target_t * target, uint32_t value, +static int test_iomux_settings (struct target * target, uint32_t value, uint32_t mask, const char *text); -static int initialize_nf_controller (struct nand_device_s *nand); -static int get_next_byte_from_sram_buffer (target_t * target, uint8_t * value); -static int get_next_halfword_from_sram_buffer (target_t * target, +static int initialize_nf_controller (struct nand_device *nand); +static int get_next_byte_from_sram_buffer (struct target * target, uint8_t * value); +static int get_next_halfword_from_sram_buffer (struct target * target, uint16_t * value); -static int poll_for_complete_op (target_t * target, const char *text); -static int validate_target_state (struct nand_device_s *nand); -static int do_data_output (struct nand_device_s *nand); +static int poll_for_complete_op (struct target * target, const char *text); +static int validate_target_state (struct nand_device *nand); +static int do_data_output (struct nand_device *nand); -static int imx31_command (struct nand_device_s *nand, uint8_t command); -static int imx31_address (struct nand_device_s *nand, uint8_t address); -static int imx31_controller_ready (struct nand_device_s *nand, int tout); +static int imx31_command (struct nand_device *nand, uint8_t command); +static int imx31_address (struct nand_device *nand, uint8_t address); +static int imx31_controller_ready (struct nand_device *nand, int tout); NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) { @@ -79,7 +79,7 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) LOG_ERROR ("target '%s' not defined", args[1]); return ERROR_FAIL; } - if (argc < 3) + if (CMD_ARGC < 3) { LOG_ERROR ("use \"nand device imx31 target noecc|hwecc\""); return ERROR_FAIL; @@ -121,10 +121,10 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) return ERROR_OK; } -static int imx31_init (struct nand_device_s *nand) +static int imx31_init (struct nand_device *nand) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; { /* @@ -264,10 +264,10 @@ static int imx31_init (struct nand_device_s *nand) return ERROR_OK; } -static int imx31_read_data (struct nand_device_s *nand, void *data) +static int imx31_read_data (struct nand_device *nand, void *data) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; { /* * validate target state @@ -304,23 +304,23 @@ static int imx31_read_data (struct nand_device_s *nand, void *data) return ERROR_OK; } -static int imx31_write_data (struct nand_device_s *nand, uint16_t data) +static int imx31_write_data (struct nand_device *nand, uint16_t data) { LOG_ERROR ("write_data() not implemented"); return ERROR_NAND_OPERATION_FAILED; } -static int imx31_nand_ready (struct nand_device_s *nand, int timeout) +static int imx31_nand_ready (struct nand_device *nand, int timeout) { return imx31_controller_ready (nand, timeout); } -static int imx31_register_commands (struct command_context_s *cmd_ctx) +static int imx31_register_commands (struct command_context *cmd_ctx) { return ERROR_OK; } -static int imx31_reset (struct nand_device_s *nand) +static int imx31_reset (struct nand_device *nand) { /* * validate target state @@ -335,10 +335,10 @@ static int imx31_reset (struct nand_device_s *nand) return ERROR_OK; } -static int imx31_command (struct nand_device_s *nand, uint8_t command) +static int imx31_command (struct nand_device *nand, uint8_t command) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; { /* * validate target state @@ -409,10 +409,10 @@ static int imx31_command (struct nand_device_s *nand, uint8_t command) return ERROR_OK; } -static int imx31_address (struct nand_device_s *nand, uint8_t address) +static int imx31_address (struct nand_device *nand, uint8_t address) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; { /* * validate target state @@ -441,11 +441,11 @@ static int imx31_address (struct nand_device_s *nand, uint8_t address) return ERROR_OK; } -static int imx31_controller_ready (struct nand_device_s *nand, int tout) +static int imx31_controller_ready (struct nand_device *nand, int tout) { uint16_t poll_complete_status; struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; { /* @@ -472,12 +472,12 @@ static int imx31_controller_ready (struct nand_device_s *nand, int tout) return tout; } -static int imx31_write_page (struct nand_device_s *nand, uint32_t page, +static int imx31_write_page (struct nand_device *nand, uint32_t page, uint8_t * data, uint32_t data_size, uint8_t * oob, uint32_t oob_size) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; if (data_size % 2) { @@ -579,12 +579,12 @@ static int imx31_write_page (struct nand_device_s *nand, uint32_t page, return ERROR_OK; } -static int imx31_read_page (struct nand_device_s *nand, uint32_t page, +static int imx31_read_page (struct nand_device *nand, uint32_t page, uint8_t * data, uint32_t data_size, uint8_t * oob, uint32_t oob_size) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; if (data_size % 2) { @@ -643,7 +643,7 @@ static int imx31_read_page (struct nand_device_s *nand, uint32_t page, return ERROR_OK; } -static int test_iomux_settings (target_t * target, uint32_t address, +static int test_iomux_settings (struct target * target, uint32_t address, uint32_t mask, const char *text) { uint32_t register_content; @@ -656,10 +656,10 @@ static int test_iomux_settings (target_t * target, uint32_t address, return ERROR_OK; } -static int initialize_nf_controller (struct nand_device_s *nand) +static int initialize_nf_controller (struct nand_device *nand) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; /* * resets NAND flash controller in zero time ? I dont know. */ @@ -709,7 +709,7 @@ static int initialize_nf_controller (struct nand_device_s *nand) return ERROR_OK; } -static int get_next_byte_from_sram_buffer (target_t * target, uint8_t * value) +static int get_next_byte_from_sram_buffer (struct target * target, uint8_t * value) { static uint8_t even_byte = 0; /* @@ -747,7 +747,7 @@ static int get_next_byte_from_sram_buffer (target_t * target, uint8_t * value) return ERROR_OK; } -static int get_next_halfword_from_sram_buffer (target_t * target, +static int get_next_halfword_from_sram_buffer (struct target * target, uint16_t * value) { if (in_sram_address > MX3_NF_LAST_BUFFER_ADDR) @@ -764,7 +764,7 @@ static int get_next_halfword_from_sram_buffer (target_t * target, return ERROR_OK; } -static int poll_for_complete_op (target_t * target, const char *text) +static int poll_for_complete_op (struct target * target, const char *text) { uint16_t poll_complete_status; for (int poll_cycle_count = 0; poll_cycle_count < 100; poll_cycle_count++) @@ -784,10 +784,10 @@ static int poll_for_complete_op (target_t * target, const char *text) return ERROR_OK; } -static int validate_target_state (struct nand_device_s *nand) +static int validate_target_state (struct nand_device *nand) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; if (target->state != TARGET_HALTED) { @@ -806,10 +806,10 @@ static int validate_target_state (struct nand_device_s *nand) return ERROR_OK; } -static int do_data_output (struct nand_device_s *nand) +static int do_data_output (struct nand_device *nand) { struct mx3_nf_controller *mx3_nf_info = nand->controller_priv; - target_t *target = mx3_nf_info->target; + struct target *target = mx3_nf_info->target; switch (mx3_nf_info->fin) { case MX3_NF_FIN_DATAOUT: