X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fat91sam3.c;h=d80b6fe6e8d78309d27d0ae4f940f762327605d1;hp=9782fd82fd35c70ae7c8a99b169b06ea0e490f85;hb=a9fb0d07f07f141f9a1c08c21341b3188b21fbe2;hpb=0c8ec7c826c60391034fe5f0ea90f8538ac94b38 diff --git a/src/flash/nor/at91sam3.c b/src/flash/nor/at91sam3.c index 9782fd82fd..d80b6fe6e8 100644 --- a/src/flash/nor/at91sam3.c +++ b/src/flash/nor/at91sam3.c @@ -8,19 +8,17 @@ * Copyright (C) 2011 by Olivier Schonken (at91sam3x* support) * * * and Jim Norris * * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General public License as published by * + * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the * - * GNU General public License for more details. * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * * * - * 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., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * ****************************************************************************/ /* Some of the the lower level code was based on code supplied by @@ -2177,7 +2175,7 @@ static int EFC_PerformCommand(struct sam3_bank_private *pPrivate, int r; uint32_t v; - long long ms_now, ms_end; + int64_t ms_now, ms_end; /* default */ if (status) @@ -3119,6 +3117,22 @@ FLASH_BANK_COMMAND_HANDLER(sam3_flash_bank_command) return ERROR_OK; } +/** + * Remove all chips from the internal list without distingushing which one + * is owned by this bank. This simplification works only for one shot + * deallocation like current flash_free_all_banks() + */ +void sam3_free_driver_priv(struct flash_bank *bank) +{ + struct sam3_chip *chip = all_sam3_chips; + while (chip) { + struct sam3_chip *next = chip->next; + free(chip); + chip = next; + } + all_sam3_chips = NULL; +} + static int sam3_GetDetails(struct sam3_bank_private *pPrivate) { const struct sam3_chip_details *pDetails; @@ -3773,4 +3787,5 @@ struct flash_driver at91sam3_flash = { .auto_probe = sam3_auto_probe, .erase_check = sam3_erase_check, .protect_check = sam3_protect_check, + .free_driver_priv = sam3_free_driver_priv, };