flash/stm32l4x: add support of STM32WB1x
[openocd.git] / src / flash / nor / lpc2900.c
index af8bba092b9d65aa895a18d4d3fc914a87607547..4bf52974b6cf8fab5411af005e6d0a76797b81f7 100644 (file)
@@ -49,8 +49,8 @@
 #define FTCTR           0x2020000C     /* Flash test control */
 #define FBWST           0x20200010     /* Flash bridge wait-state */
 #define FCRA            0x2020001C     /* Flash clock divider */
-#define FMSSTART        0x20200020     /* Flash Built-In Selft Test start address */
-#define FMSSTOP         0x20200024     /* Flash Built-In Selft Test stop address */
+#define FMSSTART        0x20200020     /* Flash Built-In Self Test start address */
+#define FMSSTOP         0x20200024     /* Flash Built-In Self Test stop address */
 #define FMS16           0x20200028     /* Flash 16-bit signature */
 #define FMSW0           0x2020002C     /* Flash 128-bit signature Word 0 */
 #define FMSW1           0x20200030     /* Flash 128-bit signature Word 1 */
@@ -160,7 +160,7 @@ struct lpc2900_flash_bank {
 
        /**
         * Maximum contiguous block of internal SRAM (bytes).
-        * Autodetected by the driver. Not the total amount of SRAM, only the
+        * Autodetected by the driver. Not the total amount of SRAM, only
         * the largest \em contiguous block!
         */
        uint32_t max_ram_block;
@@ -174,7 +174,7 @@ static uint32_t lpc2900_read_security_status(struct flash_bank *bank);
 static uint32_t lpc2900_run_bist128(struct flash_bank *bank,
                uint32_t addr_from, uint32_t addr_to,
                uint32_t signature[4]);
-static uint32_t lpc2900_address2sector(struct flash_bank *bank, uint32_t offset);
+static unsigned int lpc2900_address2sector(struct flash_bank *bank, uint32_t offset);
 static uint32_t lpc2900_calc_tr(uint32_t clock_var, uint32_t time_var);
 
 /***********************  Helper functions  **************************/
@@ -453,8 +453,8 @@ static int lpc2900_write_index_page(struct flash_bank *bank,
 /**
  * Calculate FPTR.TR register value for desired program/erase time.
  *
- * @param clock System clock in Hz
- * @param time Program/erase time in µs
+ * @param clock_var System clock in Hz
+ * @param time_var Program/erase time in µs
  */
 static uint32_t lpc2900_calc_tr(uint32_t clock_var, uint32_t time_var)
 {
@@ -487,7 +487,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command)
 
        struct flash_bank *bank;
        int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
-       if (ERROR_OK != retval)
+       if (retval != ERROR_OK)
                return retval;
 
        if (bank->target->state != TARGET_HALTED) {
@@ -522,7 +522,7 @@ COMMAND_HANDLER(lpc2900_handle_read_custom_command)
 
        struct flash_bank *bank;
        int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
-       if (ERROR_OK != retval)
+       if (retval != ERROR_OK)
                return retval;
 
        struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
@@ -584,7 +584,7 @@ COMMAND_HANDLER(lpc2900_handle_password_command)
 
        struct flash_bank *bank;
        int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
-       if (ERROR_OK != retval)
+       if (retval != ERROR_OK)
                return retval;
 
        struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
@@ -614,7 +614,7 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command)
 
        struct flash_bank *bank;
        int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
-       if (ERROR_OK != retval)
+       if (retval != ERROR_OK)
                return retval;
 
        struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
@@ -635,9 +635,9 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command)
 
        /* The image will always start at offset 0 */
        struct image image;
-       image.base_address_set = 1;
+       image.base_address_set = true;
        image.base_address = 0;
-       image.start_address_set = 0;
+       image.start_address_set = false;
 
        const char *filename = CMD_ARGV[1];
        const char *type = (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL;
@@ -713,7 +713,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
        /* Get the bank descriptor */
        struct flash_bank *bank;
        int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
-       if (ERROR_OK != retval)
+       if (retval != ERROR_OK)
                return retval;
 
        struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
@@ -794,7 +794,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command)
        /* Get the bank descriptor */
        struct flash_bank *bank;
        int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
-       if (ERROR_OK != retval)
+       if (retval != ERROR_OK)
                return retval;
 
        struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
@@ -1535,7 +1535,7 @@ static int lpc2900_erase_check(struct flash_bank *bank)
                return status;
        }
 
-       /* Use the BIST (Built-In Selft Test) to generate a signature of each flash
+       /* Use the BIST (Built-In Self Test) to generate a signature of each flash
         * sector. Compare against the expected signature of an empty sector.
         */
        for (unsigned int sector = 0; sector < bank->num_sectors; sector++) {

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)