X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fcore.h;h=8f7dce882d267b07afef52d7a788bf90eff73550;hb=09a0a69c09022258a00b3971fe708067d9977402;hp=a35f64f68fb685a48630884e9367c963677849c1;hpb=bc8be110ff314cab0e09792a05b6871672c18302;p=openocd.git diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h index a35f64f68f..8f7dce882d 100644 --- a/src/flash/nor/core.h +++ b/src/flash/nor/core.h @@ -74,7 +74,7 @@ struct flash_sector */ struct flash_bank { - char *name; + const char *name; struct target *target; /**< Target to which this bank belongs. */ @@ -168,9 +168,17 @@ int default_flash_mem_blank_check(struct flash_bank *bank); * bank number: when two str9x banks are defined, then 'str9x.1' refers * to the second. */ -struct flash_bank *get_flash_bank_by_name(const char *name); +int get_flash_bank_by_name(const char *name, struct flash_bank **bank_result); /** - * Returns a flash bank by the specified flash_bank_s bank_number, @a num. + * Returns the flash bank specified by @a name, which matches the + * driver name and a suffix (option) specify the driver-specific + * bank number. The suffix consists of the '.' and the driver-specific + * bank number: when two str9x banks are defined, then 'str9x.1' refers + * to the second. + */ +struct flash_bank *get_flash_bank_by_name_noprobe(const char *name); +/** + * Returns the flash bank like get_flash_bank_by_name(), without probing. * @param num The flash bank number. * @param bank returned bank if fn returns ERROR_OK * @returns ERROR_OK if successful @@ -198,8 +206,9 @@ struct flash_bank *get_flash_bank_by_num_noprobe(int num); * Returns the flash bank located at a specified address. * @param target The target, presumed to contain one or more banks. * @param addr An address that is within the range of the bank. + * @param check return ERROR_OK and result_bank NULL if the bank does not exist * @returns The struct flash_bank located at @a addr, or NULL. */ -struct flash_bank *get_flash_bank_by_addr(struct target *target, uint32_t addr); +int get_flash_bank_by_addr(struct target *target, uint32_t addr, bool check, struct flash_bank **result_bank); #endif // FLASH_NOR_CORE_H