X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstr9x.c;h=8b3c1371484dbce5fdc7ca788a870984282af917;hp=a66541fe117194c75d1afaef7ce6cdd3c21accaa;hb=58256d48358ab695e970b5e61546aecb366ad914;hpb=4da4e1cfb7d93dcedc333c11c787b83b8baf7dfa diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c index a66541fe11..8b3c137148 100644 --- a/src/flash/nor/str9x.c +++ b/src/flash/nor/str9x.c @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -347,7 +347,7 @@ static int str9x_protect(struct flash_bank *bank, } static int str9x_write_block(struct flash_bank *bank, - uint8_t *buffer, uint32_t offset, uint32_t count) + const uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; uint32_t buffer_size = 32768; @@ -392,9 +392,10 @@ static int str9x_write_block(struct flash_bank *bank, return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; }; - target_write_buffer(target, write_algorithm->address, - sizeof(str9x_flash_write_code), - (uint8_t *)str9x_flash_write_code); + uint8_t code[sizeof(str9x_flash_write_code)]; + target_buffer_set_u32_array(target, code, ARRAY_SIZE(str9x_flash_write_code), + str9x_flash_write_code); + target_write_buffer(target, write_algorithm->address, sizeof(code), code); /* memory buffer */ while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) { @@ -458,7 +459,7 @@ static int str9x_write_block(struct flash_bank *bank, } static int str9x_write(struct flash_bank *bank, - uint8_t *buffer, uint32_t offset, uint32_t count) + const uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; uint32_t words_remaining = (count / 2); @@ -606,12 +607,6 @@ COMMAND_HANDLER(str9x_handle_part_id_command) } #endif -static int get_str9x_info(struct flash_bank *bank, char *buf, int buf_size) -{ - snprintf(buf, buf_size, "str9x flash driver info"); - return ERROR_OK; -} - COMMAND_HANDLER(str9x_handle_flash_config_command) { struct target *target = NULL; @@ -686,5 +681,4 @@ struct flash_driver str9x_flash = { .auto_probe = str9x_probe, .erase_check = default_flash_blank_check, .protect_check = str9x_protect_check, - .info = get_str9x_info, };