openocd: fix SPDX tag format for files .c
[fw/openocd] / src / target / avr32_jtag.c
index c88f44e800f9286df15daf839cc28c2bec15836c..a9c4f8dd64fbf3cf0222a2cd9a0e83bb3a8a68ee 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
@@ -22,7 +9,6 @@
 #endif
 
 #include "target.h"
-#include "helper/types.h"
 #include "jtag/jtag.h"
 #include "avr32_jtag.h"
 
@@ -32,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;
@@ -58,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];
@@ -95,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)
 {
 
@@ -132,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)
 {
 
@@ -176,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];
@@ -230,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)
 {
 
@@ -267,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)
 {
 
@@ -376,4 +358,3 @@ int avr32_ocd_clearbits(struct avr32_jtag *jtag, int reg, uint32_t bits)
 
        return ERROR_OK;
 }
-