jtag: linuxgpiod: drop extra parenthesis
[openocd.git] / src / flash / nor / aducm360.c
index 7663783478f522472112ffac5529e973e3c392de..ce9bf24453c56b2bd8e579b2c87160a530341058 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /***************************************************************************
  *   Copyright (C) 2015 by Ivan Buliev                                     *
  *   i.buliev@mikrosistemi.com                                             *
- *                                                                         *
- *   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  *
- *   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.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
 /***************************************************************************
@@ -85,13 +74,12 @@ FLASH_BANK_COMMAND_HANDLER(aducm360_flash_bank_command)
 /* ----------------------------------------------------------------------- */
 static int aducm360_build_sector_list(struct flash_bank *bank)
 {
-       int i = 0;
        uint32_t offset = 0;
 
        /* sector size is 512 */
        bank->num_sectors = bank->size / FLASH_SECTOR_SIZE;
        bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
-       for (i = 0; i < bank->num_sectors; ++i) {
+       for (unsigned i = 0; i < bank->num_sectors; ++i) {
                bank->sectors[i].offset = offset;
                bank->sectors[i].size = FLASH_SECTOR_SIZE;
                offset += bank->sectors[i].size;
@@ -164,7 +152,8 @@ static int aducm360_page_erase(struct target *target, uint32_t padd)
 }
 
 /* ----------------------------------------------------------------------- */
-static int aducm360_erase(struct flash_bank *bank, int first, int last)
+static int aducm360_erase(struct flash_bank *bank, unsigned int first,
+               unsigned int last)
 {
        int             res = ERROR_OK;
        int             i;
@@ -285,7 +274,7 @@ static int aducm360_write_block_sync(
 
                res = buf_get_u32(reg_params[4].value, 0, 32);
                if (res) {
-                       LOG_ERROR("aducm360 fast sync algorithm reports an error (%02X)", res);
+                       LOG_ERROR("aducm360 fast sync algorithm reports an error (%02" PRIX32 ")", res);
                        retval = ERROR_FAIL;
                        break;
                }
@@ -401,7 +390,7 @@ static int aducm360_write_block_async(
        } else {
                res = buf_get_u32(reg_params[4].value, 0, 32);  /*RESULT*/
                if (res) {
-                       LOG_ERROR("aducm360 fast async algorithm reports an error (%02X)", res);
+                       LOG_ERROR("aducm360 fast async algorithm reports an error (%02" PRIX32 ")", res);
                        retval = ERROR_FAIL;
                }
        }
@@ -434,10 +423,8 @@ static int aducm360_write_block(struct flash_bank *bank,
        switch (choice) {
        case 0:
                return aducm360_write_block_sync(bank, buffer, offset, count);
-               break;
        case 1:
                return aducm360_write_block_async(bank, buffer, offset, count);
-               break;
        default:
                LOG_ERROR("aducm360_write_block was cancelled (no writing method was chosen)!");
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
@@ -554,7 +541,7 @@ static int aducm360_check_flash_completion(struct target *target, unsigned int t
 }
 
 /* ----------------------------------------------------------------------- */
-struct flash_driver aducm360_flash = {
+const struct flash_driver aducm360_flash = {
        .name = "aducm360",
        .flash_bank_command = aducm360_flash_bank_command,
        .erase = aducm360_erase,

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)