openocd: src/target: replace the GPL-2.0-or-later license tag
[fw/openocd] / src / target / avr32_jtag.c
index a363c70857b0deaa62fd20ffcfb5f01597e0ab11..6f46b00454849cbfc6b1602af90bc2e7da41ad33 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
 /***************************************************************************
  *   Copyright (C) 2010 by Oleksandr Tymoshenko <gonzo@bluezbox.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, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -31,13 +18,13 @@ static int avr32_jtag_set_instr(struct avr32_jtag *jtag_info, int new_instr)
        int busy = 0;
 
        tap = jtag_info->tap;
-       if (tap == NULL)
+       if (!tap)
                return ERROR_FAIL;
 
        if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != (uint32_t)new_instr) {
                do {
                        struct scan_field field;
-                       uint8_t t[4];
+                       uint8_t t[4] = { 0 };
                        uint8_t ret[4];
 
                        field.num_bits = tap->ir_length;
@@ -57,7 +44,7 @@ static int avr32_jtag_set_instr(struct avr32_jtag *jtag_info, int new_instr)
        return ERROR_OK;
 }
 
-int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info,
+static int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info,
                uint32_t addr, int mode)
 {
        struct scan_field fields[2];
@@ -94,7 +81,7 @@ int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info,
 }
 
 
-int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info,
+static int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info,
        uint32_t *pdata)
 {
 
@@ -131,7 +118,7 @@ int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info,
        return ERROR_OK;
 }
 
-int avr32_jtag_nexus_write_data(struct avr32_jtag *jtag_info,
+static int avr32_jtag_nexus_write_data(struct avr32_jtag *jtag_info,
                uint32_t data)
 {
 
@@ -175,22 +162,18 @@ int avr32_jtag_nexus_read(struct avr32_jtag *jtag_info,
 {
        avr32_jtag_set_instr(jtag_info, AVR32_INST_NEXUS_ACCESS);
        avr32_jtag_nexus_set_address(jtag_info, addr, MODE_READ);
-       avr32_jtag_nexus_read_data(jtag_info, value);
-
-       return ERROR_OK;
-
+       return avr32_jtag_nexus_read_data(jtag_info, value);
 }
+
 int avr32_jtag_nexus_write(struct avr32_jtag *jtag_info,
                uint32_t addr, uint32_t value)
 {
        avr32_jtag_set_instr(jtag_info, AVR32_INST_NEXUS_ACCESS);
        avr32_jtag_nexus_set_address(jtag_info, addr, MODE_WRITE);
-       avr32_jtag_nexus_write_data(jtag_info, value);
-
-       return ERROR_OK;
+       return avr32_jtag_nexus_write_data(jtag_info, value);
 }
 
-int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave,
+static int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave,
                uint32_t addr, int mode)
 {
        struct scan_field fields[2];
@@ -229,7 +212,7 @@ int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave,
        return ERROR_OK;
 }
 
-int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info,
+static int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info,
        uint32_t *pdata)
 {
 
@@ -266,7 +249,7 @@ int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info,
        return ERROR_OK;
 }
 
-int avr32_jtag_mwa_write_data(struct avr32_jtag *jtag_info,
+static int avr32_jtag_mwa_write_data(struct avr32_jtag *jtag_info,
        uint32_t data)
 {
 
@@ -375,4 +358,3 @@ int avr32_ocd_clearbits(struct avr32_jtag *jtag, int reg, uint32_t bits)
 
        return ERROR_OK;
 }
-