This is an automated email from Gerrit.

Tomas Vanek ([email protected]) just uploaded a new patch set to Gerrit, which you 
can find at http://openocd.zylin.com/4772

-- gerrit

commit 1f2438cc819032d8131309440f0fbd0852815dab
Author: Tomas Vanek <[email protected]>
Date:   Sun Nov 18 17:14:41 2018 +0100

    flash/nor/core.h: add driver_priv_u32
    
    Some flash drivers misuse bank_number in struct flash_bank as the number
    of the flash bank in the handled chip. See nrf5.c, msp432.c
    It does not work in a multitarget configuration.
    
    If the driver needs some chip related info and also some additional
    info for each flash bank, a multitarget proof implementation is complicated.
    See kinetis.c, at91sam4.c
    
    Additional driver_priv_u32 variable allows the driver to store
    chip related index of the flash bank instance and driver_priv
    may point directly to a chip info.
    
    While on it clarify the comment for bank_number.
    
    Change-Id: I5fced54ecb2415f414d309ef26decc8bf0811f01
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h
index 0c73fa1..270426b 100644
--- a/src/flash/nor/core.h
+++ b/src/flash/nor/core.h
@@ -93,7 +93,20 @@ struct flash_bank {
        struct flash_driver *driver; /**< Driver for this bank. */
        void *driver_priv; /**< Private driver storage pointer */
 
-       int bank_number; /**< The 'bank' (or chip number) of this instance. */
+       /** Additional variable for private driver use.
+        * If driver_priv points to the chip related structure
+        * and the chip has more than one flash bank,
+        * use driver_priv_u32 as a flash bank index or ID */
+       uint32_t driver_priv_u32;
+
+       /** The 'bank' number of this instance.
+        * WARNING: The numbering is global to all targets configured in 
OpenOCD.
+        * Be aware this number may not correspond to the numbering of flash
+        * bank instances of the chip.
+        * Use driver_priv_u32 for chip related flash bank numbering.
+        * Do not change bank_number in the flash driver */
+       int bank_number;
+
        uint32_t base; /**< The base address of this bank */
        uint32_t size; /**< The size of this chip bank, in bytes */
 

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to