Merge pull request #1163 from en-sc/en-sc/from_upstream

Merge up to fd62626dff from  upstream
This commit is contained in:
Evgeniy Naydanov 2024-11-18 13:16:18 +03:00 committed by GitHub
commit c53f9319c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
220 changed files with 1425 additions and 1156 deletions

3
.gitignore vendored
View File

@ -84,6 +84,9 @@ patches
.cproject .cproject
.settings .settings
# VSCode stuff
.vscode
# Emacs temp files # Emacs temp files
*~ *~

View File

@ -313,6 +313,13 @@ Only for <em>exceptional cases</em>, it is allowed to submit patches
to Gerrit with the special field 'Checkpatch-ignore:' in the commit to Gerrit with the special field 'Checkpatch-ignore:' in the commit
message. This field will cause checkpatch to ignore the error types message. This field will cause checkpatch to ignore the error types
listed in the field, only for the patch itself. listed in the field, only for the patch itself.
For errors in the commit message, the special field has to be put in
the commit message before the line that produces the error.
The special field must be added <em>before</em> the 'Signed-off-by:'
line, otherwise it is ignored.
To ignore multiple errors, either add multiple lines with the special
field or add multiple error types, separated by space or commas, in a
single line.
The error type is printed by checkpatch on failure. The error type is printed by checkpatch on failure.
For example the names of Windows APIs mix lower and upper case chars, For example the names of Windows APIs mix lower and upper case chars,
in violation of OpenOCD coding style, triggering a 'CAMELCASE' error: in violation of OpenOCD coding style, triggering a 'CAMELCASE' error:

View File

@ -104,12 +104,18 @@ AS_IF([test -x "$srcdir/guess-rev.sh"], [
AC_MSG_RESULT([$build_release]) AC_MSG_RESULT([$build_release])
# Adapter drivers # Adapter drivers
# 1st column -- configure option # 1st column -- Basename for the configure option generated with AC_ARG_ENABLE.
# 2nd column -- description # For example, "buspirate" generates options "--enable-buspirate[=yes/no]"
# 3rd column -- symbol used for both config.h and automake # and "--disable-buspirate".
# 2nd column -- Description for the configure option. For example, "Bus Pirate"
# generates "Enable building support for the Bus Pirate (default is auto)".
# 3rd column -- Basename for the config.h and Automake symbols.
# For example, basename "BUS_PIRATE" generates "BUILD_BUS_PIRATE" with AC_DEFINE
# for config.h and "BUS_PIRATE" with AM_CONDITIONAL for Automake.
m4_define([ADAPTER_ARG], [m4_argn([1], $1)]) m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
m4_define([ADAPTER_DESC], [m4_argn([2], $1)]) m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
m4_define([ADAPTER_SYM], [m4_argn([3], $1)]) m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
# AC_ARG_ENABLE uses prefix "enable_" to name the corresponding option variable.
m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)]) m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])]) m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
@ -265,6 +271,7 @@ AC_ARG_ADAPTERS([
LIBFTDI_USB1_ADAPTERS LIBFTDI_USB1_ADAPTERS
LIBGPIOD_ADAPTERS, LIBGPIOD_ADAPTERS,
SERIAL_PORT_ADAPTERS, SERIAL_PORT_ADAPTERS,
PCIE_ADAPTERS,
LIBJAYLINK_ADAPTERS LIBJAYLINK_ADAPTERS
],[auto]) ],[auto])
@ -341,12 +348,10 @@ AC_ARG_ENABLE([sysfsgpio],
AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]), AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
[build_sysfsgpio=$enableval], [build_sysfsgpio=no]) [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
AC_ARG_ENABLE([xlnx_pcie_xvc],
AS_HELP_STRING([--enable-xlnx-pcie-xvc], [Enable building support for Xilinx XVC/PCIe.]),
[build_xlnx_pcie_xvc=$enableval], [build_xlnx_pcie_xvc=no])
AS_CASE([$host_os], AS_CASE([$host_os],
[linux*], [], [linux*], [
is_linux=yes
],
[ [
AS_IF([test "x$build_sysfsgpio" = "xyes"], [ AS_IF([test "x$build_sysfsgpio" = "xyes"], [
AC_MSG_ERROR([sysfsgpio is only available on linux]) AC_MSG_ERROR([sysfsgpio is only available on linux])
@ -356,10 +361,6 @@ AS_CASE([$host_os],
AC_MSG_ERROR([linuxgpiod is only available on linux]) AC_MSG_ERROR([linuxgpiod is only available on linux])
]) ])
AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
AC_MSG_ERROR([xlnx_pcie_xvc is only available on linux])
])
AS_CASE([$host_os], [freebsd*], [], AS_CASE([$host_os], [freebsd*], [],
[ [
AS_IF([test "x$build_rshim" = "xyes"], [ AS_IF([test "x$build_rshim" = "xyes"], [
@ -620,13 +621,6 @@ AS_IF([test "x$build_sysfsgpio" = "xyes"], [
AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.]) AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
]) ])
AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
build_xlnx_pcie_xvc=yes
AC_DEFINE([BUILD_XLNX_PCIE_XVC], [1], [1 if you want the Xilinx XVC/PCIe driver.])
], [
AC_DEFINE([BUILD_XLNX_PCIE_XVC], [0], [0 if you don't want Xilinx XVC/PCIe driver.])
])
PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [ PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
use_libusb1=yes use_libusb1=yes
AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x]) AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
@ -688,11 +682,11 @@ PKG_CHECK_MODULES([LIBGPIOD], [libgpiod < 2.0], [
PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2], PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2],
[use_libjaylink=yes], [use_libjaylink=no]) [use_libjaylink=yes], [use_libjaylink=no])
# Arg $1: The adapter name, used to derive option and variable names for the adapter. # Arg $1: An array of adapter triplets, used to derive option and variable names for each adapter.
# Arg $2: Whether the adapter can be enabled, for example, because # Arg $2: Whether the adapters can be enabled, for example, because
# its prerequisites are installed in the system. # their prerequisites are installed in the system.
# Arg $3: What prerequisites are missing, to be shown in an error message # Arg $3: What prerequisites are missing, to be shown in an error message
# if the adapter was requested but cannot be enabled. # if an adapter was requested but cannot be enabled.
m4_define([PROCESS_ADAPTERS], [ m4_define([PROCESS_ADAPTERS], [
m4_foreach([adapter], [$1], [ m4_foreach([adapter], [$1], [
AS_IF([test $2], [ AS_IF([test $2], [
@ -703,7 +697,7 @@ m4_define([PROCESS_ADAPTERS], [
]) ])
], [ ], [
AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [ AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [
AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])]) AC_MSG_ERROR([$3 is required for [adapter] ADAPTER_DESC([adapter]).])
]) ])
ADAPTER_VAR([adapter])=no ADAPTER_VAR([adapter])=no
AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).) AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
@ -719,6 +713,7 @@ PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x]) PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x])
PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [libgpiod]) PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [libgpiod])
PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2]) PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
PROCESS_ADAPTERS([PCIE_ADAPTERS], ["x$is_linux" = "xyes"], [Linux build])
PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused]) PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])
AS_IF([test "x$enable_linuxgpiod" != "xno"], [ AS_IF([test "x$enable_linuxgpiod" != "xno"], [
@ -775,7 +770,6 @@ AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"]) AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
AM_CONDITIONAL([BUSPIRATE], [test "x$enable_buspirate" != "xno"]) AM_CONDITIONAL([BUSPIRATE], [test "x$enable_buspirate" != "xno"])
AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"]) AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
AM_CONDITIONAL([XLNX_PCIE_XVC], [test "x$build_xlnx_pcie_xvc" = "xyes"])
AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"]) AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"]) AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"]) AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])

View File

@ -43,9 +43,9 @@ unsigned int dump_swit;
* NOTE that this specific encoding could be space-optimized; and that * NOTE that this specific encoding could be space-optimized; and that
* trace data streams could also be history-sensitive. * trace data streams could also be history-sensitive.
*/ */
static void show_task(int port, unsigned data) static void show_task(int port, unsigned int data)
{ {
unsigned code = data >> 16; unsigned int code = data >> 16;
char buf[16]; char buf[16];
if (dump_swit) if (dump_swit)
@ -77,7 +77,7 @@ static void show_task(int port, unsigned data)
static void show_reserved(FILE *f, char *label, int c) static void show_reserved(FILE *f, char *label, int c)
{ {
unsigned i; unsigned int i;
if (dump_swit) if (dump_swit)
return; return;
@ -96,9 +96,9 @@ static void show_reserved(FILE *f, char *label, int c)
printf("\n"); printf("\n");
} }
static bool read_varlen(FILE *f, int c, unsigned *value) static bool read_varlen(FILE *f, int c, unsigned int *value)
{ {
unsigned size; unsigned int size;
unsigned char buf[4]; unsigned char buf[4];
*value = 0; *value = 0;
@ -135,8 +135,8 @@ err:
static void show_hard(FILE *f, int c) static void show_hard(FILE *f, int c)
{ {
unsigned type = c >> 3; unsigned int type = c >> 3;
unsigned value; unsigned int value;
char *label; char *label;
if (dump_swit) if (dump_swit)
@ -230,16 +230,16 @@ static void show_hard(FILE *f, int c)
*/ */
struct { struct {
int port; int port;
void (*show)(int port, unsigned data); void (*show)(int port, unsigned int data);
} format[] = { } format[] = {
{ .port = 31, .show = show_task, }, { .port = 31, .show = show_task, },
}; };
static void show_swit(FILE *f, int c) static void show_swit(FILE *f, int c)
{ {
unsigned port = c >> 3; unsigned int port = c >> 3;
unsigned value = 0; unsigned int value = 0;
unsigned i; unsigned int i;
if (port + 1 == dump_swit) { if (port + 1 == dump_swit) {
if (!read_varlen(f, c, &value)) if (!read_varlen(f, c, &value))
@ -272,7 +272,7 @@ static void show_swit(FILE *f, int c)
static void show_timestamp(FILE *f, int c) static void show_timestamp(FILE *f, int c)
{ {
unsigned counter = 0; unsigned int counter = 0;
char *label = ""; char *label = "";
bool delayed = false; bool delayed = false;

View File

@ -103,7 +103,7 @@ static void fespi_disable_hw_mode(volatile uint32_t *ctrl_base);
static void fespi_enable_hw_mode(volatile uint32_t *ctrl_base); static void fespi_enable_hw_mode(volatile uint32_t *ctrl_base);
static int fespi_wip(volatile uint32_t *ctrl_base); static int fespi_wip(volatile uint32_t *ctrl_base);
static int fespi_write_buffer(volatile uint32_t *ctrl_base, static int fespi_write_buffer(volatile uint32_t *ctrl_base,
const uint8_t *buffer, unsigned offset, unsigned len, const uint8_t *buffer, unsigned int offset, unsigned int len,
uint32_t flash_info); uint32_t flash_info);
/* Can set bits 3:0 in result. */ /* Can set bits 3:0 in result. */
@ -113,7 +113,7 @@ static int fespi_write_buffer(volatile uint32_t *ctrl_base,
* after pprog_cmd * after pprog_cmd
*/ */
int flash_fespi(volatile uint32_t *ctrl_base, uint32_t page_size, int flash_fespi(volatile uint32_t *ctrl_base, uint32_t page_size,
const uint8_t *buffer, unsigned offset, uint32_t count, const uint8_t *buffer, unsigned int offset, uint32_t count,
uint32_t flash_info) uint32_t flash_info)
{ {
int result; int result;
@ -163,12 +163,12 @@ err:
return result; return result;
} }
static uint32_t fespi_read_reg(volatile uint32_t *ctrl_base, unsigned address) static uint32_t fespi_read_reg(volatile uint32_t *ctrl_base, unsigned int address)
{ {
return ctrl_base[address / 4]; return ctrl_base[address / 4];
} }
static void fespi_write_reg(volatile uint32_t *ctrl_base, unsigned address, uint32_t value) static void fespi_write_reg(volatile uint32_t *ctrl_base, unsigned int address, uint32_t value)
{ {
ctrl_base[address / 4] = value; ctrl_base[address / 4] = value;
} }
@ -188,7 +188,7 @@ static void fespi_enable_hw_mode(volatile uint32_t *ctrl_base)
/* Can set bits 7:4 in result. */ /* Can set bits 7:4 in result. */
static int fespi_txwm_wait(volatile uint32_t *ctrl_base) static int fespi_txwm_wait(volatile uint32_t *ctrl_base)
{ {
unsigned timeout = TIMEOUT; unsigned int timeout = TIMEOUT;
while (timeout--) { while (timeout--) {
uint32_t ip = fespi_read_reg(ctrl_base, FESPI_REG_IP); uint32_t ip = fespi_read_reg(ctrl_base, FESPI_REG_IP);
@ -209,7 +209,7 @@ static void fespi_set_dir(volatile uint32_t *ctrl_base, bool dir)
/* Can set bits 11:8 in result. */ /* Can set bits 11:8 in result. */
static int fespi_tx(volatile uint32_t *ctrl_base, uint8_t in) static int fespi_tx(volatile uint32_t *ctrl_base, uint8_t in)
{ {
unsigned timeout = TIMEOUT; unsigned int timeout = TIMEOUT;
while (timeout--) { while (timeout--) {
uint32_t txfifo = fespi_read_reg(ctrl_base, FESPI_REG_TXFIFO); uint32_t txfifo = fespi_read_reg(ctrl_base, FESPI_REG_TXFIFO);
@ -224,7 +224,7 @@ static int fespi_tx(volatile uint32_t *ctrl_base, uint8_t in)
/* Can set bits 15:12 in result. */ /* Can set bits 15:12 in result. */
static int fespi_rx(volatile uint32_t *ctrl_base, uint8_t *out) static int fespi_rx(volatile uint32_t *ctrl_base, uint8_t *out)
{ {
unsigned timeout = TIMEOUT; unsigned int timeout = TIMEOUT;
while (timeout--) { while (timeout--) {
uint32_t value = fespi_read_reg(ctrl_base, FESPI_REG_RXFIFO); uint32_t value = fespi_read_reg(ctrl_base, FESPI_REG_RXFIFO);
@ -252,7 +252,7 @@ static int fespi_wip(volatile uint32_t *ctrl_base)
if (result != ERROR_OK) if (result != ERROR_OK)
return result | ERROR_STACK(0x20000); return result | ERROR_STACK(0x20000);
unsigned timeout = TIMEOUT; unsigned int timeout = TIMEOUT;
while (timeout--) { while (timeout--) {
result = fespi_tx(ctrl_base, 0); result = fespi_tx(ctrl_base, 0);
if (result != ERROR_OK) if (result != ERROR_OK)
@ -273,7 +273,7 @@ static int fespi_wip(volatile uint32_t *ctrl_base)
/* Can set bits 23:20 in result. */ /* Can set bits 23:20 in result. */
static int fespi_write_buffer(volatile uint32_t *ctrl_base, static int fespi_write_buffer(volatile uint32_t *ctrl_base,
const uint8_t *buffer, unsigned offset, unsigned len, const uint8_t *buffer, unsigned int offset, unsigned int len,
uint32_t flash_info) uint32_t flash_info)
{ {
int result = fespi_tx(ctrl_base, SPIFLASH_WRITE_ENABLE); int result = fespi_tx(ctrl_base, SPIFLASH_WRITE_ENABLE);
@ -304,7 +304,7 @@ static int fespi_write_buffer(volatile uint32_t *ctrl_base,
if (result != ERROR_OK) if (result != ERROR_OK)
return result | ERROR_STACK(0x600000); return result | ERROR_STACK(0x600000);
for (unsigned i = 0; i < len; i++) { for (unsigned int i = 0; i < len; i++) {
result = fespi_tx(ctrl_base, buffer[i]); result = fespi_tx(ctrl_base, buffer[i]);
if (result != ERROR_OK) if (result != ERROR_OK)
return result | ERROR_STACK(0x700000); return result | ERROR_STACK(0x700000);

View File

@ -2489,7 +2489,7 @@ This command is only available if your libusb1 is at least version 1.0.16.
Specifies the @var{serial_string} of the adapter to use. Specifies the @var{serial_string} of the adapter to use.
If this command is not specified, serial strings are not checked. If this command is not specified, serial strings are not checked.
Only the following adapter drivers use the serial string from this command: Only the following adapter drivers use the serial string from this command:
arm-jtag-ew, cmsis_dap, esp_usb_jtag, ft232r, ftdi, hla (stlink, ti-icdi), jlink, kitprog, opendus, arm-jtag-ew, cmsis_dap, esp_usb_jtag, ft232r, ftdi, hla (ti-icdi), jlink, kitprog, opendus,
openjtag, osbdm, presto, rlink, st-link, usb_blaster (ublast2), usbprog, vsllink, xds110. openjtag, osbdm, presto, rlink, st-link, usb_blaster (ublast2), usbprog, vsllink, xds110.
@end deffn @end deffn
@ -3235,7 +3235,7 @@ version reported is V2.J21.S4.
Currently Not Supported. Currently Not Supported.
@end deffn @end deffn
@deffn {Config Command} {hla layout} (@option{stlink}|@option{icdi}|@option{nulink}) @deffn {Config Command} {hla layout} (@option{icdi}|@option{nulink})
Specifies the adapter layout to use. Specifies the adapter layout to use.
@end deffn @end deffn
@ -3243,15 +3243,6 @@ Specifies the adapter layout to use.
Pairs of vendor IDs and product IDs of the device. Pairs of vendor IDs and product IDs of the device.
@end deffn @end deffn
@deffn {Config Command} {hla stlink_backend} (usb | tcp [port])
@emph{ST-Link only:} Choose between 'exclusive' USB communication (the default backend) or
'shared' mode using ST-Link TCP server (the default port is 7184).
@emph{Note:} ST-Link TCP server is a binary application provided by ST
available from @url{https://www.st.com/en/development-tools/st-link-server.html,
ST-LINK server software module}.
@end deffn
@deffn {Command} {hla command} command @deffn {Command} {hla command} command
Execute a custom adapter-specific command. The @var{command} string is Execute a custom adapter-specific command. The @var{command} string is
passed as is to the underlying adapter layout handler. passed as is to the underlying adapter layout handler.
@ -3261,9 +3252,12 @@ passed as is to the underlying adapter layout handler.
@anchor{st_link_dap_interface} @anchor{st_link_dap_interface}
@deffn {Interface Driver} {st-link} @deffn {Interface Driver} {st-link}
This is a driver that supports STMicroelectronics adapters ST-LINK/V2 This is a driver that supports STMicroelectronics adapters ST-LINK/V2
(from firmware V2J24), STLINK-V3 and STLINK-V3PWR, thanks to a new API that provides (from 2015 firmware V2J24), STLINK-V3 and STLINK-V3PWR, thanks to a new API that provides
directly access the arm ADIv5 DAP. directly access the arm ADIv5 DAP.
The older API that requires HLA transport is deprecated and will be dropped
from OpenOCD. In mean time it's still available by using @file{interface/stlink-hla.cfg}.
The new API provide access to multiple AP on the same DAP, but the The new API provide access to multiple AP on the same DAP, but the
maximum number of the AP port is limited by the specific firmware version maximum number of the AP port is limited by the specific firmware version
(e.g. firmware V2J29 has 3 as maximum AP number, while V2J32 has 8). (e.g. firmware V2J29 has 3 as maximum AP number, while V2J32 has 8).
@ -10706,7 +10700,7 @@ baud with our custom divisor to get 12MHz)
@item OpenOCD invocation line: @item OpenOCD invocation line:
@example @example
openocd -f interface/stlink.cfg \ openocd -f interface/stlink.cfg \
-c "transport select hla_swd" \ -c "transport select dapdirect_swd" \
-f target/stm32l1.cfg \ -f target/stm32l1.cfg \
-c "stm32l1.tpiu configure -protocol uart" \ -c "stm32l1.tpiu configure -protocol uart" \
-c "stm32l1.tpiu configure -traceclk 24000000 -pin-freq 12000000" \ -c "stm32l1.tpiu configure -traceclk 24000000 -pin-freq 12000000" \

2
jimtcl

@ -1 +1 @@
Subproject commit 1933e5457b9512d39ebbe11ed32578aada149f49 Subproject commit f160866171457474f7c4d6ccda70f9b77524407e

View File

@ -11,14 +11,14 @@
#include "common.h" #include "common.h"
#include <helper/log.h> #include <helper/log.h>
unsigned get_flash_name_index(const char *name) unsigned int get_flash_name_index(const char *name)
{ {
const char *name_index = strrchr(name, '.'); const char *name_index = strrchr(name, '.');
if (!name_index) if (!name_index)
return 0; return 0;
if (name_index[1] < '0' || name_index[1] > '9') if (name_index[1] < '0' || name_index[1] > '9')
return ~0U; return ~0U;
unsigned requested; unsigned int requested;
int retval = parse_uint(name_index + 1, &requested); int retval = parse_uint(name_index + 1, &requested);
/* detect parsing error by forcing past end of bank list */ /* detect parsing error by forcing past end of bank list */
return (retval == ERROR_OK) ? requested : ~0U; return (retval == ERROR_OK) ? requested : ~0U;
@ -26,7 +26,7 @@ unsigned get_flash_name_index(const char *name)
bool flash_driver_name_matches(const char *name, const char *expected) bool flash_driver_name_matches(const char *name, const char *expected)
{ {
unsigned blen = strlen(name); unsigned int blen = strlen(name);
/* only match up to the length of the driver name... */ /* only match up to the length of the driver name... */
if (strncmp(name, expected, blen) != 0) if (strncmp(name, expected, blen) != 0)
return false; return false;

View File

@ -17,7 +17,7 @@
* name provides a suffix but it does not parse as an unsigned integer, * name provides a suffix but it does not parse as an unsigned integer,
* the routine returns ~0U. This will prevent further matching. * the routine returns ~0U. This will prevent further matching.
*/ */
unsigned get_flash_name_index(const char *name); unsigned int get_flash_name_index(const char *name);
/** /**
* Attempt to match the @c expected name with the @c name of a driver. * Attempt to match the @c expected name with the @c name of a driver.
* @param name The name of the driver (from the bank's device structure). * @param name The name of the driver (from the bank's device structure).

View File

@ -31,12 +31,12 @@
* @return Success or failure of the operation * @return Success or failure of the operation
*/ */
static int arm_code_to_working_area(struct target *target, static int arm_code_to_working_area(struct target *target,
const uint32_t *code, unsigned code_size, const uint32_t *code, unsigned int code_size,
unsigned additional, struct working_area **area) unsigned int additional, struct working_area **area)
{ {
uint8_t code_buf[code_size]; uint8_t code_buf[code_size];
int retval; int retval;
unsigned size = code_size + additional; unsigned int size = code_size + additional;
/* REVISIT this assumes size doesn't ever change. /* REVISIT this assumes size doesn't ever change.
* That's usually correct; but there are boards with * That's usually correct; but there are boards with

View File

@ -27,7 +27,7 @@ struct arm_nand_data {
struct working_area *copy_area; struct working_area *copy_area;
/** The chunk size is the page size or ECC chunk. */ /** The chunk size is the page size or ECC chunk. */
unsigned chunk_size; unsigned int chunk_size;
/** Where data is read from or written to. */ /** Where data is read from or written to. */
uint32_t data; uint32_t data;

View File

@ -389,9 +389,8 @@ static int at91sam9_read_page(struct nand_device *nand, uint32_t page,
uint32_t bit = parity & 0x0F; uint32_t bit = parity & 0x0F;
data[word] ^= (0x1) << bit; data[word] ^= (0x1) << bit;
LOG_INFO("Data word %d, bit %d corrected.", LOG_INFO("Data word %" PRIu32 ", bit %" PRIu32 " corrected.",
(unsigned) word, word, bit);
(unsigned) bit);
} }
} }
@ -533,7 +532,7 @@ COMMAND_HANDLER(handle_at91sam9_cle_command)
{ {
struct nand_device *nand = NULL; struct nand_device *nand = NULL;
struct at91sam9_nand *info = NULL; struct at91sam9_nand *info = NULL;
unsigned num, address_line; unsigned int num, address_line;
if (CMD_ARGC != 2) { if (CMD_ARGC != 2) {
command_print(CMD, "incorrect number of arguments for 'at91sam9 cle' command"); command_print(CMD, "incorrect number of arguments for 'at91sam9 cle' command");
@ -563,7 +562,7 @@ COMMAND_HANDLER(handle_at91sam9_ale_command)
{ {
struct nand_device *nand = NULL; struct nand_device *nand = NULL;
struct at91sam9_nand *info = NULL; struct at91sam9_nand *info = NULL;
unsigned num, address_line; unsigned int num, address_line;
if (CMD_ARGC != 2) if (CMD_ARGC != 2)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -591,7 +590,7 @@ COMMAND_HANDLER(handle_at91sam9_rdy_busy_command)
{ {
struct nand_device *nand = NULL; struct nand_device *nand = NULL;
struct at91sam9_nand *info = NULL; struct at91sam9_nand *info = NULL;
unsigned num, base_pioc, pin_num; unsigned int num, base_pioc, pin_num;
if (CMD_ARGC != 3) if (CMD_ARGC != 3)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -622,7 +621,7 @@ COMMAND_HANDLER(handle_at91sam9_ce_command)
{ {
struct nand_device *nand = NULL; struct nand_device *nand = NULL;
struct at91sam9_nand *info = NULL; struct at91sam9_nand *info = NULL;
unsigned num, base_pioc, pin_num; unsigned int num, base_pioc, pin_num;
if (CMD_ARGC != 3) if (CMD_ARGC != 3)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;

View File

@ -165,8 +165,8 @@ static struct nand_ecclayout nand_oob_8 = {
*/ */
static struct nand_device *get_nand_device_by_name(const char *name) static struct nand_device *get_nand_device_by_name(const char *name)
{ {
unsigned requested = get_flash_name_index(name); unsigned int requested = get_flash_name_index(name);
unsigned found = 0; unsigned int found = 0;
struct nand_device *nand; struct nand_device *nand;
for (nand = nand_devices; nand; nand = nand->next) { for (nand = nand_devices; nand; nand = nand->next) {
@ -194,7 +194,7 @@ struct nand_device *get_nand_device_by_num(int num)
return NULL; return NULL;
} }
COMMAND_HELPER(nand_command_get_device, unsigned name_index, COMMAND_HELPER(nand_command_get_device, unsigned int name_index,
struct nand_device **nand) struct nand_device **nand)
{ {
const char *str = CMD_ARGV[name_index]; const char *str = CMD_ARGV[name_index];
@ -202,7 +202,7 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index,
if (*nand) if (*nand)
return ERROR_OK; return ERROR_OK;
unsigned num; unsigned int num;
COMMAND_PARSE_NUMBER(uint, str, num); COMMAND_PARSE_NUMBER(uint, str, num);
*nand = get_nand_device_by_num(num); *nand = get_nand_device_by_num(num);
if (!*nand) { if (!*nand) {

View File

@ -209,7 +209,7 @@ int nand_correct_data(struct nand_device *nand, u_char *dat,
int nand_register_commands(struct command_context *cmd_ctx); int nand_register_commands(struct command_context *cmd_ctx);
/** helper for parsing a nand device command argument string */ /** helper for parsing a nand device command argument string */
COMMAND_HELPER(nand_command_get_device, unsigned name_index, COMMAND_HELPER(nand_command_get_device, unsigned int name_index,
struct nand_device **nand); struct nand_device **nand);

View File

@ -379,7 +379,7 @@ static int davinci_writepage_tail(struct nand_device *nand,
static int davinci_write_page_ecc1(struct nand_device *nand, uint32_t page, static int davinci_write_page_ecc1(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{ {
unsigned oob_offset; unsigned int oob_offset;
struct davinci_nand *info = nand->controller_priv; struct davinci_nand *info = nand->controller_priv;
struct target *target = nand->target; struct target *target = nand->target;
const uint32_t fcr_addr = info->aemif + NANDFCR; const uint32_t fcr_addr = info->aemif + NANDFCR;

View File

@ -33,7 +33,7 @@ static struct nand_flash_controller *nand_flash_controllers[] = {
struct nand_flash_controller *nand_driver_find_by_name(const char *name) struct nand_flash_controller *nand_driver_find_by_name(const char *name)
{ {
for (unsigned i = 0; nand_flash_controllers[i]; i++) { for (unsigned int i = 0; nand_flash_controllers[i]; i++) {
struct nand_flash_controller *controller = nand_flash_controllers[i]; struct nand_flash_controller *controller = nand_flash_controllers[i];
if (strcmp(name, controller->name) == 0) if (strcmp(name, controller->name) == 0)
return controller; return controller;
@ -42,7 +42,7 @@ struct nand_flash_controller *nand_driver_find_by_name(const char *name)
} }
int nand_driver_walk(nand_driver_walker_t f, void *x) int nand_driver_walk(nand_driver_walker_t f, void *x)
{ {
for (unsigned i = 0; nand_flash_controllers[i]; i++) { for (unsigned int i = 0; nand_flash_controllers[i]; i++) {
int retval = (*f)(nand_flash_controllers[i], x); int retval = (*f)(nand_flash_controllers[i], x);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;

View File

@ -107,7 +107,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
{ {
nand_fileio_init(state); nand_fileio_init(state);
unsigned minargs = need_size ? 4 : 3; unsigned int minargs = need_size ? 4 : 3;
if (minargs > CMD_ARGC) if (minargs > CMD_ARGC)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -131,7 +131,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
} }
if (minargs < CMD_ARGC) { if (minargs < CMD_ARGC) {
for (unsigned i = minargs; i < CMD_ARGC; i++) { for (unsigned int i = minargs; i < CMD_ARGC; i++) {
if (!strcmp(CMD_ARGV[i], "oob_raw")) if (!strcmp(CMD_ARGV[i], "oob_raw"))
state->oob_format |= NAND_OOB_RAW; state->oob_format |= NAND_OOB_RAW;
else if (!strcmp(CMD_ARGV[i], "oob_only")) else if (!strcmp(CMD_ARGV[i], "oob_only"))

View File

@ -890,8 +890,7 @@ static int lpc3180_read_page(struct nand_device *nand,
if (mlc_isr & 0x8) { if (mlc_isr & 0x8) {
if (mlc_isr & 0x40) { if (mlc_isr & 0x40) {
LOG_ERROR("uncorrectable error detected: 0x%2.2x", LOG_ERROR("uncorrectable error detected: 0x%2.2" PRIx32, mlc_isr);
(unsigned)mlc_isr);
free(page_buffer); free(page_buffer);
free(oob_buffer); free(oob_buffer);
return ERROR_NAND_OPERATION_FAILED; return ERROR_NAND_OPERATION_FAILED;
@ -1275,7 +1274,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
if ((CMD_ARGC < 1) || (CMD_ARGC > 3)) if ((CMD_ARGC < 1) || (CMD_ARGC > 3))
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num; unsigned int num;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
struct nand_device *nand = get_nand_device_by_num(num); struct nand_device *nand = get_nand_device_by_num(num);
if (!nand) { if (!nand) {

View File

@ -1386,8 +1386,7 @@ static int lpc32xx_read_page_mlc(struct nand_device *nand, uint32_t page,
if (mlc_isr & 0x8) { if (mlc_isr & 0x8) {
if (mlc_isr & 0x40) { if (mlc_isr & 0x40) {
LOG_ERROR("uncorrectable error detected: " LOG_ERROR("uncorrectable error detected: 0x%2.2" PRIx32, mlc_isr);
"0x%2.2x", (unsigned)mlc_isr);
return ERROR_NAND_OPERATION_FAILED; return ERROR_NAND_OPERATION_FAILED;
} }
@ -1743,7 +1742,7 @@ COMMAND_HANDLER(handle_lpc32xx_select_command)
if ((CMD_ARGC < 1) || (CMD_ARGC > 3)) if ((CMD_ARGC < 1) || (CMD_ARGC > 3))
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num; unsigned int num;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
struct nand_device *nand = get_nand_device_by_num(num); struct nand_device *nand = get_nand_device_by_num(num);
if (!nand) { if (!nand) {

View File

@ -86,10 +86,10 @@ enum mx_nf_finalize_action {
}; };
struct mx3_nf_flags { struct mx3_nf_flags {
unsigned target_little_endian:1; unsigned int target_little_endian:1;
unsigned nand_readonly:1; unsigned int nand_readonly:1;
unsigned one_kb_sram:1; unsigned int one_kb_sram:1;
unsigned hw_ecc_enabled:1; unsigned int hw_ecc_enabled:1;
}; };
struct mx3_nf_controller { struct mx3_nf_controller {

View File

@ -138,11 +138,11 @@ enum mxc_nf_finalize_action {
}; };
struct mxc_nf_flags { struct mxc_nf_flags {
unsigned target_little_endian:1; unsigned int target_little_endian:1;
unsigned nand_readonly:1; unsigned int nand_readonly:1;
unsigned one_kb_sram:1; unsigned int one_kb_sram:1;
unsigned hw_ecc_enabled:1; unsigned int hw_ecc_enabled:1;
unsigned biswap_enabled:1; unsigned int biswap_enabled:1;
}; };
struct mxc_nf_controller { struct mxc_nf_controller {

View File

@ -79,7 +79,7 @@ static int aducm360_build_sector_list(struct flash_bank *bank)
/* sector size is 512 */ /* sector size is 512 */
bank->num_sectors = bank->size / FLASH_SECTOR_SIZE; bank->num_sectors = bank->size / FLASH_SECTOR_SIZE;
bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
for (unsigned i = 0; i < bank->num_sectors; ++i) { for (unsigned int i = 0; i < bank->num_sectors; ++i) {
bank->sectors[i].offset = offset; bank->sectors[i].offset = offset;
bank->sectors[i].size = FLASH_SECTOR_SIZE; bank->sectors[i].size = FLASH_SECTOR_SIZE;
offset += bank->sectors[i].size; offset += bank->sectors[i].size;

View File

@ -154,15 +154,15 @@ struct sam3_bank_private {
struct sam3_chip *chip; struct sam3_chip *chip;
/* so we can find the original bank pointer */ /* so we can find the original bank pointer */
struct flash_bank *bank; struct flash_bank *bank;
unsigned bank_number; unsigned int bank_number;
uint32_t controller_address; uint32_t controller_address;
uint32_t base_address; uint32_t base_address;
uint32_t flash_wait_states; uint32_t flash_wait_states;
bool present; bool present;
unsigned size_bytes; unsigned int size_bytes;
unsigned nsectors; unsigned int nsectors;
unsigned sector_size; unsigned int sector_size;
unsigned page_size; unsigned int page_size;
}; };
struct sam3_chip_details { struct sam3_chip_details {
@ -176,12 +176,12 @@ struct sam3_chip_details {
uint32_t chipid_cidr; uint32_t chipid_cidr;
const char *name; const char *name;
unsigned n_gpnvms; unsigned int n_gpnvms;
#define SAM3_N_NVM_BITS 3 #define SAM3_N_NVM_BITS 3
unsigned gpnvm[SAM3_N_NVM_BITS]; unsigned int gpnvm[SAM3_N_NVM_BITS];
unsigned total_flash_size; unsigned int total_flash_size;
unsigned total_sram_size; unsigned int total_sram_size;
unsigned n_banks; unsigned int n_banks;
#define SAM3_MAX_FLASH_BANKS 2 #define SAM3_MAX_FLASH_BANKS 2
/* these are "initialized" from the global const data */ /* these are "initialized" from the global const data */
struct sam3_bank_private bank[SAM3_MAX_FLASH_BANKS]; struct sam3_bank_private bank[SAM3_MAX_FLASH_BANKS];
@ -2029,7 +2029,7 @@ static int efc_get_result(struct sam3_bank_private *private, uint32_t *v)
} }
static int efc_start_command(struct sam3_bank_private *private, static int efc_start_command(struct sam3_bank_private *private,
unsigned command, unsigned argument) unsigned int command, unsigned int argument)
{ {
uint32_t n, v; uint32_t n, v;
int r; int r;
@ -2051,7 +2051,7 @@ do_retry:
case AT91C_EFC_FCMD_CLB: case AT91C_EFC_FCMD_CLB:
n = (private->size_bytes / private->page_size); n = (private->size_bytes / private->page_size);
if (argument >= n) if (argument >= n)
LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n)); LOG_ERROR("*BUG*: Embedded flash has only %" PRIu32 " pages", n);
break; break;
case AT91C_EFC_FCMD_SFB: case AT91C_EFC_FCMD_SFB:
@ -2124,8 +2124,8 @@ do_retry:
* @param status - put command status bits here * @param status - put command status bits here
*/ */
static int efc_perform_command(struct sam3_bank_private *private, static int efc_perform_command(struct sam3_bank_private *private,
unsigned command, unsigned int command,
unsigned argument, unsigned int argument,
uint32_t *status) uint32_t *status)
{ {
@ -2220,7 +2220,7 @@ static int flashd_erase_entire_bank(struct sam3_bank_private *private)
* @param puthere - result stored here. * @param puthere - result stored here.
*/ */
/* ------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------ */
static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned gpnvm, unsigned *puthere) static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm, unsigned int *puthere)
{ {
uint32_t v; uint32_t v;
int r; int r;
@ -2261,10 +2261,10 @@ static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned gpnvm, u
* @param gpnvm GPNVM index. * @param gpnvm GPNVM index.
* @returns 0 if successful; otherwise returns an error code. * @returns 0 if successful; otherwise returns an error code.
*/ */
static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned gpnvm) static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
LOG_DEBUG("Here"); LOG_DEBUG("Here");
if (private->bank_number != 0) { if (private->bank_number != 0) {
@ -2293,10 +2293,10 @@ static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned gpnvm)
* @param private info about the bank * @param private info about the bank
* @param gpnvm GPNVM index. * @param gpnvm GPNVM index.
*/ */
static int flashd_set_gpnvm(struct sam3_bank_private *private, unsigned gpnvm) static int flashd_set_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
if (private->bank_number != 0) { if (private->bank_number != 0) {
LOG_ERROR("GPNVM only works with Bank0"); LOG_ERROR("GPNVM only works with Bank0");
@ -2346,8 +2346,8 @@ static int flashd_get_lock_bits(struct sam3_bank_private *private, uint32_t *v)
*/ */
static int flashd_unlock(struct sam3_bank_private *private, static int flashd_unlock(struct sam3_bank_private *private,
unsigned start_sector, unsigned int start_sector,
unsigned end_sector) unsigned int end_sector)
{ {
int r; int r;
uint32_t status; uint32_t status;
@ -2376,8 +2376,8 @@ static int flashd_unlock(struct sam3_bank_private *private,
* @param end_sector - last sector (inclusive) to lock * @param end_sector - last sector (inclusive) to lock
*/ */
static int flashd_lock(struct sam3_bank_private *private, static int flashd_lock(struct sam3_bank_private *private,
unsigned start_sector, unsigned int start_sector,
unsigned end_sector) unsigned int end_sector)
{ {
uint32_t status; uint32_t status;
uint32_t pg; uint32_t pg;
@ -2405,8 +2405,8 @@ static int flashd_lock(struct sam3_bank_private *private,
static uint32_t sam3_reg_fieldname(struct sam3_chip *chip, static uint32_t sam3_reg_fieldname(struct sam3_chip *chip,
const char *regname, const char *regname,
uint32_t value, uint32_t value,
unsigned shift, unsigned int shift,
unsigned width) unsigned int width)
{ {
uint32_t v; uint32_t v;
int hwidth, dwidth; int hwidth, dwidth;
@ -2491,7 +2491,7 @@ static const char *const sramsize[] = {
}; };
static const struct archnames { unsigned value; const char *name; } archnames[] = { static const struct archnames { unsigned int value; const char *name; } archnames[] = {
{ 0x19, "AT91SAM9xx Series" }, { 0x19, "AT91SAM9xx Series" },
{ 0x29, "AT91SAM9XExx Series" }, { 0x29, "AT91SAM9XExx Series" },
{ 0x34, "AT91x34 Series" }, { 0x34, "AT91x34 Series" },
@ -2867,8 +2867,8 @@ static int sam3_read_this_reg(struct sam3_chip *chip, uint32_t *goes_here)
r = target_read_u32(chip->target, reg->address, goes_here); r = target_read_u32(chip->target, reg->address, goes_here);
if (r != ERROR_OK) { if (r != ERROR_OK) {
LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Err: %d", LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08" PRIx32 ", Err: %d",
reg->name, (unsigned)(reg->address), r); reg->name, reg->address, r);
} }
return r; return r;
} }
@ -2883,8 +2883,8 @@ static int sam3_read_all_regs(struct sam3_chip *chip)
r = sam3_read_this_reg(chip, r = sam3_read_this_reg(chip,
sam3_get_reg_ptr(&(chip->cfg), reg)); sam3_get_reg_ptr(&(chip->cfg), reg));
if (r != ERROR_OK) { if (r != ERROR_OK) {
LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Error: %d", LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08" PRIx32 ", Error: %d",
reg->name, ((unsigned)(reg->address)), r); reg->name, reg->address, r);
return r; return r;
} }
reg++; reg++;
@ -2951,7 +2951,7 @@ static int sam3_protect_check(struct flash_bank *bank)
{ {
int r; int r;
uint32_t v = 0; uint32_t v = 0;
unsigned x; unsigned int x;
struct sam3_bank_private *private; struct sam3_bank_private *private;
LOG_DEBUG("Begin"); LOG_DEBUG("Begin");
@ -3071,7 +3071,7 @@ static int sam3_get_details(struct sam3_bank_private *private)
const struct sam3_chip_details *details; const struct sam3_chip_details *details;
struct sam3_chip *chip; struct sam3_chip *chip;
struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS]; struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS];
unsigned x; unsigned int x;
LOG_DEBUG("Begin"); LOG_DEBUG("Begin");
details = all_sam3_details; details = all_sam3_details;
@ -3264,7 +3264,7 @@ static int sam3_protect(struct flash_bank *bank, int set, unsigned int first,
} }
static int sam3_page_read(struct sam3_bank_private *private, unsigned pagenum, uint8_t *buf) static int sam3_page_read(struct sam3_bank_private *private, unsigned int pagenum, uint8_t *buf)
{ {
uint32_t adr; uint32_t adr;
int r; int r;
@ -3283,7 +3283,7 @@ static int sam3_page_read(struct sam3_bank_private *private, unsigned pagenum, u
return r; return r;
} }
static int sam3_page_write(struct sam3_bank_private *private, unsigned pagenum, const uint8_t *buf) static int sam3_page_write(struct sam3_bank_private *private, unsigned int pagenum, const uint8_t *buf)
{ {
uint32_t adr; uint32_t adr;
uint32_t status; uint32_t status;
@ -3347,10 +3347,10 @@ static int sam3_write(struct flash_bank *bank,
uint32_t count) uint32_t count)
{ {
int n; int n;
unsigned page_cur; unsigned int page_cur;
unsigned page_end; unsigned int page_end;
int r; int r;
unsigned page_offset; unsigned int page_offset;
struct sam3_bank_private *private; struct sam3_bank_private *private;
uint8_t *pagebuffer; uint8_t *pagebuffer;
@ -3497,7 +3497,7 @@ COMMAND_HANDLER(sam3_handle_info_command)
if (!chip) if (!chip)
return ERROR_OK; return ERROR_OK;
unsigned x; unsigned int x;
int r; int r;
/* bank0 must exist before we can do anything */ /* bank0 must exist before we can do anything */
@ -3549,7 +3549,7 @@ need_define:
COMMAND_HANDLER(sam3_handle_gpnvm_command) COMMAND_HANDLER(sam3_handle_gpnvm_command)
{ {
unsigned x, v; unsigned int x, v;
int r, who; int r, who;
struct sam3_chip *chip; struct sam3_chip *chip;

View File

@ -134,15 +134,15 @@ struct sam4_bank_private {
struct sam4_chip *chip; struct sam4_chip *chip;
/* so we can find the original bank pointer */ /* so we can find the original bank pointer */
struct flash_bank *bank; struct flash_bank *bank;
unsigned bank_number; unsigned int bank_number;
uint32_t controller_address; uint32_t controller_address;
uint32_t base_address; uint32_t base_address;
uint32_t flash_wait_states; uint32_t flash_wait_states;
bool present; bool present;
unsigned size_bytes; unsigned int size_bytes;
unsigned nsectors; unsigned int nsectors;
unsigned sector_size; unsigned int sector_size;
unsigned page_size; unsigned int page_size;
}; };
struct sam4_chip_details { struct sam4_chip_details {
@ -156,12 +156,12 @@ struct sam4_chip_details {
uint32_t chipid_cidr; uint32_t chipid_cidr;
const char *name; const char *name;
unsigned n_gpnvms; unsigned int n_gpnvms;
#define SAM4_N_NVM_BITS 3 #define SAM4_N_NVM_BITS 3
unsigned gpnvm[SAM4_N_NVM_BITS]; unsigned int gpnvm[SAM4_N_NVM_BITS];
unsigned total_flash_size; unsigned int total_flash_size;
unsigned total_sram_size; unsigned int total_sram_size;
unsigned n_banks; unsigned int n_banks;
#define SAM4_MAX_FLASH_BANKS 2 #define SAM4_MAX_FLASH_BANKS 2
/* these are "initialized" from the global const data */ /* these are "initialized" from the global const data */
struct sam4_bank_private bank[SAM4_MAX_FLASH_BANKS]; struct sam4_bank_private bank[SAM4_MAX_FLASH_BANKS];
@ -1479,7 +1479,7 @@ static int efc_get_result(struct sam4_bank_private *private, uint32_t *v)
} }
static int efc_start_command(struct sam4_bank_private *private, static int efc_start_command(struct sam4_bank_private *private,
unsigned command, unsigned argument) unsigned int command, unsigned int argument)
{ {
uint32_t n, v; uint32_t n, v;
int r; int r;
@ -1501,7 +1501,7 @@ do_retry:
case AT91C_EFC_FCMD_CLB: case AT91C_EFC_FCMD_CLB:
n = (private->size_bytes / private->page_size); n = (private->size_bytes / private->page_size);
if (argument >= n) if (argument >= n)
LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n)); LOG_ERROR("*BUG*: Embedded flash has only %" PRIu32 " pages", n);
break; break;
case AT91C_EFC_FCMD_SFB: case AT91C_EFC_FCMD_SFB:
@ -1574,8 +1574,8 @@ do_retry:
* @param status - put command status bits here * @param status - put command status bits here
*/ */
static int efc_perform_command(struct sam4_bank_private *private, static int efc_perform_command(struct sam4_bank_private *private,
unsigned command, unsigned int command,
unsigned argument, unsigned int argument,
uint32_t *status) uint32_t *status)
{ {
@ -1716,7 +1716,7 @@ static int flashd_erase_pages(struct sam4_bank_private *private,
* @param puthere - result stored here. * @param puthere - result stored here.
*/ */
/* ------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------ */
static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned gpnvm, unsigned *puthere) static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm, unsigned int *puthere)
{ {
uint32_t v; uint32_t v;
int r; int r;
@ -1757,10 +1757,10 @@ static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned gpnvm, u
* @param gpnvm GPNVM index. * @param gpnvm GPNVM index.
* @returns 0 if successful; otherwise returns an error code. * @returns 0 if successful; otherwise returns an error code.
*/ */
static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned gpnvm) static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
LOG_DEBUG("Here"); LOG_DEBUG("Here");
if (private->bank_number != 0) { if (private->bank_number != 0) {
@ -1789,10 +1789,10 @@ static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned gpnvm)
* @param private info about the bank * @param private info about the bank
* @param gpnvm GPNVM index. * @param gpnvm GPNVM index.
*/ */
static int flashd_set_gpnvm(struct sam4_bank_private *private, unsigned gpnvm) static int flashd_set_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
if (private->bank_number != 0) { if (private->bank_number != 0) {
LOG_ERROR("GPNVM only works with Bank0"); LOG_ERROR("GPNVM only works with Bank0");
@ -1846,8 +1846,8 @@ static int flashd_get_lock_bits(struct sam4_bank_private *private, uint32_t *v)
*/ */
static int flashd_unlock(struct sam4_bank_private *private, static int flashd_unlock(struct sam4_bank_private *private,
unsigned start_sector, unsigned int start_sector,
unsigned end_sector) unsigned int end_sector)
{ {
int r; int r;
uint32_t status; uint32_t status;
@ -1876,8 +1876,8 @@ static int flashd_unlock(struct sam4_bank_private *private,
* @param end_sector - last sector (inclusive) to lock * @param end_sector - last sector (inclusive) to lock
*/ */
static int flashd_lock(struct sam4_bank_private *private, static int flashd_lock(struct sam4_bank_private *private,
unsigned start_sector, unsigned int start_sector,
unsigned end_sector) unsigned int end_sector)
{ {
uint32_t status; uint32_t status;
uint32_t pg; uint32_t pg;
@ -1905,8 +1905,8 @@ static int flashd_lock(struct sam4_bank_private *private,
static uint32_t sam4_reg_fieldname(struct sam4_chip *chip, static uint32_t sam4_reg_fieldname(struct sam4_chip *chip,
const char *regname, const char *regname,
uint32_t value, uint32_t value,
unsigned shift, unsigned int shift,
unsigned width) unsigned int width)
{ {
uint32_t v; uint32_t v;
int hwidth, dwidth; int hwidth, dwidth;
@ -1991,7 +1991,7 @@ static const char *const sramsize[] = {
}; };
static const struct archnames { unsigned value; const char *name; } archnames[] = { static const struct archnames { unsigned int value; const char *name; } archnames[] = {
{ 0x19, "AT91SAM9xx Series" }, { 0x19, "AT91SAM9xx Series" },
{ 0x29, "AT91SAM9XExx Series" }, { 0x29, "AT91SAM9XExx Series" },
{ 0x34, "AT91x34 Series" }, { 0x34, "AT91x34 Series" },
@ -2374,8 +2374,8 @@ static int sam4_read_this_reg(struct sam4_chip *chip, uint32_t *goes_here)
r = target_read_u32(chip->target, reg->address, goes_here); r = target_read_u32(chip->target, reg->address, goes_here);
if (r != ERROR_OK) { if (r != ERROR_OK) {
LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08x, Err: %d", LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08" PRIx32 ", Err: %d",
reg->name, (unsigned)(reg->address), r); reg->name, reg->address, r);
} }
return r; return r;
} }
@ -2390,8 +2390,8 @@ static int sam4_read_all_regs(struct sam4_chip *chip)
r = sam4_read_this_reg(chip, r = sam4_read_this_reg(chip,
sam4_get_reg_ptr(&(chip->cfg), reg)); sam4_get_reg_ptr(&(chip->cfg), reg));
if (r != ERROR_OK) { if (r != ERROR_OK) {
LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08x, Error: %d", LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08" PRIx32 ", Error: %d",
reg->name, ((unsigned)(reg->address)), r); reg->name, reg->address, r);
return r; return r;
} }
reg++; reg++;
@ -2444,7 +2444,7 @@ static int sam4_protect_check(struct flash_bank *bank)
{ {
int r; int r;
uint32_t v[4] = {0}; uint32_t v[4] = {0};
unsigned x; unsigned int x;
struct sam4_bank_private *private; struct sam4_bank_private *private;
LOG_DEBUG("Begin"); LOG_DEBUG("Begin");
@ -2557,7 +2557,7 @@ static int sam4_get_details(struct sam4_bank_private *private)
const struct sam4_chip_details *details; const struct sam4_chip_details *details;
struct sam4_chip *chip; struct sam4_chip *chip;
struct flash_bank *saved_banks[SAM4_MAX_FLASH_BANKS]; struct flash_bank *saved_banks[SAM4_MAX_FLASH_BANKS];
unsigned x; unsigned int x;
LOG_DEBUG("Begin"); LOG_DEBUG("Begin");
details = all_sam4_details; details = all_sam4_details;
@ -2796,7 +2796,7 @@ static int sam4_protect(struct flash_bank *bank, int set, unsigned int first,
} }
static int sam4_page_read(struct sam4_bank_private *private, unsigned pagenum, uint8_t *buf) static int sam4_page_read(struct sam4_bank_private *private, unsigned int pagenum, uint8_t *buf)
{ {
uint32_t adr; uint32_t adr;
int r; int r;
@ -2841,7 +2841,7 @@ static int sam4_set_wait(struct sam4_bank_private *private)
return r; return r;
} }
static int sam4_page_write(struct sam4_bank_private *private, unsigned pagenum, const uint8_t *buf) static int sam4_page_write(struct sam4_bank_private *private, unsigned int pagenum, const uint8_t *buf)
{ {
uint32_t adr; uint32_t adr;
uint32_t status; uint32_t status;
@ -2891,10 +2891,10 @@ static int sam4_write(struct flash_bank *bank,
uint32_t count) uint32_t count)
{ {
int n; int n;
unsigned page_cur; unsigned int page_cur;
unsigned page_end; unsigned int page_end;
int r; int r;
unsigned page_offset; unsigned int page_offset;
struct sam4_bank_private *private; struct sam4_bank_private *private;
uint8_t *pagebuffer; uint8_t *pagebuffer;
@ -3045,7 +3045,7 @@ COMMAND_HANDLER(sam4_handle_info_command)
if (!chip) if (!chip)
return ERROR_OK; return ERROR_OK;
unsigned x; unsigned int x;
int r; int r;
/* bank0 must exist before we can do anything */ /* bank0 must exist before we can do anything */
@ -3097,7 +3097,7 @@ need_define:
COMMAND_HANDLER(sam4_handle_gpnvm_command) COMMAND_HANDLER(sam4_handle_gpnvm_command)
{ {
unsigned x, v; unsigned int x, v;
int r, who; int r, who;
struct sam4_chip *chip; struct sam4_chip *chip;

View File

@ -365,7 +365,7 @@ static const struct samd_family *samd_find_family(uint32_t id)
uint8_t family = SAMD_GET_FAMILY(id); uint8_t family = SAMD_GET_FAMILY(id);
uint8_t series = SAMD_GET_SERIES(id); uint8_t series = SAMD_GET_SERIES(id);
for (unsigned i = 0; i < ARRAY_SIZE(samd_families); i++) { for (unsigned int i = 0; i < ARRAY_SIZE(samd_families); i++) {
if (samd_families[i].processor == processor && if (samd_families[i].processor == processor &&
samd_families[i].series == series && samd_families[i].series == series &&
samd_families[i].family == family) samd_families[i].family == family)
@ -387,7 +387,7 @@ static const struct samd_part *samd_find_part(uint32_t id)
if (!family) if (!family)
return NULL; return NULL;
for (unsigned i = 0; i < family->num_parts; i++) { for (unsigned int i = 0; i < family->num_parts; i++) {
if (family->parts[i].id == devsel) if (family->parts[i].id == devsel)
return &family->parts[i]; return &family->parts[i];
} }

View File

@ -513,7 +513,7 @@ static int ath79_erase(struct flash_bank *bank, unsigned int first,
if (ath79_info->dev->erase_cmd == 0x00) if (ath79_info->dev->erase_cmd == 0x00)
return ERROR_FLASH_OPER_UNSUPPORTED; return ERROR_FLASH_OPER_UNSUPPORTED;
for (unsigned sector = first; sector <= last; sector++) { for (unsigned int sector = first; sector <= last; sector++) {
if (bank->sectors[sector].is_protected) { if (bank->sectors[sector].is_protected) {
LOG_ERROR("Flash sector %u protected", sector); LOG_ERROR("Flash sector %u protected", sector);
return ERROR_FAIL; return ERROR_FAIL;

View File

@ -224,7 +224,7 @@ static const struct samd_family *samd_find_family(uint32_t id)
uint8_t family = SAMD_GET_FAMILY(id); uint8_t family = SAMD_GET_FAMILY(id);
uint8_t series = SAMD_GET_SERIES(id); uint8_t series = SAMD_GET_SERIES(id);
for (unsigned i = 0; i < ARRAY_SIZE(samd_families); i++) { for (unsigned int i = 0; i < ARRAY_SIZE(samd_families); i++) {
if (samd_families[i].processor == processor && if (samd_families[i].processor == processor &&
samd_families[i].series == series && samd_families[i].series == series &&
samd_families[i].family == family) samd_families[i].family == family)
@ -246,7 +246,7 @@ static const struct samd_part *samd_find_part(uint32_t id)
if (!family) if (!family)
return NULL; return NULL;
for (unsigned i = 0; i < family->num_parts; i++) { for (unsigned int i = 0; i < family->num_parts; i++) {
if (family->parts[i].id == devsel) if (family->parts[i].id == devsel)
return &family->parts[i]; return &family->parts[i];
} }

View File

@ -55,8 +55,8 @@
struct samv_flash_bank { struct samv_flash_bank {
bool probed; bool probed;
unsigned size_bytes; unsigned int size_bytes;
unsigned gpnvm[SAMV_NUM_GPNVM_BITS]; unsigned int gpnvm[SAMV_NUM_GPNVM_BITS];
}; };
/* The actual sector size of the SAMV7 flash memory is 128K bytes. /* The actual sector size of the SAMV7 flash memory is 128K bytes.
@ -82,7 +82,7 @@ static int samv_efc_get_result(struct target *target, uint32_t *v)
} }
static int samv_efc_start_command(struct target *target, static int samv_efc_start_command(struct target *target,
unsigned command, unsigned argument) unsigned int command, unsigned int argument)
{ {
uint32_t v; uint32_t v;
samv_efc_get_status(target, &v); samv_efc_get_status(target, &v);
@ -100,7 +100,7 @@ static int samv_efc_start_command(struct target *target,
} }
static int samv_efc_perform_command(struct target *target, static int samv_efc_perform_command(struct target *target,
unsigned command, unsigned argument, uint32_t *status) unsigned int command, unsigned int argument, uint32_t *status)
{ {
int r; int r;
uint32_t v; uint32_t v;
@ -166,7 +166,7 @@ static int samv_erase_pages(struct target *target,
first_page | erase_pages, status); first_page | erase_pages, status);
} }
static int samv_get_gpnvm(struct target *target, unsigned gpnvm, unsigned *out) static int samv_get_gpnvm(struct target *target, unsigned int gpnvm, unsigned int *out)
{ {
uint32_t v; uint32_t v;
int r; int r;
@ -190,10 +190,10 @@ static int samv_get_gpnvm(struct target *target, unsigned gpnvm, unsigned *out)
return r; return r;
} }
static int samv_clear_gpnvm(struct target *target, unsigned gpnvm) static int samv_clear_gpnvm(struct target *target, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
if (gpnvm >= SAMV_NUM_GPNVM_BITS) { if (gpnvm >= SAMV_NUM_GPNVM_BITS) {
LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS); LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS);
@ -209,10 +209,10 @@ static int samv_clear_gpnvm(struct target *target, unsigned gpnvm)
return r; return r;
} }
static int samv_set_gpnvm(struct target *target, unsigned gpnvm) static int samv_set_gpnvm(struct target *target, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
if (gpnvm >= SAMV_NUM_GPNVM_BITS) { if (gpnvm >= SAMV_NUM_GPNVM_BITS) {
LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS); LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS);
return ERROR_FAIL; return ERROR_FAIL;
@ -231,7 +231,7 @@ static int samv_set_gpnvm(struct target *target, unsigned gpnvm)
} }
static int samv_flash_unlock(struct target *target, static int samv_flash_unlock(struct target *target,
unsigned start_sector, unsigned end_sector) unsigned int start_sector, unsigned int end_sector)
{ {
int r; int r;
uint32_t status; uint32_t status;
@ -251,7 +251,7 @@ static int samv_flash_unlock(struct target *target,
} }
static int samv_flash_lock(struct target *target, static int samv_flash_lock(struct target *target,
unsigned start_sector, unsigned end_sector) unsigned int start_sector, unsigned int end_sector)
{ {
uint32_t status; uint32_t status;
uint32_t pg; uint32_t pg;
@ -419,7 +419,7 @@ static int samv_protect(struct flash_bank *bank, int set, unsigned int first,
} }
static int samv_page_read(struct target *target, static int samv_page_read(struct target *target,
unsigned page_num, uint8_t *buf) unsigned int page_num, uint8_t *buf)
{ {
uint32_t addr = SAMV_FLASH_BASE + page_num * SAMV_PAGE_SIZE; uint32_t addr = SAMV_FLASH_BASE + page_num * SAMV_PAGE_SIZE;
int r = target_read_memory(target, addr, 4, SAMV_PAGE_SIZE / 4, buf); int r = target_read_memory(target, addr, 4, SAMV_PAGE_SIZE / 4, buf);
@ -430,7 +430,7 @@ static int samv_page_read(struct target *target,
} }
static int samv_page_write(struct target *target, static int samv_page_write(struct target *target,
unsigned pagenum, const uint8_t *buf) unsigned int pagenum, const uint8_t *buf)
{ {
uint32_t status; uint32_t status;
const uint32_t addr = SAMV_FLASH_BASE + pagenum * SAMV_PAGE_SIZE; const uint32_t addr = SAMV_FLASH_BASE + pagenum * SAMV_PAGE_SIZE;
@ -618,7 +618,7 @@ COMMAND_HANDLER(samv_handle_gpnvm_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
unsigned v = 0; unsigned int v = 0;
if (!strcmp("show", CMD_ARGV[0])) { if (!strcmp("show", CMD_ARGV[0])) {
if (who == -1) { if (who == -1) {
showall: showall:

View File

@ -806,7 +806,7 @@ int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned int argc, const char **
} }
bank->driver_priv = cfi_info; bank->driver_priv = cfi_info;
for (unsigned i = 6; i < argc; i++) { for (unsigned int i = 6; i < argc; i++) {
if (strcmp(argv[i], "x16_as_x8") == 0) if (strcmp(argv[i], "x16_as_x8") == 0)
cfi_info->x16_as_x8 = true; cfi_info->x16_as_x8 = true;
else if (strcmp(argv[i], "data_swap") == 0) else if (strcmp(argv[i], "data_swap") == 0)
@ -2219,8 +2219,7 @@ static int cfi_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, u
uint8_t current_word[CFI_MAX_BUS_WIDTH]; uint8_t current_word[CFI_MAX_BUS_WIDTH];
int retval; int retval;
LOG_DEBUG("reading buffer of %i byte at 0x%8.8x", LOG_DEBUG("reading buffer of %" PRIi32 " byte at 0x%8.8" PRIx32, count, offset);
(int)count, (unsigned)offset);
if (bank->target->state != TARGET_HALTED) { if (bank->target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted"); LOG_ERROR("Target not halted");

View File

@ -58,10 +58,10 @@ struct cfi_flash_bank {
void *alt_ext; void *alt_ext;
/* calculated timeouts */ /* calculated timeouts */
unsigned word_write_timeout; unsigned int word_write_timeout;
unsigned buf_write_timeout; unsigned int buf_write_timeout;
unsigned block_erase_timeout; unsigned int block_erase_timeout;
unsigned chip_erase_timeout; unsigned int chip_erase_timeout;
/* memory accessors */ /* memory accessors */
int (*write_mem)(struct flash_bank *bank, target_addr_t addr, int (*write_mem)(struct flash_bank *bank, target_addr_t addr,

View File

@ -164,7 +164,7 @@ int default_flash_verify(struct flash_bank *bank,
void flash_bank_add(struct flash_bank *bank) void flash_bank_add(struct flash_bank *bank)
{ {
/* put flash bank in linked list */ /* put flash bank in linked list */
unsigned bank_num = 0; unsigned int bank_num = 0;
if (flash_banks) { if (flash_banks) {
/* find last flash bank */ /* find last flash bank */
struct flash_bank *p = flash_banks; struct flash_bank *p = flash_banks;
@ -242,8 +242,8 @@ void flash_free_all_banks(void)
struct flash_bank *get_flash_bank_by_name_noprobe(const char *name) struct flash_bank *get_flash_bank_by_name_noprobe(const char *name)
{ {
unsigned requested = get_flash_name_index(name); unsigned int requested = get_flash_name_index(name);
unsigned found = 0; unsigned int found = 0;
struct flash_bank *bank; struct flash_bank *bank;
for (bank = flash_banks; bank; bank = bank->next) { for (bank = flash_banks; bank; bank = bank->next) {

View File

@ -250,7 +250,7 @@ int get_flash_bank_by_num(unsigned int num, struct flash_bank **bank);
* @param bank On output, contains a pointer to the bank or NULL. * @param bank On output, contains a pointer to the bank or NULL.
* @returns ERROR_OK on success, or an error indicating the problem. * @returns ERROR_OK on success, or an error indicating the problem.
*/ */
COMMAND_HELPER(flash_command_get_bank, unsigned name_index, COMMAND_HELPER(flash_command_get_bank, unsigned int name_index,
struct flash_bank **bank); struct flash_bank **bank);
/** /**
* Retrieves @a bank from a command argument, reporting errors parsing * Retrieves @a bank from a command argument, reporting errors parsing

View File

@ -91,7 +91,7 @@ static const struct flash_driver * const flash_drivers[] = {
const struct flash_driver *flash_driver_find_by_name(const char *name) const struct flash_driver *flash_driver_find_by_name(const char *name)
{ {
for (unsigned i = 0; flash_drivers[i]; i++) { for (unsigned int i = 0; flash_drivers[i]; i++) {
if (strcmp(name, flash_drivers[i]->name) == 0) if (strcmp(name, flash_drivers[i]->name) == 0)
return flash_drivers[i]; return flash_drivers[i];
} }

View File

@ -531,7 +531,7 @@ static int fespi_write(struct flash_bank *bank, const uint8_t *buffer,
bin_size = sizeof(riscv64_bin); bin_size = sizeof(riscv64_bin);
} }
unsigned data_wa_size = 0; unsigned int data_wa_size = 0;
if (target_alloc_working_area(target, bin_size, &algorithm_wa) == ERROR_OK) { if (target_alloc_working_area(target, bin_size, &algorithm_wa) == ERROR_OK) {
retval = target_write_buffer(target, algorithm_wa->address, retval = target_write_buffer(target, algorithm_wa->address,
bin_size, bin); bin_size, bin);

View File

@ -107,7 +107,7 @@ static int fm4_flash_erase(struct flash_bank *bank, unsigned int first,
struct working_area *workarea; struct working_area *workarea;
struct reg_param reg_params[4]; struct reg_param reg_params[4];
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
unsigned i; unsigned int i;
int retval; int retval;
const uint8_t erase_sector_code[] = { const uint8_t erase_sector_code[] = {
#include "../../../contrib/loaders/flash/fm4/erase.inc" #include "../../../contrib/loaders/flash/fm4/erase.inc"
@ -207,7 +207,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
uint32_t halfword_count = DIV_ROUND_UP(byte_count, 2); uint32_t halfword_count = DIV_ROUND_UP(byte_count, 2);
uint32_t result; uint32_t result;
unsigned i; unsigned int i;
int retval, retval2 = ERROR_OK; int retval, retval2 = ERROR_OK;
const uint8_t write_block_code[] = { const uint8_t write_block_code[] = {
#include "../../../contrib/loaders/flash/fm4/write.inc" #include "../../../contrib/loaders/flash/fm4/write.inc"

View File

@ -256,7 +256,7 @@
struct kinetis_flash_bank { struct kinetis_flash_bank {
struct kinetis_chip *k_chip; struct kinetis_chip *k_chip;
bool probed; bool probed;
unsigned bank_number; /* bank number in particular chip */ unsigned int bank_number; /* bank number in particular chip */
struct flash_bank *bank; struct flash_bank *bank;
uint32_t sector_size; uint32_t sector_size;
@ -285,9 +285,9 @@ struct kinetis_chip {
uint32_t fcfg2_maxaddr0_shifted; uint32_t fcfg2_maxaddr0_shifted;
uint32_t fcfg2_maxaddr1_shifted; uint32_t fcfg2_maxaddr1_shifted;
unsigned num_pflash_blocks, num_nvm_blocks; unsigned int num_pflash_blocks, num_nvm_blocks;
unsigned pflash_sector_size, nvm_sector_size; unsigned int pflash_sector_size, nvm_sector_size;
unsigned max_flash_prog_size; unsigned int max_flash_prog_size;
uint32_t pflash_base; uint32_t pflash_base;
uint32_t pflash_size; uint32_t pflash_size;
@ -337,7 +337,7 @@ struct kinetis_chip {
char name[40]; char name[40];
unsigned num_banks; unsigned int num_banks;
struct kinetis_flash_bank banks[KINETIS_MAX_BANKS]; struct kinetis_flash_bank banks[KINETIS_MAX_BANKS];
}; };
@ -425,7 +425,7 @@ static int kinetis_probe_chip_s32k(struct kinetis_chip *k_chip);
static int kinetis_auto_probe(struct flash_bank *bank); static int kinetis_auto_probe(struct flash_bank *bank);
static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value) static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
{ {
LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value); LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value);
@ -453,7 +453,7 @@ static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint3
return ERROR_OK; return ERROR_OK;
} }
static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result) static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
{ {
struct adiv5_ap *ap = dap_get_ap(dap, MDM_AP); struct adiv5_ap *ap = dap_get_ap(dap, MDM_AP);
if (!ap) { if (!ap) {
@ -479,7 +479,7 @@ static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32
return ERROR_OK; return ERROR_OK;
} }
static int kinetis_mdm_poll_register(struct adiv5_dap *dap, unsigned reg, static int kinetis_mdm_poll_register(struct adiv5_dap *dap, unsigned int reg,
uint32_t mask, uint32_t value, uint32_t timeout_ms) uint32_t mask, uint32_t value, uint32_t timeout_ms)
{ {
uint32_t val; uint32_t val;
@ -977,7 +977,7 @@ static void kinetis_free_driver_priv(struct flash_bank *bank)
static int kinetis_create_missing_banks(struct kinetis_chip *k_chip) static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
{ {
unsigned num_blocks; unsigned int num_blocks;
struct kinetis_flash_bank *k_bank; struct kinetis_flash_bank *k_bank;
struct flash_bank *bank; struct flash_bank *bank;
char base_name[69], name[87], num[11]; char base_name[69], name[87], num[11];
@ -1463,7 +1463,7 @@ static int kinetis_fill_fcf(struct flash_bank *bank, uint8_t *fcf)
uint32_t fprot = 0xffffffff; uint32_t fprot = 0xffffffff;
uint8_t fsec = 0xfe; /* set MCU unsecure */ uint8_t fsec = 0xfe; /* set MCU unsecure */
uint8_t fdprot = 0xff; uint8_t fdprot = 0xff;
unsigned num_blocks; unsigned int num_blocks;
uint32_t pflash_bit; uint32_t pflash_bit;
uint8_t dflash_bit; uint8_t dflash_bit;
struct flash_bank *bank_iter; struct flash_bank *bank_iter;
@ -2269,12 +2269,12 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
uint32_t ee_size = 0; uint32_t ee_size = 0;
uint32_t pflash_size_k, nvm_size_k, dflash_size_k; uint32_t pflash_size_k, nvm_size_k, dflash_size_k;
uint32_t pflash_size_m; uint32_t pflash_size_m;
unsigned num_blocks = 0; unsigned int num_blocks = 0;
unsigned maxaddr_shift = 13; unsigned int maxaddr_shift = 13;
struct target *target = k_chip->target; struct target *target = k_chip->target;
unsigned familyid = 0, subfamid = 0; unsigned int familyid = 0, subfamid = 0;
unsigned cpu_mhz = 120; unsigned int cpu_mhz = 120;
bool use_nvm_marking = false; bool use_nvm_marking = false;
char flash_marking[12], nvm_marking[2]; char flash_marking[12], nvm_marking[2];
char name[40]; char name[40];
@ -2895,7 +2895,7 @@ static int kinetis_probe(struct flash_bank *bank)
{ {
int result; int result;
uint8_t fcfg2_maxaddr0, fcfg2_pflsh, fcfg2_maxaddr1; uint8_t fcfg2_maxaddr0, fcfg2_pflsh, fcfg2_maxaddr1;
unsigned num_blocks, first_nvm_bank; unsigned int num_blocks, first_nvm_bank;
uint32_t size_k; uint32_t size_k;
struct kinetis_flash_bank *k_bank = bank->driver_priv; struct kinetis_flash_bank *k_bank = bank->driver_priv;
struct kinetis_chip *k_chip; struct kinetis_chip *k_chip;
@ -2940,7 +2940,7 @@ static int kinetis_probe(struct flash_bank *bank)
} else if (k_bank->bank_number < num_blocks) { } else if (k_bank->bank_number < num_blocks) {
/* nvm, banks start at address 0x10000000 */ /* nvm, banks start at address 0x10000000 */
unsigned nvm_ord = k_bank->bank_number - first_nvm_bank; unsigned int nvm_ord = k_bank->bank_number - first_nvm_bank;
uint32_t limit; uint32_t limit;
k_bank->flash_class = FC_FLEX_NVM; k_bank->flash_class = FC_FLEX_NVM;
@ -3139,8 +3139,8 @@ static int kinetis_blank_check(struct flash_bank *bank)
COMMAND_HANDLER(kinetis_nvm_partition) COMMAND_HANDLER(kinetis_nvm_partition)
{ {
int result; int result;
unsigned bank_idx; unsigned int bank_idx;
unsigned num_blocks, first_nvm_bank; unsigned int num_blocks, first_nvm_bank;
unsigned long par, log2 = 0, ee1 = 0, ee2 = 0; unsigned long par, log2 = 0, ee1 = 0, ee2 = 0;
enum { SHOW_INFO, DF_SIZE, EEBKP_SIZE } sz_type = SHOW_INFO; enum { SHOW_INFO, DF_SIZE, EEBKP_SIZE } sz_type = SHOW_INFO;
bool enable; bool enable;

View File

@ -134,7 +134,7 @@ struct kinetis_ke_flash_bank {
#define MDM_ACCESS_TIMEOUT 3000 /* iterations */ #define MDM_ACCESS_TIMEOUT 3000 /* iterations */
static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value) static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
{ {
LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value); LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value);
@ -161,7 +161,7 @@ static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned reg, ui
return ERROR_OK; return ERROR_OK;
} }
static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result) static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
{ {
struct adiv5_ap *ap = dap_get_ap(dap, 1); struct adiv5_ap *ap = dap_get_ap(dap, 1);
if (!ap) { if (!ap) {
@ -187,7 +187,7 @@ static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uin
return ERROR_OK; return ERROR_OK;
} }
static int kinetis_ke_mdm_poll_register(struct adiv5_dap *dap, unsigned reg, uint32_t mask, uint32_t value) static int kinetis_ke_mdm_poll_register(struct adiv5_dap *dap, unsigned int reg, uint32_t mask, uint32_t value)
{ {
uint32_t val; uint32_t val;
int retval; int retval;

View File

@ -202,14 +202,14 @@ static int max32xxx_protect_check(struct flash_bank *bank)
return ERROR_FLASH_BANK_NOT_PROBED; return ERROR_FLASH_BANK_NOT_PROBED;
if (!info->max326xx) { if (!info->max326xx) {
for (unsigned i = 0; i < bank->num_sectors; i++) for (unsigned int i = 0; i < bank->num_sectors; i++)
bank->sectors[i].is_protected = -1; bank->sectors[i].is_protected = -1;
return ERROR_FLASH_OPER_UNSUPPORTED; return ERROR_FLASH_OPER_UNSUPPORTED;
} }
/* Check the protection */ /* Check the protection */
for (unsigned i = 0; i < bank->num_sectors; i++) { for (unsigned int i = 0; i < bank->num_sectors; i++) {
if (i%32 == 0) if (i%32 == 0)
target_read_u32(target, info->flc_base + FLSH_PROT + ((i/32)*4), &temp_reg); target_read_u32(target, info->flc_base + FLSH_PROT + ((i/32)*4), &temp_reg);
@ -360,7 +360,7 @@ static int max32xxx_write_block(struct flash_bank *bank, const uint8_t *buffer,
struct armv7m_algorithm armv7m_info; struct armv7m_algorithm armv7m_info;
int retval = ERROR_OK; int retval = ERROR_OK;
/* power of two, and multiple of word size */ /* power of two, and multiple of word size */
static const unsigned buf_min = 128; static const unsigned int buf_min = 128;
/* for small buffers it's faster not to download an algorithm */ /* for small buffers it's faster not to download an algorithm */
if (wcount * 4 < buf_min) if (wcount * 4 < buf_min)
@ -388,8 +388,8 @@ static int max32xxx_write_block(struct flash_bank *bank, const uint8_t *buffer,
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
} }
LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)", LOG_DEBUG("retry target_alloc_working_area(%s, size=%" PRIu32 ")",
target_name(target), (unsigned) buffer_size); target_name(target), buffer_size);
} }
target_write_buffer(target, write_algorithm->address, sizeof(write_code), target_write_buffer(target, write_algorithm->address, sizeof(write_code),
@ -903,7 +903,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_check_command)
} }
LOG_WARNING("s:<sector number> a:<address> p:<protection bit>"); LOG_WARNING("s:<sector number> a:<address> p:<protection bit>");
for (unsigned i = 0; i < bank->num_sectors; i += 4) { for (unsigned int i = 0; i < bank->num_sectors; i += 4) {
LOG_WARNING("s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d", LOG_WARNING("s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d",
(i+0), (i+0)*info->sector_size, bank->sectors[(i+0)].is_protected, (i+0), (i+0)*info->sector_size, bank->sectors[(i+0)].is_protected,
(i+1), (i+1)*info->sector_size, bank->sectors[(i+1)].is_protected, (i+1), (i+1)*info->sector_size, bank->sectors[(i+1)].is_protected,

View File

@ -160,7 +160,7 @@ static int ocl_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t of
retval = embeddedice_send(ocl->jtag_info, dcc_buffer, dcc_bufptr-dcc_buffer); retval = embeddedice_send(ocl->jtag_info, dcc_buffer, dcc_bufptr-dcc_buffer);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
free(dcc_buffer); free(dcc_buffer);
return retval; return retval;
} }
/* wait for response, fixed timeout of 1 s */ /* wait for response, fixed timeout of 1 s */

View File

@ -102,10 +102,10 @@
struct psoc5lp_device { struct psoc5lp_device {
uint32_t id; uint32_t id;
unsigned fam; unsigned int fam;
unsigned speed_mhz; unsigned int speed_mhz;
unsigned flash_kb; unsigned int flash_kb;
unsigned eeprom_kb; unsigned int eeprom_kb;
}; };
/* /*
@ -245,7 +245,7 @@ static int psoc5lp_find_device(struct target *target,
const struct psoc5lp_device **device) const struct psoc5lp_device **device)
{ {
uint32_t device_id; uint32_t device_id;
unsigned i; unsigned int i;
int retval; int retval;
*device = NULL; *device = NULL;
@ -381,9 +381,9 @@ static int psoc5lp_spc_load_byte(struct target *target,
} }
static int psoc5lp_spc_load_row(struct target *target, static int psoc5lp_spc_load_row(struct target *target,
uint8_t array_id, const uint8_t *data, unsigned row_size) uint8_t array_id, const uint8_t *data, unsigned int row_size)
{ {
unsigned i; unsigned int i;
int retval; int retval;
retval = psoc5lp_spc_write_opcode(target, SPC_LOAD_ROW); retval = psoc5lp_spc_write_opcode(target, SPC_LOAD_ROW);
@ -853,7 +853,7 @@ static int psoc5lp_eeprom_write(struct flash_bank *bank,
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint8_t temp[2]; uint8_t temp[2];
unsigned row; unsigned int row;
int retval; int retval;
if (offset % EEPROM_ROW_SIZE != 0) { if (offset % EEPROM_ROW_SIZE != 0) {
@ -1124,7 +1124,7 @@ static int psoc5lp_write(struct flash_bank *bank, const uint8_t *buffer,
struct working_area *code_area, *even_row_area, *odd_row_area; struct working_area *code_area, *even_row_area, *odd_row_area;
uint32_t row_size; uint32_t row_size;
uint8_t temp[2], buf[12], ecc_bytes[ROW_ECC_SIZE]; uint8_t temp[2], buf[12], ecc_bytes[ROW_ECC_SIZE];
unsigned array_id, row; unsigned int array_id, row;
int i, retval; int i, retval;
if (offset + byte_count > bank->size) { if (offset + byte_count > bank->size) {
@ -1183,7 +1183,7 @@ static int psoc5lp_write(struct flash_bank *bank, const uint8_t *buffer,
row < ROWS_PER_BLOCK && byte_count > 0; row++) { row < ROWS_PER_BLOCK && byte_count > 0; row++) {
bool even_row = (row % 2 == 0); bool even_row = (row % 2 == 0);
struct working_area *data_area = even_row ? even_row_area : odd_row_area; struct working_area *data_area = even_row ? even_row_area : odd_row_area;
unsigned len = MIN(ROW_SIZE, byte_count); unsigned int len = MIN(ROW_SIZE, byte_count);
LOG_DEBUG("Writing load command for array %u row %u at " TARGET_ADDR_FMT, LOG_DEBUG("Writing load command for array %u row %u at " TARGET_ADDR_FMT,
array_id, row, data_area->address); array_id, row, data_area->address);
@ -1307,8 +1307,8 @@ static int psoc5lp_protect_check(struct flash_bank *bank)
{ {
struct psoc5lp_flash_bank *psoc_bank = bank->driver_priv; struct psoc5lp_flash_bank *psoc_bank = bank->driver_priv;
uint8_t row_data[ROW_SIZE]; uint8_t row_data[ROW_SIZE];
const unsigned protection_bytes_per_sector = ROWS_PER_SECTOR * 2 / 8; const unsigned int protection_bytes_per_sector = ROWS_PER_SECTOR * 2 / 8;
unsigned i, k, num_sectors; unsigned int i, k, num_sectors;
int retval; int retval;
if (bank->target->state != TARGET_HALTED) { if (bank->target->state != TARGET_HALTED) {

View File

@ -487,7 +487,7 @@ static int psoc6_get_info(struct flash_bank *bank, struct command_invocation *cm
{ {
struct psoc6_target_info *psoc6_info = bank->driver_priv; struct psoc6_target_info *psoc6_info = bank->driver_priv;
if (psoc6_info->is_probed == false) if (!psoc6_info->is_probed)
return ERROR_FAIL; return ERROR_FAIL;
int hr = get_silicon_id(bank->target, &psoc6_info->silicon_id, &psoc6_info->protection); int hr = get_silicon_id(bank->target, &psoc6_info->silicon_id, &psoc6_info->protection);

View File

@ -859,7 +859,7 @@ static int sim3x_flash_info(struct flash_bank *bank, struct command_invocation *
* reg 3:2 - register * reg 3:2 - register
* reg 1:0 - no effect * reg 1:0 - no effect
*/ */
static int ap_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value) static int ap_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
{ {
LOG_DEBUG("DAP_REG[0x%02x] <- %08" PRIX32, reg, value); LOG_DEBUG("DAP_REG[0x%02x] <- %08" PRIX32, reg, value);
@ -886,7 +886,7 @@ static int ap_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value
return ERROR_OK; return ERROR_OK;
} }
static int ap_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result) static int ap_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
{ {
struct adiv5_ap *ap = dap_get_ap(dap, SIM3X_AP); struct adiv5_ap *ap = dap_get_ap(dap, SIM3X_AP);
if (!ap) { if (!ap) {
@ -912,7 +912,7 @@ static int ap_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *resul
return ERROR_OK; return ERROR_OK;
} }
static int ap_poll_register(struct adiv5_dap *dap, unsigned reg, uint32_t mask, uint32_t value, int timeout) static int ap_poll_register(struct adiv5_dap *dap, unsigned int reg, uint32_t mask, uint32_t value, int timeout)
{ {
uint32_t val; uint32_t val;
int retval; int retval;

View File

@ -530,7 +530,7 @@ static void stellaris_set_flash_timing(struct flash_bank *bank)
target_write_u32(target, SCB_BASE | USECRL, usecrl); target_write_u32(target, SCB_BASE | USECRL, usecrl);
} }
static const unsigned rcc_xtal[32] = { static const unsigned int rcc_xtal[32] = {
[0x00] = 1000000, /* no pll */ [0x00] = 1000000, /* no pll */
[0x01] = 1843200, /* no pll */ [0x01] = 1843200, /* no pll */
[0x02] = 2000000, /* no pll */ [0x02] = 2000000, /* no pll */
@ -569,7 +569,7 @@ static void stellaris_read_clock_info(struct flash_bank *bank)
struct stellaris_flash_bank *stellaris_info = bank->driver_priv; struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
uint32_t rcc, rcc2, pllcfg, sysdiv, usesysdiv, bypass, oscsrc; uint32_t rcc, rcc2, pllcfg, sysdiv, usesysdiv, bypass, oscsrc;
unsigned xtal; unsigned int xtal;
unsigned long mainfreq; unsigned long mainfreq;
target_read_u32(target, SCB_BASE | RCC, &rcc); target_read_u32(target, SCB_BASE | RCC, &rcc);
@ -1029,7 +1029,7 @@ static int stellaris_write_block(struct flash_bank *bank,
int retval = ERROR_OK; int retval = ERROR_OK;
/* power of two, and multiple of word size */ /* power of two, and multiple of word size */
static const unsigned buf_min = 128; static const unsigned int buf_min = 128;
/* for small buffers it's faster not to download an algorithm */ /* for small buffers it's faster not to download an algorithm */
if (wcount * 4 < buf_min) if (wcount * 4 < buf_min)
@ -1056,8 +1056,8 @@ static int stellaris_write_block(struct flash_bank *bank,
target_free_working_area(target, write_algorithm); target_free_working_area(target, write_algorithm);
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
} }
LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)", LOG_DEBUG("retry target_alloc_working_area(%s, size=%" PRIu32 ")",
target_name(target), (unsigned) buffer_size); target_name(target), buffer_size);
} }
target_write_buffer(target, write_algorithm->address, target_write_buffer(target, write_algorithm->address,

View File

@ -717,7 +717,8 @@ struct range {
}; };
static void bitmap_to_ranges(unsigned long *bitmap, unsigned int nbits, static void bitmap_to_ranges(unsigned long *bitmap, unsigned int nbits,
struct range *ranges, unsigned int *ranges_count) { struct range *ranges, unsigned int *ranges_count)
{
*ranges_count = 0; *ranges_count = 0;
bool last_bit = 0, cur_bit; bool last_bit = 0, cur_bit;
for (unsigned int i = 0; i < nbits; i++) { for (unsigned int i = 0; i < nbits; i++) {

View File

@ -36,7 +36,7 @@ COMMAND_HELPER(flash_command_get_bank_probe_optional, unsigned int name_index,
if (*bank) if (*bank)
return ERROR_OK; return ERROR_OK;
unsigned bank_num; unsigned int bank_num;
COMMAND_PARSE_NUMBER(uint, name, bank_num); COMMAND_PARSE_NUMBER(uint, name, bank_num);
if (do_probe) { if (do_probe) {
@ -48,7 +48,7 @@ COMMAND_HELPER(flash_command_get_bank_probe_optional, unsigned int name_index,
} }
} }
COMMAND_HELPER(flash_command_get_bank, unsigned name_index, COMMAND_HELPER(flash_command_get_bank, unsigned int name_index,
struct flash_bank **bank) struct flash_bank **bank)
{ {
return CALL_COMMAND_HANDLER(flash_command_get_bank_probe_optional, return CALL_COMMAND_HANDLER(flash_command_get_bank_probe_optional,
@ -518,7 +518,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
uint64_t pattern; uint64_t pattern;
uint32_t count; uint32_t count;
struct target *target = get_current_target(CMD_CTX); struct target *target = get_current_target(CMD_CTX);
unsigned i; unsigned int i;
uint32_t wordsize; uint32_t wordsize;
int retval; int retval;
@ -1317,7 +1317,7 @@ COMMAND_HANDLER(handle_flash_banks_command)
if (CMD_ARGC != 0) if (CMD_ARGC != 0)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
unsigned n = 0; unsigned int n = 0;
for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++) { for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++) {
command_print(CMD, "#%d : %s (%s) at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32 ", " command_print(CMD, "#%d : %s (%s) at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32 ", "
"buswidth %u, chipwidth %u", p->bank_number, "buswidth %u, chipwidth %u", p->bank_number,

View File

@ -16,7 +16,7 @@
* ---------------------------------------------------------------------- */ * ---------------------------------------------------------------------- */
struct tms470_flash_bank { struct tms470_flash_bank {
unsigned ordinal; unsigned int ordinal;
/* device identification register */ /* device identification register */
uint32_t device_ident_reg; uint32_t device_ident_reg;
@ -239,8 +239,8 @@ static int tms470_read_part_info(struct flash_bank *bank)
break; break;
default: default:
LOG_WARNING("Could not identify part 0x%02x as a member of the TMS470 family.", LOG_WARNING("Could not identify part 0x%02" PRIx32 " as a member of the TMS470 family.",
(unsigned)part_number); part_number);
return ERROR_FLASH_OPERATION_FAILED; return ERROR_FLASH_OPERATION_FAILED;
} }
@ -391,7 +391,7 @@ static int tms470_try_flash_keys(struct target *target, const uint32_t *key_set)
/* only perform the key match when 3VSTAT is clear */ /* only perform the key match when 3VSTAT is clear */
target_read_u32(target, 0xFFE8BC0C, &fmmstat); target_read_u32(target, 0xFFE8BC0C, &fmmstat);
if (!(fmmstat & 0x08)) { if (!(fmmstat & 0x08)) {
unsigned i; unsigned int i;
uint32_t fmbptr, fmbac2, orig_fmregopt; uint32_t fmbptr, fmbac2, orig_fmregopt;
target_write_u32(target, 0xFFE8BC04, fmmstat & ~0x07); target_write_u32(target, 0xFFE8BC04, fmmstat & ~0x07);
@ -455,7 +455,7 @@ static int tms470_unlock_flash(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
const uint32_t *p_key_sets[5]; const uint32_t *p_key_sets[5];
unsigned i, key_set_count; unsigned int i, key_set_count;
if (keys_set) { if (keys_set) {
key_set_count = 5; key_set_count = 5;

View File

@ -143,28 +143,27 @@ static int isc_enter(struct flash_bank *bank)
struct xcf_status status = read_status(bank); struct xcf_status status = read_status(bank);
if (true == status.isc_mode) if (status.isc_mode)
return ERROR_OK; return ERROR_OK;
else {
struct scan_field scan;
scan.check_mask = NULL; struct scan_field scan;
scan.check_value = NULL;
scan.num_bits = 16;
scan.out_value = cmd_isc_enable;
scan.in_value = NULL;
jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE); scan.check_mask = NULL;
jtag_execute_queue(); scan.check_value = NULL;
scan.num_bits = 16;
scan.out_value = cmd_isc_enable;
scan.in_value = NULL;
status = read_status(bank); jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
if (!status.isc_mode) { jtag_execute_queue();
LOG_ERROR("*** XCF: FAILED to enter ISC mode");
return ERROR_FLASH_OPERATION_FAILED;
}
return ERROR_OK; status = read_status(bank);
if (!status.isc_mode) {
LOG_ERROR("*** XCF: FAILED to enter ISC mode");
return ERROR_FLASH_OPERATION_FAILED;
} }
return ERROR_OK;
} }
static int isc_leave(struct flash_bank *bank) static int isc_leave(struct flash_bank *bank)
@ -174,27 +173,26 @@ static int isc_leave(struct flash_bank *bank)
if (!status.isc_mode) if (!status.isc_mode)
return ERROR_OK; return ERROR_OK;
else {
struct scan_field scan;
scan.check_mask = NULL; struct scan_field scan;
scan.check_value = NULL;
scan.num_bits = 16;
scan.out_value = cmd_isc_disable;
scan.in_value = NULL;
jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE); scan.check_mask = NULL;
jtag_execute_queue(); scan.check_value = NULL;
alive_sleep(1); /* device needs 50 uS to leave ISC mode */ scan.num_bits = 16;
scan.out_value = cmd_isc_disable;
scan.in_value = NULL;
status = read_status(bank); jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
if (status.isc_mode) { jtag_execute_queue();
LOG_ERROR("*** XCF: FAILED to leave ISC mode"); alive_sleep(1); /* device needs 50 uS to leave ISC mode */
return ERROR_FLASH_OPERATION_FAILED;
}
return ERROR_OK; status = read_status(bank);
if (status.isc_mode) {
LOG_ERROR("*** XCF: FAILED to leave ISC mode");
return ERROR_FLASH_OPERATION_FAILED;
} }
return ERROR_OK;
} }
static int sector_state(uint8_t wrpt, int sector) static int sector_state(uint8_t wrpt, int sector)

View File

@ -84,7 +84,7 @@ static int xmc1xxx_erase(struct flash_bank *bank, unsigned int first,
struct working_area *workarea; struct working_area *workarea;
struct reg_param reg_params[3]; struct reg_param reg_params[3];
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
unsigned i; unsigned int i;
int retval; int retval;
const uint8_t erase_code[] = { const uint8_t erase_code[] = {
#include "../../../contrib/loaders/flash/xmc1xxx/erase.inc" #include "../../../contrib/loaders/flash/xmc1xxx/erase.inc"
@ -159,7 +159,7 @@ static int xmc1xxx_erase_check(struct flash_bank *bank)
struct reg_param reg_params[3]; struct reg_param reg_params[3];
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
uint16_t val; uint16_t val;
unsigned i; unsigned int i;
int retval; int retval;
const uint8_t erase_check_code[] = { const uint8_t erase_check_code[] = {
#include "../../../contrib/loaders/flash/xmc1xxx/erase_check.inc" #include "../../../contrib/loaders/flash/xmc1xxx/erase_check.inc"
@ -245,7 +245,7 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
struct reg_param reg_params[4]; struct reg_param reg_params[4];
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
uint32_t block_count = DIV_ROUND_UP(byte_count, NVM_BLOCK_SIZE); uint32_t block_count = DIV_ROUND_UP(byte_count, NVM_BLOCK_SIZE);
unsigned i; unsigned int i;
int retval; int retval;
const uint8_t write_code[] = { const uint8_t write_code[] = {
#include "../../../contrib/loaders/flash/xmc1xxx/write.inc" #include "../../../contrib/loaders/flash/xmc1xxx/write.inc"

View File

@ -24,7 +24,7 @@
#define IS_PWR_OF_2(x) \ #define IS_PWR_OF_2(x) \
({ \ ({ \
typeof(x) _x = (x); \ typeof(x) _x = (x); \
_x == 0 || (_x & (_x - 1)) == 0; \ _x != 0 && (_x & (_x - 1)) == 0; \
}) })
#endif /* OPENOCD_HELPER_ALIGN_H */ #endif /* OPENOCD_HELPER_ALIGN_H */

View File

@ -40,7 +40,7 @@ static const char hex_digits[] = {
'a', 'b', 'c', 'd', 'e', 'f' 'a', 'b', 'c', 'd', 'e', 'f'
}; };
void *buf_cpy(const void *from, void *_to, unsigned size) void *buf_cpy(const void *from, void *_to, unsigned int size)
{ {
if (!from || !_to) if (!from || !_to)
return NULL; return NULL;
@ -49,7 +49,7 @@ void *buf_cpy(const void *from, void *_to, unsigned size)
memcpy(_to, from, DIV_ROUND_UP(size, 8)); memcpy(_to, from, DIV_ROUND_UP(size, 8));
/* mask out bits that don't belong to the buffer */ /* mask out bits that don't belong to the buffer */
unsigned trailing_bits = size % 8; unsigned int trailing_bits = size % 8;
if (trailing_bits) { if (trailing_bits) {
uint8_t *to = _to; uint8_t *to = _to;
to[size / 8] &= (1 << trailing_bits) - 1; to[size / 8] &= (1 << trailing_bits) - 1;
@ -61,22 +61,22 @@ static bool buf_eq_masked(uint8_t a, uint8_t b, uint8_t m)
{ {
return (a & m) == (b & m); return (a & m) == (b & m);
} }
static bool buf_eq_trailing(uint8_t a, uint8_t b, uint8_t m, unsigned trailing) static bool buf_eq_trailing(uint8_t a, uint8_t b, uint8_t m, unsigned int trailing)
{ {
uint8_t mask = (1 << trailing) - 1; uint8_t mask = (1 << trailing) - 1;
return buf_eq_masked(a, b, mask & m); return buf_eq_masked(a, b, mask & m);
} }
bool buf_eq(const void *_buf1, const void *_buf2, unsigned size) bool buf_eq(const void *_buf1, const void *_buf2, unsigned int size)
{ {
if (!_buf1 || !_buf2) if (!_buf1 || !_buf2)
return _buf1 == _buf2; return _buf1 == _buf2;
unsigned last = size / 8; unsigned int last = size / 8;
if (memcmp(_buf1, _buf2, last) != 0) if (memcmp(_buf1, _buf2, last) != 0)
return false; return false;
unsigned trailing = size % 8; unsigned int trailing = size % 8;
if (!trailing) if (!trailing)
return true; return true;
@ -85,24 +85,24 @@ bool buf_eq(const void *_buf1, const void *_buf2, unsigned size)
} }
bool buf_eq_mask(const void *_buf1, const void *_buf2, bool buf_eq_mask(const void *_buf1, const void *_buf2,
const void *_mask, unsigned size) const void *_mask, unsigned int size)
{ {
if (!_buf1 || !_buf2) if (!_buf1 || !_buf2)
return _buf1 == _buf2 && _buf1 == _mask; return _buf1 == _buf2 && _buf1 == _mask;
const uint8_t *buf1 = _buf1, *buf2 = _buf2, *mask = _mask; const uint8_t *buf1 = _buf1, *buf2 = _buf2, *mask = _mask;
unsigned last = size / 8; unsigned int last = size / 8;
for (unsigned i = 0; i < last; i++) { for (unsigned int i = 0; i < last; i++) {
if (!buf_eq_masked(buf1[i], buf2[i], mask[i])) if (!buf_eq_masked(buf1[i], buf2[i], mask[i]))
return false; return false;
} }
unsigned trailing = size % 8; unsigned int trailing = size % 8;
if (!trailing) if (!trailing)
return true; return true;
return buf_eq_trailing(buf1[last], buf2[last], mask[last], trailing); return buf_eq_trailing(buf1[last], buf2[last], mask[last], trailing);
} }
void *buf_set_ones(void *_buf, unsigned size) void *buf_set_ones(void *_buf, unsigned int size)
{ {
uint8_t *buf = _buf; uint8_t *buf = _buf;
if (!buf) if (!buf)
@ -110,19 +110,19 @@ void *buf_set_ones(void *_buf, unsigned size)
memset(buf, 0xff, size / 8); memset(buf, 0xff, size / 8);
unsigned trailing_bits = size % 8; unsigned int trailing_bits = size % 8;
if (trailing_bits) if (trailing_bits)
buf[size / 8] = (1 << trailing_bits) - 1; buf[size / 8] = (1 << trailing_bits) - 1;
return buf; return buf;
} }
void *buf_set_buf(const void *_src, unsigned src_start, void *buf_set_buf(const void *_src, unsigned int src_start,
void *_dst, unsigned dst_start, unsigned len) void *_dst, unsigned int dst_start, unsigned int len)
{ {
const uint8_t *src = _src; const uint8_t *src = _src;
uint8_t *dst = _dst; uint8_t *dst = _dst;
unsigned i, sb, db, sq, dq, lb, lq; unsigned int i, sb, db, sq, dq, lb, lq;
sb = src_start / 8; sb = src_start / 8;
db = dst_start / 8; db = dst_start / 8;
@ -175,13 +175,13 @@ uint32_t flip_u32(uint32_t value, unsigned int num)
return c; return c;
} }
char *buf_to_hex_str(const void *_buf, unsigned buf_len) char *buf_to_hex_str(const void *_buf, unsigned int buf_len)
{ {
unsigned len_bytes = DIV_ROUND_UP(buf_len, 8); unsigned int len_bytes = DIV_ROUND_UP(buf_len, 8);
char *str = calloc(len_bytes * 2 + 1, 1); char *str = calloc(len_bytes * 2 + 1, 1);
const uint8_t *buf = _buf; const uint8_t *buf = _buf;
for (unsigned i = 0; i < len_bytes; i++) { for (unsigned int i = 0; i < len_bytes; i++) {
uint8_t tmp = buf[len_bytes - i - 1]; uint8_t tmp = buf[len_bytes - i - 1];
if ((i == 0) && (buf_len % 8)) if ((i == 0) && (buf_len % 8))
tmp &= (0xff >> (8 - (buf_len % 8))); tmp &= (0xff >> (8 - (buf_len % 8)));
@ -289,8 +289,8 @@ void bit_copy_queue_init(struct bit_copy_queue *q)
INIT_LIST_HEAD(&q->list); INIT_LIST_HEAD(&q->list);
} }
int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned dst_offset, const uint8_t *src, int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned int dst_offset, const uint8_t *src,
unsigned src_offset, unsigned bit_count) unsigned int src_offset, unsigned int bit_count)
{ {
struct bit_copy_queue_entry *qe = malloc(sizeof(*qe)); struct bit_copy_queue_entry *qe = malloc(sizeof(*qe));
if (!qe) if (!qe)
@ -395,12 +395,12 @@ size_t hexify(char *hex, const uint8_t *bin, size_t count, size_t length)
return i; return i;
} }
void buffer_shr(void *_buf, unsigned buf_len, unsigned count) void buffer_shr(void *_buf, unsigned int buf_len, unsigned int count)
{ {
unsigned i; unsigned int i;
unsigned char *buf = _buf; unsigned char *buf = _buf;
unsigned bytes_to_remove; unsigned int bytes_to_remove;
unsigned shift; unsigned int shift;
bytes_to_remove = count / 8; bytes_to_remove = count / 8;
shift = count - (bytes_to_remove * 8); shift = count - (bytes_to_remove * 8);

View File

@ -32,7 +32,7 @@
* @param value Up to 32 bits that will be copied to _buffer. * @param value Up to 32 bits that will be copied to _buffer.
*/ */
static inline void buf_set_u32(uint8_t *_buffer, static inline void buf_set_u32(uint8_t *_buffer,
unsigned first, unsigned num, uint32_t value) unsigned int first, unsigned int num, uint32_t value)
{ {
assert(num >= 1 && num <= 32); assert(num >= 1 && num <= 32);
uint8_t *buffer = _buffer; uint8_t *buffer = _buffer;
@ -43,7 +43,7 @@ static inline void buf_set_u32(uint8_t *_buffer,
buffer[1] = (value >> 8) & 0xff; buffer[1] = (value >> 8) & 0xff;
buffer[0] = (value >> 0) & 0xff; buffer[0] = (value >> 0) & 0xff;
} else { } else {
for (unsigned i = first; i < first + num; i++) { for (unsigned int i = first; i < first + num; i++) {
if (((value >> (i - first)) & 1) == 1) if (((value >> (i - first)) & 1) == 1)
buffer[i / 8] |= 1 << (i % 8); buffer[i / 8] |= 1 << (i % 8);
else else
@ -63,7 +63,7 @@ static inline void buf_set_u32(uint8_t *_buffer,
* @param value Up to 64 bits that will be copied to _buffer. * @param value Up to 64 bits that will be copied to _buffer.
*/ */
static inline void buf_set_u64(uint8_t *_buffer, static inline void buf_set_u64(uint8_t *_buffer,
unsigned first, unsigned num, uint64_t value) unsigned int first, unsigned int num, uint64_t value)
{ {
assert(num >= 1 && num <= 64); assert(num >= 1 && num <= 64);
uint8_t *buffer = _buffer; uint8_t *buffer = _buffer;
@ -83,7 +83,7 @@ static inline void buf_set_u64(uint8_t *_buffer,
buffer[1] = (value >> 8) & 0xff; buffer[1] = (value >> 8) & 0xff;
buffer[0] = (value >> 0) & 0xff; buffer[0] = (value >> 0) & 0xff;
} else { } else {
for (unsigned i = first; i < first + num; i++) { for (unsigned int i = first; i < first + num; i++) {
if (((value >> (i - first)) & 1) == 1) if (((value >> (i - first)) & 1) == 1)
buffer[i / 8] |= 1 << (i % 8); buffer[i / 8] |= 1 << (i % 8);
else else
@ -102,7 +102,7 @@ static inline void buf_set_u64(uint8_t *_buffer,
* @returns Up to 32-bits that were read from @c _buffer. * @returns Up to 32-bits that were read from @c _buffer.
*/ */
static inline uint32_t buf_get_u32(const uint8_t *_buffer, static inline uint32_t buf_get_u32(const uint8_t *_buffer,
unsigned first, unsigned num) unsigned int first, unsigned int num)
{ {
assert(num >= 1 && num <= 32); assert(num >= 1 && num <= 32);
const uint8_t *buffer = _buffer; const uint8_t *buffer = _buffer;
@ -114,7 +114,7 @@ static inline uint32_t buf_get_u32(const uint8_t *_buffer,
(((uint32_t)buffer[0]) << 0); (((uint32_t)buffer[0]) << 0);
} else { } else {
uint32_t result = 0; uint32_t result = 0;
for (unsigned i = first; i < first + num; i++) { for (unsigned int i = first; i < first + num; i++) {
if (((buffer[i / 8] >> (i % 8)) & 1) == 1) if (((buffer[i / 8] >> (i % 8)) & 1) == 1)
result |= 1U << (i - first); result |= 1U << (i - first);
} }
@ -132,7 +132,7 @@ static inline uint32_t buf_get_u32(const uint8_t *_buffer,
* @returns Up to 64-bits that were read from @c _buffer. * @returns Up to 64-bits that were read from @c _buffer.
*/ */
static inline uint64_t buf_get_u64(const uint8_t *_buffer, static inline uint64_t buf_get_u64(const uint8_t *_buffer,
unsigned first, unsigned num) unsigned int first, unsigned int num)
{ {
assert(num >= 1 && num <= 64); assert(num >= 1 && num <= 64);
const uint8_t *buffer = _buffer; const uint8_t *buffer = _buffer;
@ -153,7 +153,7 @@ static inline uint64_t buf_get_u64(const uint8_t *_buffer,
(((uint64_t)buffer[0]) << 0)); (((uint64_t)buffer[0]) << 0));
} else { } else {
uint64_t result = 0; uint64_t result = 0;
for (unsigned i = first; i < first + num; i++) { for (unsigned int i = first; i < first + num; i++) {
if (((buffer[i / 8] >> (i % 8)) & 1) == 1) if (((buffer[i / 8] >> (i % 8)) & 1) == 1)
result = result | ((uint64_t)1 << (uint64_t)(i - first)); result = result | ((uint64_t)1 << (uint64_t)(i - first));
} }
@ -170,11 +170,11 @@ static inline uint64_t buf_get_u64(const uint8_t *_buffer,
* @param width The number of bits in value (2-32). * @param width The number of bits in value (2-32).
* @returns A 32-bit word with @c value in reversed bit-order. * @returns A 32-bit word with @c value in reversed bit-order.
*/ */
uint32_t flip_u32(uint32_t value, unsigned width); uint32_t flip_u32(uint32_t value, unsigned int width);
bool buf_eq(const void *buf1, const void *buf2, unsigned size); bool buf_eq(const void *buf1, const void *buf2, unsigned int size);
bool buf_eq_mask(const void *buf1, const void *buf2, bool buf_eq_mask(const void *buf1, const void *buf2,
const void *mask, unsigned size); const void *mask, unsigned int size);
/** /**
* Copies @c size bits out of @c from and into @c to. Any extra * Copies @c size bits out of @c from and into @c to. Any extra
@ -183,7 +183,7 @@ bool buf_eq_mask(const void *buf1, const void *buf2,
* @param to The buffer that will receive the copy of @c from. * @param to The buffer that will receive the copy of @c from.
* @param size The number of bits to copy. * @param size The number of bits to copy.
*/ */
void *buf_cpy(const void *from, void *to, unsigned size); void *buf_cpy(const void *from, void *to, unsigned int size);
/** /**
* Set the contents of @c buf with @c count bits, all set to 1. * Set the contents of @c buf with @c count bits, all set to 1.
@ -191,10 +191,10 @@ void *buf_cpy(const void *from, void *to, unsigned size);
* @param size The number of bits. * @param size The number of bits.
* @returns The original buffer (@c buf). * @returns The original buffer (@c buf).
*/ */
void *buf_set_ones(void *buf, unsigned size); void *buf_set_ones(void *buf, unsigned int size);
void *buf_set_buf(const void *src, unsigned src_start, void *buf_set_buf(const void *src, unsigned int src_start,
void *dst, unsigned dst_start, unsigned len); void *dst, unsigned int dst_start, unsigned int len);
/** /**
* Parse an unsigned number (provided as a zero-terminated string) * Parse an unsigned number (provided as a zero-terminated string)
@ -207,7 +207,7 @@ void *buf_set_buf(const void *src, unsigned src_start,
*/ */
int str_to_buf(const char *str, void *_buf, unsigned int buf_bitsize); int str_to_buf(const char *str, void *_buf, unsigned int buf_bitsize);
char *buf_to_hex_str(const void *buf, unsigned size); char *buf_to_hex_str(const void *buf, unsigned int size);
/* read a uint32_t from a buffer in target memory endianness */ /* read a uint32_t from a buffer in target memory endianness */
static inline uint32_t fast_target_buffer_get_u32(const void *p, bool le) static inline uint32_t fast_target_buffer_get_u32(const void *p, bool le)
@ -215,8 +215,8 @@ static inline uint32_t fast_target_buffer_get_u32(const void *p, bool le)
return le ? le_to_h_u32(p) : be_to_h_u32(p); return le ? le_to_h_u32(p) : be_to_h_u32(p);
} }
static inline void bit_copy(uint8_t *dst, unsigned dst_offset, const uint8_t *src, static inline void bit_copy(uint8_t *dst, unsigned int dst_offset, const uint8_t *src,
unsigned src_offset, unsigned bit_count) unsigned int src_offset, unsigned int bit_count)
{ {
buf_set_buf(src, src_offset, dst, dst_offset, bit_count); buf_set_buf(src, src_offset, dst, dst_offset, bit_count);
} }
@ -227,16 +227,16 @@ struct bit_copy_queue {
struct bit_copy_queue_entry { struct bit_copy_queue_entry {
uint8_t *dst; uint8_t *dst;
unsigned dst_offset; unsigned int dst_offset;
const uint8_t *src; const uint8_t *src;
unsigned src_offset; unsigned int src_offset;
unsigned bit_count; unsigned int bit_count;
struct list_head list; struct list_head list;
}; };
void bit_copy_queue_init(struct bit_copy_queue *q); void bit_copy_queue_init(struct bit_copy_queue *q);
int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned dst_offset, const uint8_t *src, int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned int dst_offset, const uint8_t *src,
unsigned src_offset, unsigned bit_count); unsigned int src_offset, unsigned int bit_count);
void bit_copy_execute(struct bit_copy_queue *q); void bit_copy_execute(struct bit_copy_queue *q);
void bit_copy_discard(struct bit_copy_queue *q); void bit_copy_discard(struct bit_copy_queue *q);
@ -244,6 +244,6 @@ void bit_copy_discard(struct bit_copy_queue *q);
* used in ti-icdi driver and gdb server */ * used in ti-icdi driver and gdb server */
size_t unhexify(uint8_t *bin, const char *hex, size_t count); size_t unhexify(uint8_t *bin, const char *hex, size_t count);
size_t hexify(char *hex, const uint8_t *bin, size_t count, size_t out_maxlen); size_t hexify(char *hex, const uint8_t *bin, size_t count, size_t out_maxlen);
void buffer_shr(void *_buf, unsigned buf_len, unsigned count); void buffer_shr(void *_buf, unsigned int buf_len, unsigned int count);
#endif /* OPENOCD_HELPER_BINARYBUFFER_H */ #endif /* OPENOCD_HELPER_BINARYBUFFER_H */

View File

@ -58,7 +58,7 @@ void *jimcmd_privdata(Jim_Cmd *cmd)
return cmd->isproc ? NULL : cmd->u.native.privData; return cmd->isproc ? NULL : cmd->u.native.privData;
} }
static void tcl_output(void *privData, const char *file, unsigned line, static void tcl_output(void *privData, const char *file, unsigned int line,
const char *function, const char *string) const char *function, const char *string)
{ {
struct log_capture_state *state = privData; struct log_capture_state *state = privData;
@ -144,7 +144,7 @@ static void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const
return; return;
char *dbg = alloc_printf("command -"); char *dbg = alloc_printf("command -");
for (unsigned i = 0; i < argc; i++) { for (unsigned int i = 0; i < argc; i++) {
const char *w = Jim_GetString(argv[i], NULL); const char *w = Jim_GetString(argv[i], NULL);
char *t = alloc_printf("%s %s", dbg, w); char *t = alloc_printf("%s %s", dbg, w);
free(dbg); free(dbg);
@ -288,7 +288,7 @@ int __register_commands(struct command_context *cmd_ctx, const char *cmd_prefix,
struct target *override_target) struct target *override_target)
{ {
int retval = ERROR_OK; int retval = ERROR_OK;
unsigned i; unsigned int i;
for (i = 0; cmds[i].name || cmds[i].chain; i++) { for (i = 0; cmds[i].name || cmds[i].chain; i++) {
const struct command_registration *cr = cmds + i; const struct command_registration *cr = cmds + i;
@ -323,7 +323,7 @@ int __register_commands(struct command_context *cmd_ctx, const char *cmd_prefix,
} }
} }
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
for (unsigned j = 0; j < i; j++) for (unsigned int j = 0; j < i; j++)
unregister_command(cmd_ctx, cmd_prefix, cmds[j].name); unregister_command(cmd_ctx, cmd_prefix, cmds[j].name);
} }
return retval; return retval;
@ -728,12 +728,12 @@ static COMMAND_HELPER(command_help_show_list, bool show_help, const char *cmd_ma
#define HELP_LINE_WIDTH(_n) (int)(76 - (2 * _n)) #define HELP_LINE_WIDTH(_n) (int)(76 - (2 * _n))
static void command_help_show_indent(unsigned n) static void command_help_show_indent(unsigned int n)
{ {
for (unsigned i = 0; i < n; i++) for (unsigned int i = 0; i < n; i++)
LOG_USER_N(" "); LOG_USER_N(" ");
} }
static void command_help_show_wrap(const char *str, unsigned n, unsigned n2) static void command_help_show_wrap(const char *str, unsigned int n, unsigned int n2)
{ {
const char *cp = str, *last = str; const char *cp = str, *last = str;
while (*cp) { while (*cp) {
@ -1317,7 +1317,7 @@ DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MIN, LLONG_MAX)
#define DEFINE_PARSE_ULONGLONG(name, type, min, max) \ #define DEFINE_PARSE_ULONGLONG(name, type, min, max) \
DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long long, _ullong) DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long long, _ullong)
DEFINE_PARSE_ULONGLONG(_uint, unsigned, 0, UINT_MAX) DEFINE_PARSE_ULONGLONG(_uint, unsigned int, 0, UINT_MAX)
DEFINE_PARSE_ULONGLONG(_u64, uint64_t, 0, UINT64_MAX) DEFINE_PARSE_ULONGLONG(_u64, uint64_t, 0, UINT64_MAX)
DEFINE_PARSE_ULONGLONG(_u32, uint32_t, 0, UINT32_MAX) DEFINE_PARSE_ULONGLONG(_u32, uint32_t, 0, UINT32_MAX)
DEFINE_PARSE_ULONGLONG(_u16, uint16_t, 0, UINT16_MAX) DEFINE_PARSE_ULONGLONG(_u16, uint16_t, 0, UINT16_MAX)

View File

@ -77,7 +77,7 @@ struct command_invocation {
struct command_context *ctx; struct command_context *ctx;
struct command *current; struct command *current;
const char *name; const char *name;
unsigned argc; unsigned int argc;
const char **argv; const char **argv;
Jim_Obj * const *jimtcl_argv; Jim_Obj * const *jimtcl_argv;
Jim_Obj *output; Jim_Obj *output;
@ -414,7 +414,7 @@ int parse_llong(const char *str, long long *ul);
#define DECLARE_PARSE_WRAPPER(name, type) \ #define DECLARE_PARSE_WRAPPER(name, type) \
int parse ## name(const char *str, type * ul) int parse ## name(const char *str, type * ul)
DECLARE_PARSE_WRAPPER(_uint, unsigned); DECLARE_PARSE_WRAPPER(_uint, unsigned int);
DECLARE_PARSE_WRAPPER(_u64, uint64_t); DECLARE_PARSE_WRAPPER(_u64, uint64_t);
DECLARE_PARSE_WRAPPER(_u32, uint32_t); DECLARE_PARSE_WRAPPER(_u32, uint32_t);
DECLARE_PARSE_WRAPPER(_u16, uint16_t); DECLARE_PARSE_WRAPPER(_u16, uint16_t);

View File

@ -11,6 +11,7 @@
#ifndef OPENOCD_HELPER_CONFIGURATION_H #ifndef OPENOCD_HELPER_CONFIGURATION_H
#define OPENOCD_HELPER_CONFIGURATION_H #define OPENOCD_HELPER_CONFIGURATION_H
#include <stdio.h>
#include <helper/command.h> #include <helper/command.h>
int parse_cmdline_args(struct command_context *cmd_ctx, int parse_cmdline_args(struct command_context *cmd_ctx,

View File

@ -8,7 +8,7 @@
* identification code list, please visit the JEDEC website at www.jedec.org . * identification code list, please visit the JEDEC website at www.jedec.org .
*/ */
/* This file is aligned to revision JEP106BJ.01 July 2024. */ /* This file is aligned to revision JEP106BK September 2024. */
[0][0x01 - 1] = "AMD", [0][0x01 - 1] = "AMD",
[0][0x02 - 1] = "AMI", [0][0x02 - 1] = "AMI",
@ -177,7 +177,7 @@
[1][0x27 - 1] = "Cabletron", [1][0x27 - 1] = "Cabletron",
[1][0x28 - 1] = "STEC (Silicon Tech)", [1][0x28 - 1] = "STEC (Silicon Tech)",
[1][0x29 - 1] = "Vanguard", [1][0x29 - 1] = "Vanguard",
[1][0x2a - 1] = "Hagiwara Sys-Com", [1][0x2a - 1] = "Hagiwara Solutions Co Ltd",
[1][0x2b - 1] = "Vantis", [1][0x2b - 1] = "Vantis",
[1][0x2c - 1] = "Celestica", [1][0x2c - 1] = "Celestica",
[1][0x2d - 1] = "Century", [1][0x2d - 1] = "Century",
@ -1373,7 +1373,7 @@
[10][0x65 - 1] = "Esperanto Technologies", [10][0x65 - 1] = "Esperanto Technologies",
[10][0x66 - 1] = "JinSheng Electronic (Shenzhen) Co Ltd", [10][0x66 - 1] = "JinSheng Electronic (Shenzhen) Co Ltd",
[10][0x67 - 1] = "Shenzhen Shi Bolunshuai Technology", [10][0x67 - 1] = "Shenzhen Shi Bolunshuai Technology",
[10][0x68 - 1] = "Shanghai Rui Zuan Information Tech", [10][0x68 - 1] = "Shanghai Rui Xuan Information Tech",
[10][0x69 - 1] = "Fraunhofer IIS", [10][0x69 - 1] = "Fraunhofer IIS",
[10][0x6a - 1] = "Kandou Bus SA", [10][0x6a - 1] = "Kandou Bus SA",
[10][0x6b - 1] = "Acer", [10][0x6b - 1] = "Acer",
@ -1653,9 +1653,9 @@
[13][0x03 - 1] = "Shenzhen Feisrike Technology Co Ltd", [13][0x03 - 1] = "Shenzhen Feisrike Technology Co Ltd",
[13][0x04 - 1] = "Shenzhen Sunhome Electronics Co Ltd", [13][0x04 - 1] = "Shenzhen Sunhome Electronics Co Ltd",
[13][0x05 - 1] = "Global Mixed-mode Technology Inc", [13][0x05 - 1] = "Global Mixed-mode Technology Inc",
[13][0x06 - 1] = "Shenzhen Weien Electronics Co. Ltd.", [13][0x06 - 1] = "Shenzhen Weien Electronics Co Ltd.",
[13][0x07 - 1] = "Shenzhen Cooyes Technology Co Ltd", [13][0x07 - 1] = "Shenzhen Cooyes Technology Co Ltd",
[13][0x08 - 1] = "Keymos Electronics Co., Limited", [13][0x08 - 1] = "ShenZhen ChaoYing ZhiNeng Technology",
[13][0x09 - 1] = "E-Rockic Technology Company Limited", [13][0x09 - 1] = "E-Rockic Technology Company Limited",
[13][0x0a - 1] = "Aerospace Science Memory Shenzhen", [13][0x0a - 1] = "Aerospace Science Memory Shenzhen",
[13][0x0b - 1] = "Shenzhen Quanji Technology Co Ltd", [13][0x0b - 1] = "Shenzhen Quanji Technology Co Ltd",
@ -1898,7 +1898,7 @@
[14][0x7a - 1] = "Cornelis Networks Inc", [14][0x7a - 1] = "Cornelis Networks Inc",
[14][0x7b - 1] = "WingSemi Technologies Co Ltd", [14][0x7b - 1] = "WingSemi Technologies Co Ltd",
[14][0x7c - 1] = "ForwardEdge ASIC", [14][0x7c - 1] = "ForwardEdge ASIC",
[14][0x7d - 1] = "Beijing Future Imprint Technology Co Ltd", [14][0x7d - 1] = "Beijing Future Signet Technology Co Ltd",
[14][0x7e - 1] = "Fine Made Microelectronics Group Co Ltd", [14][0x7e - 1] = "Fine Made Microelectronics Group Co Ltd",
[15][0x01 - 1] = "Changxin Memory Technology (Shanghai)", [15][0x01 - 1] = "Changxin Memory Technology (Shanghai)",
[15][0x02 - 1] = "Synconv", [15][0x02 - 1] = "Synconv",
@ -1919,7 +1919,7 @@
[15][0x11 - 1] = "Guangzhou Beimu Technology Co., Ltd", [15][0x11 - 1] = "Guangzhou Beimu Technology Co., Ltd",
[15][0x12 - 1] = "Rays Semiconductor Nanjing Co Ltd", [15][0x12 - 1] = "Rays Semiconductor Nanjing Co Ltd",
[15][0x13 - 1] = "Milli-Centi Intelligence Technology Jiangsu", [15][0x13 - 1] = "Milli-Centi Intelligence Technology Jiangsu",
[15][0x14 - 1] = "Zilia Technologioes", [15][0x14 - 1] = "Zilia Technologies",
[15][0x15 - 1] = "Incore Semiconductors", [15][0x15 - 1] = "Incore Semiconductors",
[15][0x16 - 1] = "Kinetic Technologies", [15][0x16 - 1] = "Kinetic Technologies",
[15][0x17 - 1] = "Nanjing Houmo Technology Co Ltd", [15][0x17 - 1] = "Nanjing Houmo Technology Co Ltd",
@ -1963,4 +1963,57 @@
[15][0x3d - 1] = "Shenzhen Titan Micro Electronics Co Ltd", [15][0x3d - 1] = "Shenzhen Titan Micro Electronics Co Ltd",
[15][0x3e - 1] = "Shenzhen Macroflash Technology Co Ltd", [15][0x3e - 1] = "Shenzhen Macroflash Technology Co Ltd",
[15][0x3f - 1] = "Advantech Group", [15][0x3f - 1] = "Advantech Group",
[15][0x40 - 1] = "Shenzhen Xingjiachen Electronics Co Ltd",
[15][0x41 - 1] = "CHUQI",
[15][0x42 - 1] = "Dongguan Liesun Trading Co Ltd",
[15][0x43 - 1] = "Shenzhen Miuman Technology Co Ltd",
[15][0x44 - 1] = "Shenzhen Techwinsemi Technology Twsc",
[15][0x45 - 1] = "Encharge AI Inc",
[15][0x46 - 1] = "Shenzhen Zhenchuang Electronics Co Ltd",
[15][0x47 - 1] = "Giant Chip Co. Ltd",
[15][0x48 - 1] = "Shenzhen Runner Semiconductor Co Ltd",
[15][0x49 - 1] = "Scalinx",
[15][0x4a - 1] = "Shenzhen Lanqi Electronics Co Ltd",
[15][0x4b - 1] = "CoreComm Technology Co Ltd",
[15][0x4c - 1] = "DLI Memory",
[15][0x4d - 1] = "Shenzhen Fidat Technology Co Ltd",
[15][0x4e - 1] = "Hubei Yangtze Mason Semiconductor Tech",
[15][0x4f - 1] = "Flastor",
[15][0x50 - 1] = "PIRATEMAN",
[15][0x51 - 1] = "Barrie Technologies Co Ltd",
[15][0x52 - 1] = "Dynacard Co Ltd",
[15][0x53 - 1] = "Rivian Automotive",
[15][0x54 - 1] = "Shenzhen Fidat Technology Co Ltd",
[15][0x55 - 1] = "Zhejang Weiming Semiconductor Co Ltd",
[15][0x56 - 1] = "Shenzhen Xinhua Micro Technology Co Ltd",
[15][0x57 - 1] = "Duvonn Electronic Technology Co Ltd",
[15][0x58 - 1] = "Shenzhen Xinchang Technology Co Ltd",
[15][0x59 - 1] = "Leidos",
[15][0x5a - 1] = "Keepixo",
[15][0x5b - 1] = "Applied Brain Research Inc",
[15][0x5c - 1] = "Maxio Technology (Hangzhou) Co Ltd",
[15][0x5d - 1] = "HK DCHIP Technology Limited",
[15][0x5e - 1] = "Hitachi-LG Data Storage",
[15][0x5f - 1] = "Shenzhen Huadian Communication Co Ltd",
[15][0x60 - 1] = "Achieve Memory Technology (Suzhou) Co",
[15][0x61 - 1] = "Shenzhen Think Future Semiconductor Co",
[15][0x62 - 1] = "Innosilicon",
[15][0x63 - 1] = "Shenzhen Weilida Technology Co Ltd",
[15][0x64 - 1] = "Agrade Storage (Shenzhen) Co Ltd",
[15][0x65 - 1] = "Shenzhen Worldshine Data Technology Co",
[15][0x66 - 1] = "Mindgrove Technologies",
[15][0x67 - 1] = "BYD Semiconductor Co Ltd",
[15][0x68 - 1] = "Chipsine Semiconductor (Suzhou) Co Ltd",
[15][0x69 - 1] = "Shen Zhen Shi Xun He Shi Ji Dian Zi You",
[15][0x6a - 1] = "Shenzhen Jindacheng Computer Co Ltd",
[15][0x6b - 1] = "Shenzhen Baina Haichuan Technology Co",
[15][0x6c - 1] = "Shanghai Hengshi Electronic Technology",
[15][0x6d - 1] = "Beijing Boyu Tuxian Technology Co Ltd",
[15][0x6e - 1] = "China Chips Star Semiconductor Co Ltd",
[15][0x6f - 1] = "Shenzhen Shenghuacan Technology Co",
[15][0x70 - 1] = "Kinara Inc",
[15][0x71 - 1] = "TRASNA Semiconductor",
[15][0x72 - 1] = "KEYSOM",
[15][0x73 - 1] = "Shenzhen YYF Info Tech Co Ltd",
[15][0x74 - 1] = "Sharetronics Data Technology Co Ltd",
/* EOF */ /* EOF */

View File

@ -21,6 +21,7 @@
#endif #endif
#include "jim-nvp.h" #include "jim-nvp.h"
#include <stdio.h>
#include <string.h> #include <string.h>
int jim_get_nvp(Jim_Interp *interp, int jim_get_nvp(Jim_Interp *interp,

View File

@ -53,7 +53,7 @@ static const char * const log_strings[6] = {
static int count; static int count;
/* forward the log to the listeners */ /* forward the log to the listeners */
static void log_forward(const char *file, unsigned line, const char *function, const char *string) static void log_forward(const char *file, unsigned int line, const char *function, const char *string)
{ {
struct log_callback *cb, *next; struct log_callback *cb, *next;
cb = log_callbacks; cb = log_callbacks;
@ -133,7 +133,7 @@ static void log_puts(enum log_levels level,
void log_printf(enum log_levels level, void log_printf(enum log_levels level,
const char *file, const char *file,
unsigned line, unsigned int line,
const char *function, const char *function,
const char *format, const char *format,
...) ...)
@ -156,7 +156,7 @@ void log_printf(enum log_levels level,
va_end(ap); va_end(ap);
} }
void log_vprintf_lf(enum log_levels level, const char *file, unsigned line, void log_vprintf_lf(enum log_levels level, const char *file, unsigned int line,
const char *function, const char *format, va_list args) const char *function, const char *format, va_list args)
{ {
char *tmp; char *tmp;
@ -182,7 +182,7 @@ void log_vprintf_lf(enum log_levels level, const char *file, unsigned line,
void log_printf_lf(enum log_levels level, void log_printf_lf(enum log_levels level,
const char *file, const char *file,
unsigned line, unsigned int line,
const char *function, const char *function,
const char *format, const char *format,
...) ...)
@ -505,7 +505,7 @@ void log_socket_error(const char *socket_desc)
* Find the first non-printable character in the char buffer, return a pointer to it. * Find the first non-printable character in the char buffer, return a pointer to it.
* If no such character exists, return NULL. * If no such character exists, return NULL.
*/ */
char *find_nonprint_char(char *buf, unsigned buf_len) const char *find_nonprint_char(const char *buf, unsigned int buf_len)
{ {
for (unsigned int i = 0; i < buf_len; i++) { for (unsigned int i = 0; i < buf_len; i++) {
if (!isprint(buf[i])) if (!isprint(buf[i]))

View File

@ -48,12 +48,12 @@ enum log_levels {
LOG_LVL_DEBUG_IO = 4, LOG_LVL_DEBUG_IO = 4,
}; };
void log_printf(enum log_levels level, const char *file, unsigned line, void log_printf(enum log_levels level, const char *file, unsigned int line,
const char *function, const char *format, ...) const char *function, const char *format, ...)
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6))); __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6)));
void log_vprintf_lf(enum log_levels level, const char *file, unsigned line, void log_vprintf_lf(enum log_levels level, const char *file, unsigned int line,
const char *function, const char *format, va_list args); const char *function, const char *format, va_list args);
void log_printf_lf(enum log_levels level, const char *file, unsigned line, void log_printf_lf(enum log_levels level, const char *file, unsigned int line,
const char *function, const char *format, ...) const char *function, const char *format, ...)
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6))); __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6)));
@ -73,7 +73,7 @@ void busy_sleep(uint64_t ms);
void log_socket_error(const char *socket_desc); void log_socket_error(const char *socket_desc);
typedef void (*log_callback_fn)(void *priv, const char *file, unsigned line, typedef void (*log_callback_fn)(void *priv, const char *file, unsigned int line,
const char *function, const char *string); const char *function, const char *string);
struct log_callback { struct log_callback {
@ -89,7 +89,7 @@ char *alloc_vprintf(const char *fmt, va_list ap);
char *alloc_printf(const char *fmt, ...) char *alloc_printf(const char *fmt, ...)
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 1, 2))); __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 1, 2)));
char *find_nonprint_char(char *buf, unsigned buf_len); const char *find_nonprint_char(const char *buf, unsigned int buf_len);
extern int debug_level; extern int debug_level;

View File

@ -111,7 +111,7 @@ size_t strnlen(const char *s, size_t maxlen);
#ifndef HAVE_USLEEP #ifndef HAVE_USLEEP
#ifdef _WIN32 #ifdef _WIN32
static inline unsigned usleep(unsigned int usecs) static inline unsigned int usleep(unsigned int usecs)
{ {
Sleep((usecs/1000)); Sleep((usecs/1000));
return 0; return 0;

View File

@ -401,7 +401,7 @@ COMMAND_HANDLER(adapter_transports_command)
retval = allow_transports(CMD_CTX, (const char **)transports); retval = allow_transports(CMD_CTX, (const char **)transports);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
for (unsigned i = 0; transports[i]; i++) for (unsigned int i = 0; transports[i]; i++)
free(transports[i]); free(transports[i]);
free(transports); free(transports);
} }
@ -414,7 +414,7 @@ COMMAND_HANDLER(handle_adapter_list_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
command_print(CMD, "The following debug adapters are available:"); command_print(CMD, "The following debug adapters are available:");
for (unsigned i = 0; adapter_drivers[i]; i++) { for (unsigned int i = 0; adapter_drivers[i]; i++) {
const char *name = adapter_drivers[i]->name; const char *name = adapter_drivers[i]->name;
command_print(CMD, "%u: %s", i + 1, name); command_print(CMD, "%u: %s", i + 1, name);
} }
@ -436,7 +436,7 @@ COMMAND_HANDLER(handle_adapter_driver_command)
if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0') if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0')
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
for (unsigned i = 0; adapter_drivers[i]; i++) { for (unsigned int i = 0; adapter_drivers[i]; i++) {
if (strcmp(CMD_ARGV[0], adapter_drivers[i]->name) != 0) if (strcmp(CMD_ARGV[0], adapter_drivers[i]->name) != 0)
continue; continue;
@ -684,7 +684,7 @@ COMMAND_HANDLER(handle_adapter_srst_delay_command)
if (CMD_ARGC > 1) if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
unsigned delay; unsigned int delay;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_nsrst_delay(delay); jtag_set_nsrst_delay(delay);
@ -698,7 +698,7 @@ COMMAND_HANDLER(handle_adapter_srst_pulse_width_command)
if (CMD_ARGC > 1) if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
unsigned width; unsigned int width;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], width); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], width);
jtag_set_nsrst_assert_width(width); jtag_set_nsrst_assert_width(width);
@ -714,7 +714,7 @@ COMMAND_HANDLER(handle_adapter_speed_command)
int retval = ERROR_OK; int retval = ERROR_OK;
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
unsigned khz = 0; unsigned int khz = 0;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
retval = adapter_config_khz(khz); retval = adapter_config_khz(khz);

View File

@ -224,7 +224,7 @@ static void jtag_tap_add(struct jtag_tap *t)
} }
/* returns a pointer to the n-th device in the scan chain */ /* returns a pointer to the n-th device in the scan chain */
struct jtag_tap *jtag_tap_by_position(unsigned n) struct jtag_tap *jtag_tap_by_position(unsigned int n)
{ {
struct jtag_tap *t = jtag_all_taps(); struct jtag_tap *t = jtag_all_taps();
@ -246,7 +246,7 @@ struct jtag_tap *jtag_tap_by_string(const char *s)
} }
/* no tap found by name, so try to parse the name as a number */ /* no tap found by name, so try to parse the name as a number */
unsigned n; unsigned int n;
if (parse_uint(s, &n) != ERROR_OK) if (parse_uint(s, &n) != ERROR_OK)
return NULL; return NULL;
@ -1473,10 +1473,9 @@ void jtag_tap_init(struct jtag_tap *tap)
jtag_tap_add(tap); jtag_tap_add(tap);
LOG_DEBUG("Created Tap: %s @ abs position %u, " LOG_DEBUG("Created Tap: %s @ abs position %u, "
"irlen %u, capture: 0x%x mask: 0x%x", tap->dotted_name, "irlen %u, capture: 0x%" PRIx32 " mask: 0x%" PRIx32, tap->dotted_name,
tap->abs_chain_position, tap->ir_length, tap->abs_chain_position, tap->ir_length,
(unsigned) tap->ir_capture_value, tap->ir_capture_value, tap->ir_capture_mask);
(unsigned) tap->ir_capture_mask);
} }
void jtag_tap_free(struct jtag_tap *tap) void jtag_tap_free(struct jtag_tap *tap)

View File

@ -275,10 +275,10 @@ static int am335xgpio_swdio_read(void)
return get_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_SWDIO]); return get_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_SWDIO]);
} }
static int am335xgpio_blink(int on) static int am335xgpio_blink(bool on)
{ {
if (is_gpio_config_valid(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED])) if (is_gpio_config_valid(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED]))
set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on); set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on ? 1 : 0);
return ERROR_OK; return ERROR_OK;
} }

View File

@ -31,16 +31,28 @@ static off_t bcm2835_peri_base = 0x20000000;
#define BCM2835_GPIO_MODE_OUTPUT 1 #define BCM2835_GPIO_MODE_OUTPUT 1
/* GPIO setup macros */ /* GPIO setup macros */
#define MODE_GPIO(g) (*(pio_base+((g)/10))>>(((g)%10)*3) & 7) #define MODE_GPIO(_g) ({ \
#define INP_GPIO(g) do { *(pio_base+((g)/10)) &= ~(7<<(((g)%10)*3)); } while (0) typeof(_g) g = (_g); \
#define SET_MODE_GPIO(g, m) do { /* clear the mode bits first, then set as necessary */ \ *(pio_base + (g / 10)) >> ((g % 10) * 3) & 7; \
INP_GPIO(g); \ })
*(pio_base+((g)/10)) |= ((m)<<(((g)%10)*3)); } while (0)
#define INP_GPIO(_g) do { \
typeof(_g) g1 = (_g); \
*(pio_base + (g1 / 10)) &= ~(7 << ((g1 % 10) * 3)); \
} while (0)
#define SET_MODE_GPIO(_g, m) do { \
typeof(_g) g = (_g); \
/* clear the mode bits first, then set as necessary */ \
INP_GPIO(g); \
*(pio_base + (g / 10)) |= ((m) << ((g % 10) * 3)); \
} while (0)
#define OUT_GPIO(g) SET_MODE_GPIO(g, BCM2835_GPIO_MODE_OUTPUT) #define OUT_GPIO(g) SET_MODE_GPIO(g, BCM2835_GPIO_MODE_OUTPUT)
#define GPIO_SET (*(pio_base+7)) /* sets bits which are 1, ignores bits which are 0 */ #define GPIO_SET (*(pio_base + 7)) /* sets bits which are 1, ignores bits which are 0 */
#define GPIO_CLR (*(pio_base+10)) /* clears bits which are 1, ignores bits which are 0 */ #define GPIO_CLR (*(pio_base + 10)) /* clears bits which are 1, ignores bits which are 0 */
#define GPIO_LEV (*(pio_base+13)) /* current level of the pin */ #define GPIO_LEV (*(pio_base + 13)) /* current level of the pin */
static int dev_mem_fd; static int dev_mem_fd;
static volatile uint32_t *pio_base = MAP_FAILED; static volatile uint32_t *pio_base = MAP_FAILED;
@ -175,7 +187,6 @@ static bb_value_t bcm2835gpio_read(void)
unsigned int shift = adapter_gpio_config[ADAPTER_GPIO_IDX_TDO].gpio_num; unsigned int shift = adapter_gpio_config[ADAPTER_GPIO_IDX_TDO].gpio_num;
uint32_t value = (GPIO_LEV >> shift) & 1; uint32_t value = (GPIO_LEV >> shift) & 1;
return value ^ (adapter_gpio_config[ADAPTER_GPIO_IDX_TDO].active_low ? BB_HIGH : BB_LOW); return value ^ (adapter_gpio_config[ADAPTER_GPIO_IDX_TDO].active_low ? BB_HIGH : BB_LOW);
} }
static int bcm2835gpio_write(int tck, int tms, int tdi) static int bcm2835gpio_write(int tck, int tms, int tdi)
@ -408,10 +419,10 @@ static void bcm2835gpio_munmap(void)
} }
} }
static int bcm2835gpio_blink(int on) static int bcm2835gpio_blink(bool on)
{ {
if (is_gpio_config_valid(ADAPTER_GPIO_IDX_LED)) if (is_gpio_config_valid(ADAPTER_GPIO_IDX_LED))
set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on); set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on ? 1 : 0);
return ERROR_OK; return ERROR_OK;
} }

View File

@ -92,13 +92,13 @@ static int bitbang_state_move(int skip)
*/ */
static int bitbang_execute_tms(struct jtag_command *cmd) static int bitbang_execute_tms(struct jtag_command *cmd)
{ {
unsigned num_bits = cmd->cmd.tms->num_bits; unsigned int num_bits = cmd->cmd.tms->num_bits;
const uint8_t *bits = cmd->cmd.tms->bits; const uint8_t *bits = cmd->cmd.tms->bits;
LOG_DEBUG_IO("TMS: %u bits", num_bits); LOG_DEBUG_IO("TMS: %u bits", num_bits);
int tms = 0; int tms = 0;
for (unsigned i = 0; i < num_bits; i++) { for (unsigned int i = 0; i < num_bits; i++) {
tms = ((bits[i/8] >> (i % 8)) & 1); tms = ((bits[i/8] >> (i % 8)) & 1);
if (bitbang_interface->write(0, tms, 0) != ERROR_OK) if (bitbang_interface->write(0, tms, 0) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
@ -193,10 +193,10 @@ static int bitbang_stableclocks(unsigned int num_cycles)
} }
static int bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, static int bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer,
unsigned scan_size) unsigned int scan_size)
{ {
tap_state_t saved_end_state = tap_get_end_state(); tap_state_t saved_end_state = tap_get_end_state();
unsigned bit_cnt; unsigned int bit_cnt;
if (!((!ir_scan && if (!((!ir_scan &&
(tap_get_state() == TAP_DRSHIFT)) || (tap_get_state() == TAP_DRSHIFT)) ||
@ -254,7 +254,7 @@ static int bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer,
if (type != SCAN_OUT && bitbang_interface->buf_size && if (type != SCAN_OUT && bitbang_interface->buf_size &&
(buffered == bitbang_interface->buf_size || (buffered == bitbang_interface->buf_size ||
bit_cnt == scan_size - 1)) { bit_cnt == scan_size - 1)) {
for (unsigned i = bit_cnt + 1 - buffered; i <= bit_cnt; i++) { for (unsigned int i = bit_cnt + 1 - buffered; i <= bit_cnt; i++) {
switch (bitbang_interface->read_sample()) { switch (bitbang_interface->read_sample()) {
case BB_LOW: case BB_LOW:
buffer[i/8] &= ~(1 << (i % 8)); buffer[i/8] &= ~(1 << (i % 8));
@ -309,7 +309,7 @@ int bitbang_execute_queue(struct jtag_command *cmd_queue)
retval = ERROR_OK; retval = ERROR_OK;
if (bitbang_interface->blink) { if (bitbang_interface->blink) {
if (bitbang_interface->blink(1) != ERROR_OK) if (bitbang_interface->blink(true) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
} }
@ -377,7 +377,7 @@ int bitbang_execute_queue(struct jtag_command *cmd_queue)
cmd = cmd->next; cmd = cmd->next;
} }
if (bitbang_interface->blink) { if (bitbang_interface->blink) {
if (bitbang_interface->blink(0) != ERROR_OK) if (bitbang_interface->blink(false) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
} }
@ -396,7 +396,7 @@ static void bitbang_swd_exchange(bool rnw, uint8_t buf[], unsigned int offset, u
{ {
if (bitbang_interface->blink) { if (bitbang_interface->blink) {
/* FIXME: we should manage errors */ /* FIXME: we should manage errors */
bitbang_interface->blink(1); bitbang_interface->blink(true);
} }
for (unsigned int i = offset; i < bit_cnt + offset; i++) { for (unsigned int i = offset; i < bit_cnt + offset; i++) {
@ -418,7 +418,7 @@ static void bitbang_swd_exchange(bool rnw, uint8_t buf[], unsigned int offset, u
if (bitbang_interface->blink) { if (bitbang_interface->blink) {
/* FIXME: we should manage errors */ /* FIXME: we should manage errors */
bitbang_interface->blink(0); bitbang_interface->blink(false);
} }
} }

View File

@ -45,7 +45,7 @@ struct bitbang_interface {
int (*write)(int tck, int tms, int tdi); int (*write)(int tck, int tms, int tdi);
/** Blink led (optional). */ /** Blink led (optional). */
int (*blink)(int on); int (*blink)(bool on);
/** Sample SWDIO and return the value. */ /** Sample SWDIO and return the value. */
int (*swdio_read)(void); int (*swdio_read)(void);

View File

@ -1442,7 +1442,7 @@ static void buspirate_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_del
data); data);
switch (ack) { switch (ack) {
case SWD_ACK_OK: case SWD_ACK_OK:
if (parity != parity_u32(data)) { if (parity != parity_u32(data)) {
LOG_DEBUG("Read data parity mismatch %x %x", parity, parity_u32(data)); LOG_DEBUG("Read data parity mismatch %x %x", parity, parity_u32(data));
queued_retval = ERROR_FAIL; queued_retval = ERROR_FAIL;
@ -1453,15 +1453,15 @@ static void buspirate_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_del
if (cmd & SWD_CMD_APNDP) if (cmd & SWD_CMD_APNDP)
buspirate_swd_idle_clocks(ap_delay_clk); buspirate_swd_idle_clocks(ap_delay_clk);
return; return;
case SWD_ACK_WAIT: case SWD_ACK_WAIT:
LOG_DEBUG("SWD_ACK_WAIT"); LOG_DEBUG("SWD_ACK_WAIT");
buspirate_swd_clear_sticky_errors(); buspirate_swd_clear_sticky_errors();
return; return;
case SWD_ACK_FAULT: case SWD_ACK_FAULT:
LOG_DEBUG("SWD_ACK_FAULT"); LOG_DEBUG("SWD_ACK_FAULT");
queued_retval = ack; queued_retval = ack;
return; return;
default: default:
LOG_DEBUG("No valid acknowledge: ack=%d", ack); LOG_DEBUG("No valid acknowledge: ack=%d", ack);
queued_retval = ack; queued_retval = ack;
return; return;
@ -1500,19 +1500,19 @@ static void buspirate_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_del
value); value);
switch (ack) { switch (ack) {
case SWD_ACK_OK: case SWD_ACK_OK:
if (cmd & SWD_CMD_APNDP) if (cmd & SWD_CMD_APNDP)
buspirate_swd_idle_clocks(ap_delay_clk); buspirate_swd_idle_clocks(ap_delay_clk);
return; return;
case SWD_ACK_WAIT: case SWD_ACK_WAIT:
LOG_DEBUG("SWD_ACK_WAIT"); LOG_DEBUG("SWD_ACK_WAIT");
buspirate_swd_clear_sticky_errors(); buspirate_swd_clear_sticky_errors();
return; return;
case SWD_ACK_FAULT: case SWD_ACK_FAULT:
LOG_DEBUG("SWD_ACK_FAULT"); LOG_DEBUG("SWD_ACK_FAULT");
queued_retval = ack; queued_retval = ack;
return; return;
default: default:
LOG_DEBUG("No valid acknowledge: ack=%d", ack); LOG_DEBUG("No valid acknowledge: ack=%d", ack);
queued_retval = ack; queued_retval = ack;
return; return;

View File

@ -563,7 +563,7 @@ static int cmsis_dap_cmd_dap_delay(uint16_t delay_us)
static int cmsis_dap_metacmd_targetsel(uint32_t instance_id) static int cmsis_dap_metacmd_targetsel(uint32_t instance_id)
{ {
uint8_t *command = cmsis_dap_handle->command; uint8_t *command = cmsis_dap_handle->command;
const uint32_t SEQ_RD = 0x80, SEQ_WR = 0x00; const uint32_t seq_rd = 0x80, seq_wr = 0x00;
/* SWD multi-drop requires a transfer ala CMD_DAP_TFER, /* SWD multi-drop requires a transfer ala CMD_DAP_TFER,
but with no expectation of an SWD ACK response. In but with no expectation of an SWD ACK response. In
@ -579,14 +579,14 @@ static int cmsis_dap_metacmd_targetsel(uint32_t instance_id)
command[idx++] = 3; /* sequence count */ command[idx++] = 3; /* sequence count */
/* sequence 0: packet request for TARGETSEL */ /* sequence 0: packet request for TARGETSEL */
command[idx++] = SEQ_WR | 8; command[idx++] = seq_wr | 8;
command[idx++] = SWD_CMD_START | swd_cmd(false, false, DP_TARGETSEL) | SWD_CMD_STOP | SWD_CMD_PARK; command[idx++] = SWD_CMD_START | swd_cmd(false, false, DP_TARGETSEL) | SWD_CMD_STOP | SWD_CMD_PARK;
/* sequence 1: read Trn ACK Trn, no expectation for target to ACK */ /* sequence 1: read Trn ACK Trn, no expectation for target to ACK */
command[idx++] = SEQ_RD | 5; command[idx++] = seq_rd | 5;
/* sequence 2: WDATA plus parity */ /* sequence 2: WDATA plus parity */
command[idx++] = SEQ_WR | (32 + 1); command[idx++] = seq_wr | (32 + 1);
h_u32_to_le(command + idx, instance_id); h_u32_to_le(command + idx, instance_id);
idx += 4; idx += 4;
command[idx++] = parity_u32(instance_id); command[idx++] = parity_u32(instance_id);
@ -2153,7 +2153,7 @@ COMMAND_HANDLER(cmsis_dap_handle_cmd_command)
{ {
uint8_t *command = cmsis_dap_handle->command; uint8_t *command = cmsis_dap_handle->command;
for (unsigned i = 0; i < CMD_ARGC; i++) for (unsigned int i = 0; i < CMD_ARGC; i++)
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[i], command[i]); COMMAND_PARSE_NUMBER(u8, CMD_ARGV[i], command[i]);
int retval = cmsis_dap_xfer(cmsis_dap_handle, CMD_ARGC); int retval = cmsis_dap_xfer(cmsis_dap_handle, CMD_ARGC);
@ -2185,7 +2185,7 @@ COMMAND_HANDLER(cmsis_dap_handle_vid_pid_command)
CMD_ARGC -= 1; CMD_ARGC -= 1;
} }
unsigned i; unsigned int i;
for (i = 0; i < CMD_ARGC; i += 2) { for (i = 0; i < CMD_ARGC; i += 2) {
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], cmsis_dap_vid[i >> 1]); COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], cmsis_dap_vid[i >> 1]);
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], cmsis_dap_pid[i >> 1]); COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], cmsis_dap_pid[i >> 1]);

View File

@ -234,7 +234,7 @@ int interface_jtag_add_tlr(void)
return ERROR_OK; return ERROR_OK;
} }
int interface_add_tms_seq(unsigned num_bits, const uint8_t *seq, enum tap_state state) int interface_add_tms_seq(unsigned int num_bits, const uint8_t *seq, enum tap_state state)
{ {
struct jtag_command *cmd; struct jtag_command *cmd;

View File

@ -72,7 +72,7 @@ static int dummy_reset(int trst, int srst)
return ERROR_OK; return ERROR_OK;
} }
static int dummy_led(int on) static int dummy_led(bool on)
{ {
return ERROR_OK; return ERROR_OK;
} }

View File

@ -177,7 +177,7 @@ static void ft232r_increase_buf_size(size_t new_buf_size)
*/ */
static void ft232r_write(int tck, int tms, int tdi) static void ft232r_write(int tck, int tms, int tdi)
{ {
unsigned out_value = (1<<ntrst_gpio) | (1<<nsysrst_gpio); unsigned int out_value = (1 << ntrst_gpio) | (1 << nsysrst_gpio);
if (tck) if (tck)
out_value |= (1<<tck_gpio); out_value |= (1<<tck_gpio);
if (tms) if (tms)
@ -201,7 +201,7 @@ static void ft232r_write(int tck, int tms, int tdi)
*/ */
static void ft232r_reset(int trst, int srst) static void ft232r_reset(int trst, int srst)
{ {
unsigned out_value = (1<<ntrst_gpio) | (1<<nsysrst_gpio); unsigned int out_value = (1 << ntrst_gpio) | (1 << nsysrst_gpio);
LOG_DEBUG("ft232r_reset(%d,%d)", trst, srst); LOG_DEBUG("ft232r_reset(%d,%d)", trst, srst);
if (trst == 1) if (trst == 1)
@ -281,7 +281,7 @@ static int ft232r_init(void)
} }
/* Exactly 500 nsec between updates. */ /* Exactly 500 nsec between updates. */
unsigned divisor = 1; unsigned int divisor = 1;
unsigned char latency_timer = 1; unsigned char latency_timer = 1;
/* Frequency divisor is 14-bit non-zero value. */ /* Frequency divisor is 14-bit non-zero value. */
@ -654,13 +654,13 @@ static void syncbb_state_move(int skip)
*/ */
static int syncbb_execute_tms(struct jtag_command *cmd) static int syncbb_execute_tms(struct jtag_command *cmd)
{ {
unsigned num_bits = cmd->cmd.tms->num_bits; unsigned int num_bits = cmd->cmd.tms->num_bits;
const uint8_t *bits = cmd->cmd.tms->bits; const uint8_t *bits = cmd->cmd.tms->bits;
LOG_DEBUG_IO("TMS: %u bits", num_bits); LOG_DEBUG_IO("TMS: %u bits", num_bits);
int tms = 0; int tms = 0;
for (unsigned i = 0; i < num_bits; i++) { for (unsigned int i = 0; i < num_bits; i++) {
tms = ((bits[i/8] >> (i % 8)) & 1); tms = ((bits[i/8] >> (i % 8)) & 1);
ft232r_write(0, tms, 0); ft232r_write(0, tms, 0);
ft232r_write(1, tms, 0); ft232r_write(1, tms, 0);

View File

@ -396,7 +396,7 @@ static void ftdi_execute_runtest(struct jtag_command *cmd)
unsigned int i = cmd->cmd.runtest->num_cycles; unsigned int i = cmd->cmd.runtest->num_cycles;
while (i > 0) { while (i > 0) {
/* there are no state transitions in this code, so omit state tracking */ /* there are no state transitions in this code, so omit state tracking */
unsigned this_len = i > 7 ? 7 : i; unsigned int this_len = i > 7 ? 7 : i;
DO_CLOCK_TMS_CS_OUT(mpsse_ctx, &zero, 0, this_len, false, ftdi_jtag_mode); DO_CLOCK_TMS_CS_OUT(mpsse_ctx, &zero, 0, this_len, false, ftdi_jtag_mode);
i -= this_len; i -= this_len;
} }
@ -450,7 +450,7 @@ static void ftdi_execute_pathmove(struct jtag_command *cmd)
tap_state_name(path[num_states-1])); tap_state_name(path[num_states-1]));
int state_count = 0; int state_count = 0;
unsigned bit_count = 0; unsigned int bit_count = 0;
uint8_t tms_byte = 0; uint8_t tms_byte = 0;
LOG_DEBUG_IO("-"); LOG_DEBUG_IO("-");
@ -519,7 +519,7 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
ftdi_end_state(cmd->cmd.scan->end_state); ftdi_end_state(cmd->cmd.scan->end_state);
struct scan_field *field = cmd->cmd.scan->fields; struct scan_field *field = cmd->cmd.scan->fields;
unsigned scan_size = 0; unsigned int scan_size = 0;
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) { for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
scan_size += field->num_bits; scan_size += field->num_bits;
@ -652,7 +652,7 @@ static void ftdi_execute_stableclocks(struct jtag_command *cmd)
* the correct level and remain there during the scan */ * the correct level and remain there during the scan */
while (num_cycles > 0) { while (num_cycles > 0) {
/* there are no state transitions in this code, so omit state tracking */ /* there are no state transitions in this code, so omit state tracking */
unsigned this_len = num_cycles > 7 ? 7 : num_cycles; unsigned int this_len = num_cycles > 7 ? 7 : num_cycles;
DO_CLOCK_TMS_CS_OUT(mpsse_ctx, &tms, 0, this_len, false, ftdi_jtag_mode); DO_CLOCK_TMS_CS_OUT(mpsse_ctx, &tms, 0, this_len, false, ftdi_jtag_mode);
num_cycles -= this_len; num_cycles -= this_len;
} }
@ -1126,7 +1126,7 @@ COMMAND_HANDLER(ftdi_handle_layout_signal_command)
uint16_t input_mask = 0; uint16_t input_mask = 0;
bool invert_oe = false; bool invert_oe = false;
uint16_t oe_mask = 0; uint16_t oe_mask = 0;
for (unsigned i = 1; i < CMD_ARGC; i += 2) { for (unsigned int i = 1; i < CMD_ARGC; i += 2) {
if (strcmp("-data", CMD_ARGV[i]) == 0) { if (strcmp("-data", CMD_ARGV[i]) == 0) {
invert_data = false; invert_data = false;
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], data_mask); COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], data_mask);
@ -1255,7 +1255,7 @@ COMMAND_HANDLER(ftdi_handle_vid_pid_command)
CMD_ARGC -= 1; CMD_ARGC -= 1;
} }
unsigned i; unsigned int i;
for (i = 0; i < CMD_ARGC; i += 2) { for (i = 0; i < CMD_ARGC; i += 2) {
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], ftdi_vid[i >> 1]); COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], ftdi_vid[i >> 1]);
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], ftdi_pid[i >> 1]); COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], ftdi_pid[i >> 1]);

View File

@ -104,10 +104,10 @@ static int jlink_flush(void);
* @param in_offset A bit offset for TDO data. * @param in_offset A bit offset for TDO data.
* @param length Amount of bits to transfer out and in. * @param length Amount of bits to transfer out and in.
*/ */
static void jlink_clock_data(const uint8_t *out, unsigned out_offset, static void jlink_clock_data(const uint8_t *out, unsigned int out_offset,
const uint8_t *tms_out, unsigned tms_offset, const uint8_t *tms_out, unsigned int tms_offset,
uint8_t *in, unsigned in_offset, uint8_t *in, unsigned int in_offset,
unsigned length); unsigned int length);
static enum tap_state jlink_last_state = TAP_RESET; static enum tap_state jlink_last_state = TAP_RESET;
static int queued_retval; static int queued_retval;
@ -179,7 +179,7 @@ static void jlink_execute_scan(struct jtag_command *cmd)
jlink_end_state(cmd->cmd.scan->end_state); jlink_end_state(cmd->cmd.scan->end_state);
struct scan_field *field = cmd->cmd.scan->fields; struct scan_field *field = cmd->cmd.scan->fields;
unsigned scan_size = 0; unsigned int scan_size = 0;
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) { for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
scan_size += field->num_bits; scan_size += field->num_bits;
@ -1962,7 +1962,7 @@ static void jlink_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_c
/***************************************************************************/ /***************************************************************************/
/* J-Link tap functions */ /* J-Link tap functions */
static unsigned tap_length; static unsigned int tap_length;
/* In SWD mode use tms buffer for direction control */ /* In SWD mode use tms buffer for direction control */
static uint8_t tms_buffer[JLINK_TAP_BUFFER_SIZE]; static uint8_t tms_buffer[JLINK_TAP_BUFFER_SIZE];
static uint8_t tdi_buffer[JLINK_TAP_BUFFER_SIZE]; static uint8_t tdi_buffer[JLINK_TAP_BUFFER_SIZE];
@ -1970,13 +1970,13 @@ static uint8_t tdo_buffer[JLINK_TAP_BUFFER_SIZE];
struct pending_scan_result { struct pending_scan_result {
/** First bit position in tdo_buffer to read. */ /** First bit position in tdo_buffer to read. */
unsigned first; unsigned int first;
/** Number of bits to read. */ /** Number of bits to read. */
unsigned length; unsigned int length;
/** Location to store the result */ /** Location to store the result */
void *buffer; void *buffer;
/** Offset in the destination buffer */ /** Offset in the destination buffer */
unsigned buffer_offset; unsigned int buffer_offset;
/** SWD command */ /** SWD command */
uint8_t swd_cmd; uint8_t swd_cmd;
}; };
@ -1994,13 +1994,13 @@ static void jlink_tap_init(void)
memset(tdi_buffer, 0, sizeof(tdi_buffer)); memset(tdi_buffer, 0, sizeof(tdi_buffer));
} }
static void jlink_clock_data(const uint8_t *out, unsigned out_offset, static void jlink_clock_data(const uint8_t *out, unsigned int out_offset,
const uint8_t *tms_out, unsigned tms_offset, const uint8_t *tms_out, unsigned int tms_offset,
uint8_t *in, unsigned in_offset, uint8_t *in, unsigned int in_offset,
unsigned length) unsigned int length)
{ {
do { do {
unsigned available_length = JLINK_TAP_BUFFER_SIZE - tap_length / 8; unsigned int available_length = JLINK_TAP_BUFFER_SIZE - tap_length / 8;
if (!available_length || if (!available_length ||
(in && pending_scan_results_length == MAX_PENDING_SCAN_RESULTS)) { (in && pending_scan_results_length == MAX_PENDING_SCAN_RESULTS)) {
@ -2012,7 +2012,7 @@ static void jlink_clock_data(const uint8_t *out, unsigned out_offset,
struct pending_scan_result *pending_scan_result = struct pending_scan_result *pending_scan_result =
&pending_scan_results_buffer[pending_scan_results_length]; &pending_scan_results_buffer[pending_scan_results_length];
unsigned scan_length = length > available_length ? unsigned int scan_length = length > available_length ?
available_length : length; available_length : length;
if (out) if (out)

View File

@ -158,7 +158,7 @@ retry_write:
static int jtag_vpi_receive_cmd(struct vpi_cmd *vpi) static int jtag_vpi_receive_cmd(struct vpi_cmd *vpi)
{ {
unsigned bytes_buffered = 0; unsigned int bytes_buffered = 0;
while (bytes_buffered < sizeof(struct vpi_cmd)) { while (bytes_buffered < sizeof(struct vpi_cmd)) {
int bytes_to_receive = sizeof(struct vpi_cmd) - bytes_buffered; int bytes_to_receive = sizeof(struct vpi_cmd) - bytes_buffered;
int retval = read_socket(sockfd, ((char *)vpi) + bytes_buffered, bytes_to_receive); int retval = read_socket(sockfd, ((char *)vpi) + bytes_buffered, bytes_to_receive);
@ -461,14 +461,14 @@ static int jtag_vpi_stableclocks(unsigned int num_cycles)
unsigned int cycles_remain = num_cycles; unsigned int cycles_remain = num_cycles;
int nb_bits; int nb_bits;
int retval; int retval;
const unsigned int CYCLES_ONE_BATCH = sizeof(tms_bits) * 8; const unsigned int cycles_one_batch = sizeof(tms_bits) * 8;
/* use TMS=1 in TAP RESET state, TMS=0 in all other stable states */ /* use TMS=1 in TAP RESET state, TMS=0 in all other stable states */
memset(&tms_bits, (tap_get_state() == TAP_RESET) ? 0xff : 0x00, sizeof(tms_bits)); memset(&tms_bits, (tap_get_state() == TAP_RESET) ? 0xff : 0x00, sizeof(tms_bits));
/* send the TMS bits */ /* send the TMS bits */
while (cycles_remain > 0) { while (cycles_remain > 0) {
nb_bits = (cycles_remain < CYCLES_ONE_BATCH) ? cycles_remain : CYCLES_ONE_BATCH; nb_bits = (cycles_remain < cycles_one_batch) ? cycles_remain : cycles_one_batch;
retval = jtag_vpi_tms_seq(tms_bits, nb_bits); retval = jtag_vpi_tms_seq(tms_bits, nb_bits);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;

View File

@ -53,7 +53,7 @@ static int jtag_libusb_error(int err)
bool jtag_libusb_match_ids(struct libusb_device_descriptor *dev_desc, bool jtag_libusb_match_ids(struct libusb_device_descriptor *dev_desc,
const uint16_t vids[], const uint16_t pids[]) const uint16_t vids[], const uint16_t pids[])
{ {
for (unsigned i = 0; vids[i]; i++) { for (unsigned int i = 0; vids[i]; i++) {
if (dev_desc->idVendor == vids[i] && if (dev_desc->idVendor == vids[i] &&
dev_desc->idProduct == pids[i]) { dev_desc->idProduct == pids[i]) {
return true; return true;

View File

@ -178,14 +178,14 @@ static int linuxgpiod_swd_write(int swclk, int swdio)
return ERROR_OK; return ERROR_OK;
} }
static int linuxgpiod_blink(int on) static int linuxgpiod_blink(bool on)
{ {
int retval; int retval;
if (!is_gpio_config_valid(ADAPTER_GPIO_IDX_LED)) if (!is_gpio_config_valid(ADAPTER_GPIO_IDX_LED))
return ERROR_OK; return ERROR_OK;
retval = gpiod_line_set_value(gpiod_line[ADAPTER_GPIO_IDX_LED], on); retval = gpiod_line_set_value(gpiod_line[ADAPTER_GPIO_IDX_LED], on ? 1 : 0);
if (retval < 0) if (retval < 0)
LOG_WARNING("Fail set led"); LOG_WARNING("Fail set led");
return retval; return retval;

View File

@ -13,7 +13,7 @@
static inline void interface_jtag_add_scan_check_alloc(struct scan_field *field) static inline void interface_jtag_add_scan_check_alloc(struct scan_field *field)
{ {
unsigned num_bytes = DIV_ROUND_UP(field->num_bits, 8); unsigned int num_bytes = DIV_ROUND_UP(field->num_bits, 8);
field->in_value = cmd_queue_alloc(num_bytes); field->in_value = cmd_queue_alloc(num_bytes);
} }

View File

@ -64,13 +64,13 @@ struct mpsse_ctx {
uint8_t interface; uint8_t interface;
enum ftdi_chip_type type; enum ftdi_chip_type type;
uint8_t *write_buffer; uint8_t *write_buffer;
unsigned write_size; unsigned int write_size;
unsigned write_count; unsigned int write_count;
uint8_t *read_buffer; uint8_t *read_buffer;
unsigned read_size; unsigned int read_size;
unsigned read_count; unsigned int read_count;
uint8_t *read_chunk; uint8_t *read_chunk;
unsigned read_chunk_size; unsigned int read_chunk_size;
struct bit_copy_queue read_queue; struct bit_copy_queue read_queue;
int retval; int retval;
}; };
@ -444,13 +444,13 @@ void mpsse_purge(struct mpsse_ctx *ctx)
} }
} }
static unsigned buffer_write_space(struct mpsse_ctx *ctx) static unsigned int buffer_write_space(struct mpsse_ctx *ctx)
{ {
/* Reserve one byte for SEND_IMMEDIATE */ /* Reserve one byte for SEND_IMMEDIATE */
return ctx->write_size - ctx->write_count - 1; return ctx->write_size - ctx->write_count - 1;
} }
static unsigned buffer_read_space(struct mpsse_ctx *ctx) static unsigned int buffer_read_space(struct mpsse_ctx *ctx)
{ {
return ctx->read_size - ctx->read_count; return ctx->read_size - ctx->read_count;
} }
@ -462,8 +462,8 @@ static void buffer_write_byte(struct mpsse_ctx *ctx, uint8_t data)
ctx->write_buffer[ctx->write_count++] = data; ctx->write_buffer[ctx->write_count++] = data;
} }
static unsigned buffer_write(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, static unsigned int buffer_write(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
unsigned bit_count) unsigned int bit_count)
{ {
LOG_DEBUG_IO("%d bits", bit_count); LOG_DEBUG_IO("%d bits", bit_count);
assert(ctx->write_count + DIV_ROUND_UP(bit_count, 8) <= ctx->write_size); assert(ctx->write_count + DIV_ROUND_UP(bit_count, 8) <= ctx->write_size);
@ -472,8 +472,8 @@ static unsigned buffer_write(struct mpsse_ctx *ctx, const uint8_t *out, unsigned
return bit_count; return bit_count;
} }
static unsigned buffer_add_read(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_offset, static unsigned int buffer_add_read(struct mpsse_ctx *ctx, uint8_t *in, unsigned int in_offset,
unsigned bit_count, unsigned offset) unsigned int bit_count, unsigned int offset)
{ {
LOG_DEBUG_IO("%d bits, offset %d", bit_count, offset); LOG_DEBUG_IO("%d bits, offset %d", bit_count, offset);
assert(ctx->read_count + DIV_ROUND_UP(bit_count, 8) <= ctx->read_size); assert(ctx->read_count + DIV_ROUND_UP(bit_count, 8) <= ctx->read_size);
@ -483,20 +483,20 @@ static unsigned buffer_add_read(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_
return bit_count; return bit_count;
} }
void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
unsigned length, uint8_t mode) unsigned int length, uint8_t mode)
{ {
mpsse_clock_data(ctx, out, out_offset, NULL, 0, length, mode); mpsse_clock_data(ctx, out, out_offset, NULL, 0, length, mode);
} }
void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_offset, unsigned length, void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned int in_offset, unsigned int length,
uint8_t mode) uint8_t mode)
{ {
mpsse_clock_data(ctx, NULL, 0, in, in_offset, length, mode); mpsse_clock_data(ctx, NULL, 0, in, in_offset, length, mode);
} }
void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in, void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in,
unsigned in_offset, unsigned length, uint8_t mode) unsigned int in_offset, unsigned int length, uint8_t mode)
{ {
/* TODO: Fix MSB first modes */ /* TODO: Fix MSB first modes */
LOG_DEBUG_IO("%s%s %d bits", in ? "in" : "", out ? "out" : "", length); LOG_DEBUG_IO("%s%s %d bits", in ? "in" : "", out ? "out" : "", length);
@ -531,7 +531,7 @@ void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_of
length = 0; length = 0;
} else { } else {
/* Byte transfer */ /* Byte transfer */
unsigned this_bytes = length / 8; unsigned int this_bytes = length / 8;
/* MPSSE command limit */ /* MPSSE command limit */
if (this_bytes > 65536) if (this_bytes > 65536)
this_bytes = 65536; this_bytes = 65536;
@ -558,7 +558,7 @@ void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_of
this_bytes * 8, this_bytes * 8,
0); 0);
if (!out && !in) if (!out && !in)
for (unsigned n = 0; n < this_bytes; n++) for (unsigned int n = 0; n < this_bytes; n++)
buffer_write_byte(ctx, 0x00); buffer_write_byte(ctx, 0x00);
length -= this_bytes * 8; length -= this_bytes * 8;
} }
@ -566,14 +566,14 @@ void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_of
} }
} }
void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
unsigned length, bool tdi, uint8_t mode) unsigned int length, bool tdi, uint8_t mode)
{ {
mpsse_clock_tms_cs(ctx, out, out_offset, NULL, 0, length, tdi, mode); mpsse_clock_tms_cs(ctx, out, out_offset, NULL, 0, length, tdi, mode);
} }
void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in, void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in,
unsigned in_offset, unsigned length, bool tdi, uint8_t mode) unsigned int in_offset, unsigned int length, bool tdi, uint8_t mode)
{ {
LOG_DEBUG_IO("%sout %d bits, tdi=%d", in ? "in" : "", length, tdi); LOG_DEBUG_IO("%sout %d bits, tdi=%d", in ? "in" : "", length, tdi);
assert(out); assert(out);
@ -593,7 +593,7 @@ void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_
ctx->retval = mpsse_flush(ctx); ctx->retval = mpsse_flush(ctx);
/* Byte transfer */ /* Byte transfer */
unsigned this_bits = length; unsigned int this_bits = length;
/* MPSSE command limit */ /* MPSSE command limit */
/* NOTE: there's a report of an FT2232 bug in this area, where shifting /* NOTE: there's a report of an FT2232 bug in this area, where shifting
* exactly 7 bits can make problems with TMS signaling for the last * exactly 7 bits can make problems with TMS signaling for the last
@ -783,7 +783,7 @@ int mpsse_set_frequency(struct mpsse_ctx *ctx, int frequency)
struct transfer_result { struct transfer_result {
struct mpsse_ctx *ctx; struct mpsse_ctx *ctx;
bool done; bool done;
unsigned transferred; unsigned int transferred;
}; };
static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer) static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer)
@ -791,16 +791,16 @@ static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer)
struct transfer_result *res = transfer->user_data; struct transfer_result *res = transfer->user_data;
struct mpsse_ctx *ctx = res->ctx; struct mpsse_ctx *ctx = res->ctx;
unsigned packet_size = ctx->max_packet_size; unsigned int packet_size = ctx->max_packet_size;
DEBUG_PRINT_BUF(transfer->buffer, transfer->actual_length); DEBUG_PRINT_BUF(transfer->buffer, transfer->actual_length);
/* Strip the two status bytes sent at the beginning of each USB packet /* Strip the two status bytes sent at the beginning of each USB packet
* while copying the chunk buffer to the read buffer */ * while copying the chunk buffer to the read buffer */
unsigned num_packets = DIV_ROUND_UP(transfer->actual_length, packet_size); unsigned int num_packets = DIV_ROUND_UP(transfer->actual_length, packet_size);
unsigned chunk_remains = transfer->actual_length; unsigned int chunk_remains = transfer->actual_length;
for (unsigned i = 0; i < num_packets && chunk_remains > 2; i++) { for (unsigned int i = 0; i < num_packets && chunk_remains > 2; i++) {
unsigned this_size = packet_size - 2; unsigned int this_size = packet_size - 2;
if (this_size > chunk_remains - 2) if (this_size > chunk_remains - 2)
this_size = chunk_remains - 2; this_size = chunk_remains - 2;
if (this_size > ctx->read_count - res->transferred) if (this_size > ctx->read_count - res->transferred)

View File

@ -44,16 +44,16 @@ bool mpsse_is_high_speed(struct mpsse_ctx *ctx);
/* Command queuing. These correspond to the MPSSE commands with the same names, but no need to care /* Command queuing. These correspond to the MPSSE commands with the same names, but no need to care
* about bit/byte transfer or data length limitation. Read data is guaranteed to be available only * about bit/byte transfer or data length limitation. Read data is guaranteed to be available only
* after the following mpsse_flush(). */ * after the following mpsse_flush(). */
void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, void mpsse_clock_data_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
unsigned length, uint8_t mode); unsigned int length, uint8_t mode);
void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_offset, unsigned length, void mpsse_clock_data_in(struct mpsse_ctx *ctx, uint8_t *in, unsigned int in_offset, unsigned int length,
uint8_t mode); uint8_t mode);
void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in, void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in,
unsigned in_offset, unsigned length, uint8_t mode); unsigned int in_offset, unsigned int length, uint8_t mode);
void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset,
unsigned length, bool tdi, uint8_t mode); unsigned int length, bool tdi, uint8_t mode);
void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in, void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in,
unsigned in_offset, unsigned length, bool tdi, uint8_t mode); unsigned int in_offset, unsigned int length, bool tdi, uint8_t mode);
void mpsse_set_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t dir); void mpsse_set_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t dir);
void mpsse_set_data_bits_high_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t dir); void mpsse_set_data_bits_high_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t dir);
void mpsse_read_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t *data); void mpsse_read_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t *data);

View File

@ -45,21 +45,31 @@
#include <windows.h> #include <windows.h>
#endif #endif
/* parallel port cable description // Parallel port cable description.
*/
struct cable { struct cable {
const char *name; const char *name;
uint8_t TDO_MASK; /* status port bit containing current TDO value */ // Status port bit containing current TDO value.
uint8_t TRST_MASK; /* data port bit for TRST */ uint8_t tdo_mask;
uint8_t TMS_MASK; /* data port bit for TMS */ // Data port bit for TRST.
uint8_t TCK_MASK; /* data port bit for TCK */ uint8_t trst_mask;
uint8_t TDI_MASK; /* data port bit for TDI */ // Data port bit for TMD.
uint8_t SRST_MASK; /* data port bit for SRST */ uint8_t tms_mask;
uint8_t OUTPUT_INVERT; /* data port bits that should be inverted */ // Data port bit for TCK.
uint8_t INPUT_INVERT; /* status port that should be inverted */ uint8_t tck_mask;
uint8_t PORT_INIT; /* initialize data port with this value */ // Data port bit for TDI.
uint8_t PORT_EXIT; /* de-initialize data port with this value */ uint8_t tdi_mask;
uint8_t LED_MASK; /* data port bit for LED */ // Data port bit for SRST.
uint8_t srst_mask;
// Data port bits that should be inverted.
uint8_t output_invert;
// Status port that should be inverted.
uint8_t input_invert;
// Initialize data port with this value.
uint8_t port_init;
// De-initialize data port with this value.
uint8_t port_exit;
// Data port bit for LED.
uint8_t led_mask;
}; };
static const struct cable cables[] = { static const struct cable cables[] = {
@ -87,15 +97,14 @@ static const struct cable cables[] = {
{ NULL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } { NULL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
}; };
/* configuration */ // Configuration variables.
static char *parport_cable; static char *parport_cable;
static uint16_t parport_port; static uint16_t parport_port;
static bool parport_exit; static bool parport_exit;
static uint32_t parport_toggling_time_ns = 1000; static uint32_t parport_toggling_time_ns = 1000;
static int wait_states; static int wait_states;
/* interface variables // Interface variables.
*/
static const struct cable *cable; static const struct cable *cable;
static uint8_t dataport_value; static uint8_t dataport_value;
@ -116,7 +125,7 @@ static bb_value_t parport_read(void)
data = inb(statusport); data = inb(statusport);
#endif #endif
if ((data ^ cable->INPUT_INVERT) & cable->TDO_MASK) if ((data ^ cable->input_invert) & cable->tdo_mask)
return BB_HIGH; return BB_HIGH;
else else
return BB_LOW; return BB_LOW;
@ -125,7 +134,7 @@ static bb_value_t parport_read(void)
static inline void parport_write_data(void) static inline void parport_write_data(void)
{ {
uint8_t output; uint8_t output;
output = dataport_value ^ cable->OUTPUT_INVERT; output = dataport_value ^ cable->output_invert;
#if PARPORT_USE_PPDEV == 1 #if PARPORT_USE_PPDEV == 1
ioctl(device_handle, PPWDATA, &output); ioctl(device_handle, PPWDATA, &output);
@ -143,19 +152,19 @@ static int parport_write(int tck, int tms, int tdi)
int i = wait_states + 1; int i = wait_states + 1;
if (tck) if (tck)
dataport_value |= cable->TCK_MASK; dataport_value |= cable->tck_mask;
else else
dataport_value &= ~cable->TCK_MASK; dataport_value &= ~cable->tck_mask;
if (tms) if (tms)
dataport_value |= cable->TMS_MASK; dataport_value |= cable->tms_mask;
else else
dataport_value &= ~cable->TMS_MASK; dataport_value &= ~cable->tms_mask;
if (tdi) if (tdi)
dataport_value |= cable->TDI_MASK; dataport_value |= cable->tdi_mask;
else else
dataport_value &= ~cable->TDI_MASK; dataport_value &= ~cable->tdi_mask;
while (i-- > 0) while (i-- > 0)
parport_write_data(); parport_write_data();
@ -163,33 +172,32 @@ static int parport_write(int tck, int tms, int tdi)
return ERROR_OK; return ERROR_OK;
} }
/* (1) assert or (0) deassert reset lines */ // (1) assert or (0) deassert reset lines.
static int parport_reset(int trst, int srst) static int parport_reset(int trst, int srst)
{ {
LOG_DEBUG("trst: %i, srst: %i", trst, srst); LOG_DEBUG("trst: %i, srst: %i", trst, srst);
if (trst == 0) if (trst == 0)
dataport_value |= cable->TRST_MASK; dataport_value |= cable->trst_mask;
else if (trst == 1) else if (trst == 1)
dataport_value &= ~cable->TRST_MASK; dataport_value &= ~cable->trst_mask;
if (srst == 0) if (srst == 0)
dataport_value |= cable->SRST_MASK; dataport_value |= cable->srst_mask;
else if (srst == 1) else if (srst == 1)
dataport_value &= ~cable->SRST_MASK; dataport_value &= ~cable->srst_mask;
parport_write_data(); parport_write_data();
return ERROR_OK; return ERROR_OK;
} }
/* turn LED on parport adapter on (1) or off (0) */ static int parport_led(bool on)
static int parport_led(int on)
{ {
if (on) if (on)
dataport_value |= cable->LED_MASK; dataport_value |= cable->led_mask;
else else
dataport_value &= ~cable->LED_MASK; dataport_value &= ~cable->led_mask;
parport_write_data(); parport_write_data();
@ -204,7 +212,7 @@ static int parport_speed(int speed)
static int parport_khz(int khz, int *jtag_speed) static int parport_khz(int khz, int *jtag_speed)
{ {
if (khz == 0) { if (!khz) {
LOG_DEBUG("RCLK not supported"); LOG_DEBUG("RCLK not supported");
return ERROR_FAIL; return ERROR_FAIL;
} }
@ -248,10 +256,10 @@ static int parport_get_giveio_access(void)
#endif #endif
static struct bitbang_interface parport_bitbang = { static struct bitbang_interface parport_bitbang = {
.read = &parport_read, .read = &parport_read,
.write = &parport_write, .write = &parport_write,
.blink = &parport_led, .blink = &parport_led,
}; };
static int parport_init(void) static int parport_init(void)
{ {
@ -268,7 +276,7 @@ static int parport_init(void)
} }
while (cur_cable->name) { while (cur_cable->name) {
if (strcmp(cur_cable->name, parport_cable) == 0) { if (!strcmp(cur_cable->name, parport_cable)) {
cable = cur_cable; cable = cur_cable;
break; break;
} }
@ -280,7 +288,7 @@ static int parport_init(void)
return ERROR_JTAG_INIT_FAILED; return ERROR_JTAG_INIT_FAILED;
} }
dataport_value = cable->PORT_INIT; dataport_value = cable->port_init;
#if PARPORT_USE_PPDEV == 1 #if PARPORT_USE_PPDEV == 1
if (device_handle > 0) { if (device_handle > 0) {
@ -332,7 +340,7 @@ static int parport_init(void)
#endif /* not __FreeBSD__, __FreeBSD_kernel__ */ #endif /* not __FreeBSD__, __FreeBSD_kernel__ */
#else /* not PARPORT_USE_PPDEV */ #else /* not PARPORT_USE_PPDEV */
if (parport_port == 0) { if (!parport_port) {
parport_port = 0x378; parport_port = 0x378;
LOG_WARNING("No parport port specified, using default '0x378' (LPT1)"); LOG_WARNING("No parport port specified, using default '0x378' (LPT1)");
} }
@ -351,7 +359,7 @@ static int parport_init(void)
} }
LOG_DEBUG("...privileges granted"); LOG_DEBUG("...privileges granted");
/* make sure parallel port is in right mode (clear tristate and interrupt */ // Make sure parallel port is in right mode (clear tristate and interrupt.
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
outb(parport_port + 2, 0x0); outb(parport_port + 2, 0x0);
#else #else
@ -364,7 +372,7 @@ static int parport_init(void)
return ERROR_FAIL; return ERROR_FAIL;
if (parport_write(0, 0, 0) != ERROR_OK) if (parport_write(0, 0, 0) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
if (parport_led(1) != ERROR_OK) if (parport_led(true) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
bitbang_interface = &parport_bitbang; bitbang_interface = &parport_bitbang;
@ -374,11 +382,11 @@ static int parport_init(void)
static int parport_quit(void) static int parport_quit(void)
{ {
if (parport_led(0) != ERROR_OK) if (parport_led(false) != ERROR_OK)
return ERROR_FAIL; return ERROR_FAIL;
if (parport_exit) { if (parport_exit) {
dataport_value = cable->PORT_EXIT; dataport_value = cable->port_exit;
parport_write_data(); parport_write_data();
} }
@ -388,13 +396,13 @@ static int parport_quit(void)
return ERROR_OK; return ERROR_OK;
} }
COMMAND_HANDLER(parport_handle_parport_port_command) COMMAND_HANDLER(parport_handle_port_command)
{ {
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
/* only if the port wasn't overwritten by cmdline */ // Only if the port wasn't overwritten by cmdline.
if (parport_port == 0) if (!parport_port) {
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], parport_port); COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], parport_port);
else { } else {
LOG_ERROR("The parport port was already configured!"); LOG_ERROR("The parport port was already configured!");
return ERROR_FAIL; return ERROR_FAIL;
} }
@ -405,14 +413,14 @@ COMMAND_HANDLER(parport_handle_parport_port_command)
return ERROR_OK; return ERROR_OK;
} }
COMMAND_HANDLER(parport_handle_parport_cable_command) COMMAND_HANDLER(parport_handle_cable_command)
{ {
if (CMD_ARGC == 0) if (!CMD_ARGC)
return ERROR_OK; return ERROR_OK;
/* only if the cable name wasn't overwritten by cmdline */ // Only if the cable name wasn't overwritten by cmdline.
if (!parport_cable) { if (!parport_cable) {
/* REVISIT first verify that it's listed in cables[] ... */ // TODO: REVISIT first verify that it's listed in cables[].
parport_cable = malloc(strlen(CMD_ARGV[0]) + sizeof(char)); parport_cable = malloc(strlen(CMD_ARGV[0]) + sizeof(char));
if (!parport_cable) { if (!parport_cable) {
LOG_ERROR("Out of memory"); LOG_ERROR("Out of memory");
@ -421,7 +429,7 @@ COMMAND_HANDLER(parport_handle_parport_cable_command)
strcpy(parport_cable, CMD_ARGV[0]); strcpy(parport_cable, CMD_ARGV[0]);
} }
/* REVISIT it's probably worth returning the current value ... */ // TODO: REVISIT it's probably worth returning the current value.
return ERROR_OK; return ERROR_OK;
} }
@ -436,7 +444,7 @@ COMMAND_HANDLER(parport_handle_write_on_exit_command)
return ERROR_OK; return ERROR_OK;
} }
COMMAND_HANDLER(parport_handle_parport_toggling_time_command) COMMAND_HANDLER(parport_handle_toggling_time_command)
{ {
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
uint32_t ns; uint32_t ns;
@ -445,7 +453,7 @@ COMMAND_HANDLER(parport_handle_parport_toggling_time_command)
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
if (ns == 0) { if (!ns) {
LOG_ERROR("0 ns is not a valid parport toggling time"); LOG_ERROR("0 ns is not a valid parport toggling time");
return ERROR_FAIL; return ERROR_FAIL;
} }
@ -453,9 +461,11 @@ COMMAND_HANDLER(parport_handle_parport_toggling_time_command)
parport_toggling_time_ns = ns; parport_toggling_time_ns = ns;
retval = adapter_get_speed(&wait_states); retval = adapter_get_speed(&wait_states);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
/* if adapter_get_speed fails then the clock_mode /*
* has not been configured, this happens if parport_toggling_time is * If adapter_get_speed fails then the clock_mode has
* called before the adapter speed is set */ * not been configured, this happens if toggling_time is
* called before the adapter speed is set.
*/
LOG_INFO("no parport speed set - defaulting to zero wait states"); LOG_INFO("no parport speed set - defaulting to zero wait states");
wait_states = 0; wait_states = 0;
} }
@ -470,7 +480,7 @@ COMMAND_HANDLER(parport_handle_parport_toggling_time_command)
static const struct command_registration parport_subcommand_handlers[] = { static const struct command_registration parport_subcommand_handlers[] = {
{ {
.name = "port", .name = "port",
.handler = parport_handle_parport_port_command, .handler = parport_handle_port_command,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "Display the address of the I/O port (e.g. 0x378) " .help = "Display the address of the I/O port (e.g. 0x378) "
"or the number of the '/dev/parport' device used. " "or the number of the '/dev/parport' device used. "
@ -479,11 +489,11 @@ static const struct command_registration parport_subcommand_handlers[] = {
}, },
{ {
.name = "cable", .name = "cable",
.handler = parport_handle_parport_cable_command, .handler = parport_handle_cable_command,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "Set the layout of the parallel port cable " .help = "Set the layout of the parallel port cable "
"used to connect to the target.", "used to connect to the target.",
/* REVISIT there's no way to list layouts we know ... */ // TODO: REVISIT there's no way to list layouts we know.
.usage = "[layout]", .usage = "[layout]",
}, },
{ {
@ -496,7 +506,7 @@ static const struct command_registration parport_subcommand_handlers[] = {
}, },
{ {
.name = "toggling_time", .name = "toggling_time",
.handler = parport_handle_parport_toggling_time_command, .handler = parport_handle_toggling_time_command,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "Displays or assigns how many nanoseconds it " .help = "Displays or assigns how many nanoseconds it "
"takes for the hardware to toggle TCK.", "takes for the hardware to toggle TCK.",

View File

@ -251,7 +251,7 @@ static int remote_bitbang_sleep(unsigned int microseconds)
return remote_bitbang_flush(); return remote_bitbang_flush();
} }
static int remote_bitbang_blink(int on) static int remote_bitbang_blink(bool on)
{ {
char c = on ? 'B' : 'b'; char c = on ? 'B' : 'b';
return remote_bitbang_queue(c, FLUSH_SEND_BUF); return remote_bitbang_queue(c, FLUSH_SEND_BUF);

View File

@ -2754,7 +2754,7 @@ static int stlink_usb_read_mem32_noaddrinc(void *handle, uint8_t ap_num, uint32_
{ {
struct stlink_usb_handle *h = handle; struct stlink_usb_handle *h = handle;
assert(handle != NULL); assert(handle);
if (!(h->version.flags & STLINK_F_HAS_MEM_RD_NO_INC)) if (!(h->version.flags & STLINK_F_HAS_MEM_RD_NO_INC))
return ERROR_COMMAND_NOTFOUND; return ERROR_COMMAND_NOTFOUND;
@ -2796,7 +2796,7 @@ static int stlink_usb_write_mem32_noaddrinc(void *handle, uint8_t ap_num, uint32
{ {
struct stlink_usb_handle *h = handle; struct stlink_usb_handle *h = handle;
assert(handle != NULL); assert(handle);
if (!(h->version.flags & STLINK_F_HAS_MEM_WR_NO_INC)) if (!(h->version.flags & STLINK_F_HAS_MEM_WR_NO_INC))
return ERROR_COMMAND_NOTFOUND; return ERROR_COMMAND_NOTFOUND;
@ -3740,7 +3740,7 @@ static int stlink_open(struct hl_interface_param *param, enum stlink_mode mode,
h->st_mode = mode; h->st_mode = mode;
for (unsigned i = 0; param->vid[i]; i++) { for (unsigned int i = 0; param->vid[i]; i++) {
LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s", LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s",
h->st_mode, param->vid[i], param->pid[i], h->st_mode, param->vid[i], param->pid[i],
adapter_get_required_serial() ? adapter_get_required_serial() : ""); adapter_get_required_serial() ? adapter_get_required_serial() : "");
@ -3947,7 +3947,7 @@ static int stlink_usb_rw_misc_out(void *handle, uint32_t items, const uint8_t *b
LOG_DEBUG_IO("%s(%" PRIu32 ")", __func__, items); LOG_DEBUG_IO("%s(%" PRIu32 ")", __func__, items);
assert(handle != NULL); assert(handle);
if (!(h->version.flags & STLINK_F_HAS_RW_MISC)) if (!(h->version.flags & STLINK_F_HAS_RW_MISC))
return ERROR_COMMAND_NOTFOUND; return ERROR_COMMAND_NOTFOUND;
@ -3968,7 +3968,7 @@ static int stlink_usb_rw_misc_in(void *handle, uint32_t items, uint8_t *buffer)
LOG_DEBUG_IO("%s(%" PRIu32 ")", __func__, items); LOG_DEBUG_IO("%s(%" PRIu32 ")", __func__, items);
assert(handle != NULL); assert(handle);
if (!(h->version.flags & STLINK_F_HAS_RW_MISC)) if (!(h->version.flags & STLINK_F_HAS_RW_MISC))
return ERROR_COMMAND_NOTFOUND; return ERROR_COMMAND_NOTFOUND;

View File

@ -606,7 +606,7 @@ static void ulink_clear_queue(struct ulink *device)
/* IN payload MUST be freed ONLY if no other commands use the /* IN payload MUST be freed ONLY if no other commands use the
* payload_in_start buffer */ * payload_in_start buffer */
if (current->free_payload_in_start == true) { if (current->free_payload_in_start) {
free(current->payload_in_start); free(current->payload_in_start);
current->payload_in_start = NULL; current->payload_in_start = NULL;
current->payload_in = NULL; current->payload_in = NULL;
@ -1861,7 +1861,7 @@ static int ulink_post_process_queue(struct ulink *device)
/* Check if a corresponding OpenOCD command is stored for this /* Check if a corresponding OpenOCD command is stored for this
* OpenULINK command */ * OpenULINK command */
if ((current->needs_postprocessing == true) && (openocd_cmd)) { if (current->needs_postprocessing && openocd_cmd) {
switch (openocd_cmd->type) { switch (openocd_cmd->type) {
case JTAG_SCAN: case JTAG_SCAN:
ret = ulink_post_process_scan(current); ret = ulink_post_process_scan(current);
@ -2131,7 +2131,7 @@ static int ulink_init(void)
download_firmware = true; download_firmware = true;
} }
if (download_firmware == true) { if (download_firmware) {
LOG_INFO("Loading OpenULINK firmware. This is reversible by power-cycling" LOG_INFO("Loading OpenULINK firmware. This is reversible by power-cycling"
" ULINK device."); " ULINK device.");
ret = ulink_load_firmware_and_renumerate(&ulink_handle, ret = ulink_load_firmware_and_renumerate(&ulink_handle,

View File

@ -30,7 +30,7 @@
#define SECTION_BUFFERSIZE 16384 #define SECTION_BUFFERSIZE 16384
static int ublast2_libusb_read(struct ublast_lowlevel *low, uint8_t *buf, static int ublast2_libusb_read(struct ublast_lowlevel *low, uint8_t *buf,
unsigned size, uint32_t *bytes_read) unsigned int size, uint32_t *bytes_read)
{ {
int ret, tmp = 0; int ret, tmp = 0;
@ -215,7 +215,7 @@ static int ublast2_libusb_init(struct ublast_lowlevel *low)
const uint16_t vids_renum[] = { low->ublast_vid, 0 }; const uint16_t vids_renum[] = { low->ublast_vid, 0 };
const uint16_t pids_renum[] = { low->ublast_pid, 0 }; const uint16_t pids_renum[] = { low->ublast_pid, 0 };
if (renumeration == false) { if (!renumeration) {
if (jtag_libusb_open(vids_renum, pids_renum, NULL, &low->libusb_dev, NULL) != ERROR_OK) { if (jtag_libusb_open(vids_renum, pids_renum, NULL, &low->libusb_dev, NULL) != ERROR_OK) {
LOG_ERROR("Altera USB-Blaster II not found"); LOG_ERROR("Altera USB-Blaster II not found");
return ERROR_FAIL; return ERROR_FAIL;

View File

@ -30,7 +30,7 @@ struct ublast_lowlevel {
int (*write)(struct ublast_lowlevel *low, uint8_t *buf, int size, int (*write)(struct ublast_lowlevel *low, uint8_t *buf, int size,
uint32_t *bytes_written); uint32_t *bytes_written);
int (*read)(struct ublast_lowlevel *low, uint8_t *buf, unsigned size, int (*read)(struct ublast_lowlevel *low, uint8_t *buf, unsigned int size,
uint32_t *bytes_read); uint32_t *bytes_read);
int (*open)(struct ublast_lowlevel *low); int (*open)(struct ublast_lowlevel *low);
int (*close)(struct ublast_lowlevel *low); int (*close)(struct ublast_lowlevel *low);

View File

@ -28,7 +28,7 @@ static struct ftdi_context *ublast_getftdic(struct ublast_lowlevel *low)
} }
static int ublast_ftdi_read(struct ublast_lowlevel *low, uint8_t *buf, static int ublast_ftdi_read(struct ublast_lowlevel *low, uint8_t *buf,
unsigned size, uint32_t *bytes_read) unsigned int size, uint32_t *bytes_read)
{ {
int retval; int retval;
int timeout = 100; int timeout = 100;

View File

@ -158,7 +158,7 @@ static char *hexdump(uint8_t *buf, unsigned int size)
return str; return str;
} }
static int ublast_buf_read(uint8_t *buf, unsigned size, uint32_t *bytes_read) static int ublast_buf_read(uint8_t *buf, unsigned int size, uint32_t *bytes_read)
{ {
int ret = info.drv->read(info.drv, buf, size, bytes_read); int ret = info.drv->read(info.drv, buf, size, bytes_read);
char *str = hexdump(buf, *bytes_read); char *str = hexdump(buf, *bytes_read);

View File

@ -1887,7 +1887,7 @@ static int xds110_speed(int speed)
} else { } else {
const double XDS110_TCK_PULSE_INCREMENT = 66.0; const double xds110_tck_pulse_increment = 66.0;
freq_to_use = speed * 1000; /* Hz */ freq_to_use = speed * 1000; /* Hz */
delay_count = 0; delay_count = 0;
@ -1908,7 +1908,7 @@ static int xds110_speed(int speed)
double current_value = max_freq_pulse_duration; double current_value = max_freq_pulse_duration;
while (current_value < freq_to_pulse_width_in_ns) { while (current_value < freq_to_pulse_width_in_ns) {
current_value += XDS110_TCK_PULSE_INCREMENT; current_value += xds110_tck_pulse_increment;
++delay_count; ++delay_count;
} }
@ -1919,9 +1919,9 @@ static int xds110_speed(int speed)
if (delay_count) { if (delay_count) {
double diff_freq_1 = freq_to_use - double diff_freq_1 = freq_to_use -
(one_giga / (max_freq_pulse_duration + (one_giga / (max_freq_pulse_duration +
(XDS110_TCK_PULSE_INCREMENT * delay_count))); (xds110_tck_pulse_increment * delay_count)));
double diff_freq_2 = (one_giga / (max_freq_pulse_duration + double diff_freq_2 = (one_giga / (max_freq_pulse_duration +
(XDS110_TCK_PULSE_INCREMENT * (delay_count - 1)))) - (xds110_tck_pulse_increment * (delay_count - 1)))) -
freq_to_use; freq_to_use;
/* One less count value yields a better match */ /* One less count value yields a better match */

View File

@ -43,7 +43,7 @@
struct xlnx_pcie_xvc { struct xlnx_pcie_xvc {
int fd; int fd;
unsigned offset; unsigned int offset;
char *device; char *device;
}; };

View File

@ -76,7 +76,7 @@ int hl_interface_init_target(struct target *t)
if (res != ERROR_OK) if (res != ERROR_OK)
return res; return res;
unsigned ii, limit = t->tap->expected_ids_cnt; unsigned int ii, limit = t->tap->expected_ids_cnt;
int found = 0; int found = 0;
for (ii = 0; ii < limit; ii++) { for (ii = 0; ii < limit; ii++) {
@ -264,7 +264,7 @@ COMMAND_HANDLER(hl_interface_handle_vid_pid_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
unsigned i; unsigned int i;
for (i = 0; i < CMD_ARGC; i += 2) { for (i = 0; i < CMD_ARGC; i += 2) {
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], hl_if.param.vid[i / 2]); COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], hl_if.param.vid[i / 2]);
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], hl_if.param.pid[i / 2]); COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], hl_if.param.pid[i / 2]);
@ -348,7 +348,7 @@ static const struct command_registration hl_interface_subcommand_handlers[] = {
.help = "select which ST-Link backend to use", .help = "select which ST-Link backend to use",
.usage = "usb | tcp [port]", .usage = "usb | tcp [port]",
}, },
{ {
.name = "command", .name = "command",
.handler = &interface_handle_hla_command, .handler = &interface_handle_hla_command,
.mode = COMMAND_EXEC, .mode = COMMAND_EXEC,

View File

@ -343,7 +343,7 @@ static const struct name_mapping {
const char *tap_state_name(tap_state_t state) const char *tap_state_name(tap_state_t state)
{ {
unsigned i; unsigned int i;
for (i = 0; i < ARRAY_SIZE(tap_name_mapping); i++) { for (i = 0; i < ARRAY_SIZE(tap_name_mapping); i++) {
if (tap_name_mapping[i].symbol == state) if (tap_name_mapping[i].symbol == state)
@ -354,7 +354,7 @@ const char *tap_state_name(tap_state_t state)
tap_state_t tap_state_by_name(const char *name) tap_state_t tap_state_by_name(const char *name)
{ {
unsigned i; unsigned int i;
for (i = 0; i < ARRAY_SIZE(tap_name_mapping); i++) { for (i = 0; i < ARRAY_SIZE(tap_name_mapping); i++) {
/* be nice to the human */ /* be nice to the human */
@ -376,11 +376,11 @@ tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
{ {
const uint8_t *tms_buffer; const uint8_t *tms_buffer;
const uint8_t *tdi_buffer; const uint8_t *tdi_buffer;
unsigned tap_bytes; unsigned int tap_bytes;
unsigned cur_byte; unsigned int cur_byte;
unsigned cur_bit; unsigned int cur_bit;
unsigned tap_out_bits; unsigned int tap_out_bits;
char tms_str[33]; char tms_str[33];
char tdi_str[33]; char tdi_str[33];
@ -400,7 +400,7 @@ tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
for (cur_byte = 0; cur_byte < tap_bytes; cur_byte++) { for (cur_byte = 0; cur_byte < tap_bytes; cur_byte++) {
for (cur_bit = 0; cur_bit < 8; cur_bit++) { for (cur_bit = 0; cur_bit < 8; cur_bit++) {
/* make sure we do not run off the end of the buffers */ /* make sure we do not run off the end of the buffers */
unsigned tap_bit = cur_byte * 8 + cur_bit; unsigned int tap_bit = cur_byte * 8 + cur_bit;
if (tap_bit == tap_bits) if (tap_bit == tap_bits)
break; break;

View File

@ -159,7 +159,7 @@ tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
* @returns the final TAP state; pass as @a start_tap_state in following call. * @returns the final TAP state; pass as @a start_tap_state in following call.
*/ */
static inline tap_state_t jtag_debug_state_machine(const void *tms_buf, static inline tap_state_t jtag_debug_state_machine(const void *tms_buf,
const void *tdi_buf, unsigned tap_len, tap_state_t start_tap_state) const void *tdi_buf, unsigned int tap_len, tap_state_t start_tap_state)
{ {
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO))
return jtag_debug_state_machine_(tms_buf, tdi_buf, tap_len, start_tap_state); return jtag_debug_state_machine_(tms_buf, tdi_buf, tap_len, start_tap_state);
@ -183,7 +183,7 @@ struct jtag_interface {
/** /**
* Bit vector listing capabilities exposed by this driver. * Bit vector listing capabilities exposed by this driver.
*/ */
unsigned supported; unsigned int supported;
#define DEBUG_CAP_TMS_SEQ (1 << 0) #define DEBUG_CAP_TMS_SEQ (1 << 0)
/** /**

View File

@ -54,7 +54,7 @@ int interface_jtag_add_tlr(void);
int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path); int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path);
int interface_jtag_add_runtest(unsigned int num_cycles, tap_state_t endstate); int interface_jtag_add_runtest(unsigned int num_cycles, tap_state_t endstate);
int interface_add_tms_seq(unsigned num_bits, int interface_add_tms_seq(unsigned int num_bits,
const uint8_t *bits, enum tap_state state); const uint8_t *bits, enum tap_state state);
/** /**

View File

@ -101,7 +101,7 @@ static const uint8_t swd_seq_line_reset[] = {
/* At least 2 idle (low) cycles */ /* At least 2 idle (low) cycles */
0x00, 0x00,
}; };
static const unsigned swd_seq_line_reset_len = 64; static const unsigned int swd_seq_line_reset_len = 64;
/** /**
* JTAG-to-SWD sequence. * JTAG-to-SWD sequence.
@ -122,7 +122,7 @@ static const uint8_t swd_seq_jtag_to_swd[] = {
/* At least 2 idle (low) cycles */ /* At least 2 idle (low) cycles */
0x00, 0x00,
}; };
static const unsigned swd_seq_jtag_to_swd_len = 136; static const unsigned int swd_seq_jtag_to_swd_len = 136;
/** /**
* SWD-to-JTAG sequence. * SWD-to-JTAG sequence.
@ -141,7 +141,7 @@ static const uint8_t swd_seq_swd_to_jtag[] = {
/* At least 5 TCK/SWCLK cycles with TMS/SWDIO high */ /* At least 5 TCK/SWCLK cycles with TMS/SWDIO high */
0xff, 0xff,
}; };
static const unsigned swd_seq_swd_to_jtag_len = 80; static const unsigned int swd_seq_swd_to_jtag_len = 80;
/** /**
* SWD-to-dormant sequence. * SWD-to-dormant sequence.
@ -156,7 +156,7 @@ static const uint8_t swd_seq_swd_to_dormant[] = {
/* Switching sequence from SWD to dormant */ /* Switching sequence from SWD to dormant */
0xbc, 0xe3, 0xbc, 0xe3,
}; };
static const unsigned swd_seq_swd_to_dormant_len = 72; static const unsigned int swd_seq_swd_to_dormant_len = 72;
/** /**
* Dormant-to-SWD sequence. * Dormant-to-SWD sequence.
@ -187,7 +187,7 @@ static const uint8_t swd_seq_dormant_to_swd[] = {
/* At least 2 idle (low) cycles */ /* At least 2 idle (low) cycles */
0x00, 0x00,
}; };
static const unsigned swd_seq_dormant_to_swd_len = 224; static const unsigned int swd_seq_dormant_to_swd_len = 224;
/** /**
* JTAG-to-dormant sequence. * JTAG-to-dormant sequence.
@ -208,7 +208,7 @@ static const uint8_t swd_seq_jtag_to_dormant[] = {
0x77, /* ((0xbb >> 7) & GENMASK(0, 0)) | ((0xbb << 1) & GENMASK(7, 1)) */ 0x77, /* ((0xbb >> 7) & GENMASK(0, 0)) | ((0xbb << 1) & GENMASK(7, 1)) */
0x67, /* ((0xbb >> 7) & GENMASK(0, 0)) | ((0x33 << 1) & GENMASK(7, 1)) */ 0x67, /* ((0xbb >> 7) & GENMASK(0, 0)) | ((0x33 << 1) & GENMASK(7, 1)) */
}; };
static const unsigned swd_seq_jtag_to_dormant_len = 40; static const unsigned int swd_seq_jtag_to_dormant_len = 40;
/** /**
* Dormant-to-JTAG sequence. * Dormant-to-JTAG sequence.
@ -241,7 +241,7 @@ static const uint8_t swd_seq_dormant_to_jtag[] = {
/* put the TAP in Run/Test Idle */ /* put the TAP in Run/Test Idle */
0x00, 0x00,
}; };
static const unsigned swd_seq_dormant_to_jtag_len = 160; static const unsigned int swd_seq_dormant_to_jtag_len = 160;
struct swd_driver { struct swd_driver {
/** /**

View File

@ -803,10 +803,8 @@ COMMAND_HANDLER(handle_scan_chain_command)
while (tap) { while (tap) {
uint32_t expected, expected_mask, ii; uint32_t expected, expected_mask, ii;
snprintf(expected_id, sizeof(expected_id), "0x%08x", snprintf(expected_id, sizeof(expected_id), "0x%08" PRIx32,
(unsigned)((tap->expected_ids_cnt > 0) (tap->expected_ids_cnt > 0) ? tap->expected_ids[0] : 0);
? tap->expected_ids[0]
: 0));
if (tap->ignore_version) if (tap->ignore_version)
expected_id[2] = '*'; expected_id[2] = '*';
@ -825,8 +823,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
(unsigned int)(expected_mask)); (unsigned int)(expected_mask));
for (ii = 1; ii < tap->expected_ids_cnt; ii++) { for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
snprintf(expected_id, sizeof(expected_id), "0x%08x", snprintf(expected_id, sizeof(expected_id), "0x%08" PRIx32, tap->expected_ids[ii]);
(unsigned) tap->expected_ids[ii]);
if (tap->ignore_version) if (tap->ignore_version)
expected_id[2] = '*'; expected_id[2] = '*';
@ -846,7 +843,7 @@ COMMAND_HANDLER(handle_jtag_ntrst_delay_command)
if (CMD_ARGC > 1) if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
unsigned delay; unsigned int delay;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_ntrst_delay(delay); jtag_set_ntrst_delay(delay);
@ -860,7 +857,7 @@ COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)
if (CMD_ARGC > 1) if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
unsigned delay; unsigned int delay;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_ntrst_assert_width(delay); jtag_set_ntrst_assert_width(delay);
@ -876,7 +873,7 @@ COMMAND_HANDLER(handle_jtag_rclk_command)
int retval = ERROR_OK; int retval = ERROR_OK;
if (CMD_ARGC == 1) { if (CMD_ARGC == 1) {
unsigned khz = 0; unsigned int khz = 0;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
retval = adapter_config_rclk(khz); retval = adapter_config_rclk(khz);
@ -902,7 +899,7 @@ COMMAND_HANDLER(handle_runtest_command)
if (CMD_ARGC != 1) if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num_clocks; unsigned int num_clocks;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks);
jtag_add_runtest(num_clocks, TAP_IDLE); jtag_add_runtest(num_clocks, TAP_IDLE);

View File

@ -258,7 +258,7 @@ static struct command_context *setup_command_handler(Jim_Interp *interp)
&arm_tpiu_swo_register_commands, &arm_tpiu_swo_register_commands,
NULL NULL
}; };
for (unsigned i = 0; command_registrants[i]; i++) { for (unsigned int i = 0; command_registrants[i]; i++) {
int retval = (*command_registrants[i])(cmd_ctx); int retval = (*command_registrants[i])(cmd_ctx);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
command_done(cmd_ctx); command_done(cmd_ctx);

View File

@ -31,7 +31,7 @@ struct chibios_chdebug {
char ch_identifier[4]; /**< @brief Always set to "main". */ char ch_identifier[4]; /**< @brief Always set to "main". */
uint8_t ch_zero; /**< @brief Must be zero. */ uint8_t ch_zero; /**< @brief Must be zero. */
uint8_t ch_size; /**< @brief Size of this structure. */ uint8_t ch_size; /**< @brief Size of this structure. */
uint16_t ch_version; /**< @brief Encoded ChibiOS/RT version. */ uint8_t ch_version[2]; /**< @brief Encoded ChibiOS/RT version. */
uint8_t ch_ptrsize; /**< @brief Size of a pointer. */ uint8_t ch_ptrsize; /**< @brief Size of a pointer. */
uint8_t ch_timesize; /**< @brief Size of a @p systime_t. */ uint8_t ch_timesize; /**< @brief Size of a @p systime_t. */
uint8_t ch_threadsize; /**< @brief Size of a @p Thread struct. */ uint8_t ch_threadsize; /**< @brief Size of a @p Thread struct. */
@ -171,13 +171,7 @@ static int chibios_update_memory_signature(struct rtos *rtos)
" expected. Assuming compatibility..."); " expected. Assuming compatibility...");
} }
/* Convert endianness of version field */ const uint16_t ch_version = target_buffer_get_u16(rtos->target, signature->ch_version);
const uint8_t *versiontarget = (const uint8_t *)
&signature->ch_version;
signature->ch_version = rtos->target->endianness == TARGET_LITTLE_ENDIAN ?
le_to_h_u32(versiontarget) : be_to_h_u32(versiontarget);
const uint16_t ch_version = signature->ch_version;
LOG_INFO("Successfully loaded memory map of ChibiOS/RT target " LOG_INFO("Successfully loaded memory map of ChibiOS/RT target "
"running version %i.%i.%i", GET_CH_KERNEL_MAJOR(ch_version), "running version %i.%i.%i", GET_CH_KERNEL_MAJOR(ch_version),
GET_CH_KERNEL_MINOR(ch_version), GET_CH_KERNEL_PATCH(ch_version)); GET_CH_KERNEL_MINOR(ch_version), GET_CH_KERNEL_PATCH(ch_version));

View File

@ -261,7 +261,7 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
int j = 0; int j = 0;
for (int i = 0; i < reg_list_size; i++) { for (int i = 0; i < reg_list_size; i++) {
if (!reg_list[i] || reg_list[i]->exist == false || reg_list[i]->hidden) if (!reg_list[i] || !reg_list[i]->exist || reg_list[i]->hidden)
continue; continue;
j++; j++;
} }
@ -274,7 +274,7 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
j = 0; j = 0;
for (int i = 0; i < reg_list_size; i++) { for (int i = 0; i < reg_list_size; i++) {
if (!reg_list[i] || reg_list[i]->exist == false || reg_list[i]->hidden) if (!reg_list[i] || !reg_list[i]->exist || reg_list[i]->hidden)
continue; continue;
if (!reg_list[i]->valid) { if (!reg_list[i]->valid) {
retval = reg_list[i]->type->get(reg_list[i]); retval = reg_list[i]->type->get(reg_list[i]);
@ -326,7 +326,7 @@ static int hwthread_get_thread_reg_value(struct rtos *rtos, int64_t thread_id,
return ERROR_FAIL; return ERROR_FAIL;
*size = reg->size; *size = reg->size;
unsigned bytes = DIV_ROUND_UP(reg->size, 8); unsigned int bytes = DIV_ROUND_UP(reg->size, 8);
*value = malloc(bytes); *value = malloc(bytes);
if (!*value) { if (!*value) {
LOG_ERROR("Failed to allocate memory for %d-bit register.", reg->size); LOG_ERROR("Failed to allocate memory for %d-bit register.", reg->size);

View File

@ -397,7 +397,7 @@ int rtos_thread_packet(struct connection *connection, char const *packet, int pa
return ERROR_OK; return ERROR_OK;
} else if (strncmp(packet, "qSymbol", 7) == 0) { } else if (strncmp(packet, "qSymbol", 7) == 0) {
if (rtos_qsymbol(connection, packet, packet_size) == 1) { if (rtos_qsymbol(connection, packet, packet_size) == 1) {
if (target->rtos_auto_detect == true) { if (target->rtos_auto_detect) {
target->rtos_auto_detect = false; target->rtos_auto_detect = false;
target->rtos->type->create(target); target->rtos->type->create(target);
} }

View File

@ -116,7 +116,7 @@ static int gdb_error(struct connection *connection, int retval);
static char *gdb_port; static char *gdb_port;
static char *gdb_port_next; static char *gdb_port_next;
static void gdb_log_callback(void *priv, const char *file, unsigned line, static void gdb_log_callback(void *priv, const char *file, unsigned int line,
const char *function, const char *string); const char *function, const char *string);
static void gdb_sig_halted(struct connection *connection); static void gdb_sig_halted(struct connection *connection);
@ -376,7 +376,7 @@ static int gdb_putback_char(struct connection *connection, int last_char)
/* The only way we can detect that the socket is closed is the first time /* The only way we can detect that the socket is closed is the first time
* we write to it, we will fail. Subsequent write operations will * we write to it, we will fail. Subsequent write operations will
* succeed. Shudder! */ * succeed. Shudder! */
static int gdb_write(struct connection *connection, void *data, int len) static int gdb_write(struct connection *connection, const void *data, int len)
{ {
struct gdb_connection *gdb_con = connection->priv; struct gdb_connection *gdb_con = connection->priv;
if (gdb_con->closed) { if (gdb_con->closed) {
@ -392,7 +392,7 @@ static int gdb_write(struct connection *connection, void *data, int len)
return ERROR_SERVER_REMOTE_CLOSED; return ERROR_SERVER_REMOTE_CLOSED;
} }
static void gdb_log_incoming_packet(struct connection *connection, char *packet) static void gdb_log_incoming_packet(struct connection *connection, const char *packet)
{ {
if (!LOG_LEVEL_IS(LOG_LVL_DEBUG)) if (!LOG_LEVEL_IS(LOG_LVL_DEBUG))
return; return;
@ -401,7 +401,7 @@ static void gdb_log_incoming_packet(struct connection *connection, char *packet)
struct gdb_connection *gdb_connection = connection->priv; struct gdb_connection *gdb_connection = connection->priv;
/* Avoid dumping non-printable characters to the terminal */ /* Avoid dumping non-printable characters to the terminal */
const unsigned packet_len = strlen(packet); const unsigned int packet_len = strlen(packet);
const char *nonprint = find_nonprint_char(packet, packet_len); const char *nonprint = find_nonprint_char(packet, packet_len);
if (nonprint) { if (nonprint) {
/* Does packet at least have a prefix that is printable? /* Does packet at least have a prefix that is printable?
@ -425,7 +425,7 @@ static void gdb_log_incoming_packet(struct connection *connection, char *packet)
} }
} }
static void gdb_log_outgoing_packet(struct connection *connection, char *packet_buf, static void gdb_log_outgoing_packet(struct connection *connection, const char *packet_buf,
unsigned int packet_len, unsigned char checksum) unsigned int packet_len, unsigned char checksum)
{ {
if (!LOG_LEVEL_IS(LOG_LVL_DEBUG)) if (!LOG_LEVEL_IS(LOG_LVL_DEBUG))
@ -443,7 +443,7 @@ static void gdb_log_outgoing_packet(struct connection *connection, char *packet_
} }
static int gdb_put_packet_inner(struct connection *connection, static int gdb_put_packet_inner(struct connection *connection,
char *buffer, int len) const char *buffer, int len)
{ {
int i; int i;
unsigned char my_checksum = 0; unsigned char my_checksum = 0;
@ -565,7 +565,7 @@ static int gdb_put_packet_inner(struct connection *connection,
return ERROR_OK; return ERROR_OK;
} }
int gdb_put_packet(struct connection *connection, char *buffer, int len) int gdb_put_packet(struct connection *connection, const char *buffer, int len)
{ {
struct gdb_connection *gdb_con = connection->priv; struct gdb_connection *gdb_con = connection->priv;
gdb_con->busy = true; gdb_con->busy = true;
@ -1249,7 +1249,7 @@ static void gdb_target_to_reg(struct target *target,
int i; int i;
for (i = 0; i < str_len; i += 2) { for (i = 0; i < str_len; i += 2) {
unsigned t; unsigned int t;
if (sscanf(tstr + i, "%02x", &t) != 1) { if (sscanf(tstr + i, "%02x", &t) != 1) {
LOG_ERROR("BUG: unable to convert register value"); LOG_ERROR("BUG: unable to convert register value");
exit(-1); exit(-1);
@ -1308,7 +1308,7 @@ static int gdb_get_registers_packet(struct connection *connection,
return gdb_error(connection, retval); return gdb_error(connection, retval);
for (i = 0; i < reg_list_size; i++) { for (i = 0; i < reg_list_size; i++) {
if (!reg_list[i] || reg_list[i]->exist == false || reg_list[i]->hidden) if (!reg_list[i] || !reg_list[i]->exist || reg_list[i]->hidden)
continue; continue;
reg_packet_size += DIV_ROUND_UP(reg_list[i]->size, 8) * 2; reg_packet_size += DIV_ROUND_UP(reg_list[i]->size, 8) * 2;
} }
@ -1322,7 +1322,7 @@ static int gdb_get_registers_packet(struct connection *connection,
reg_packet_p = reg_packet; reg_packet_p = reg_packet;
for (i = 0; i < reg_list_size; i++) { for (i = 0; i < reg_list_size; i++) {
if (!reg_list[i] || reg_list[i]->exist == false || reg_list[i]->hidden) if (!reg_list[i] || !reg_list[i]->exist || reg_list[i]->hidden)
continue; continue;
retval = gdb_get_reg_value_as_str(target, reg_packet_p, reg_list[i]); retval = gdb_get_reg_value_as_str(target, reg_packet_p, reg_list[i]);
if (retval != ERROR_OK && gdb_report_register_access_error) { if (retval != ERROR_OK && gdb_report_register_access_error) {
@ -2005,8 +2005,8 @@ static int gdb_memory_map(struct connection *connection,
compare_bank); compare_bank);
for (unsigned int i = 0; i < target_flash_banks; i++) { for (unsigned int i = 0; i < target_flash_banks; i++) {
unsigned sector_size = 0; unsigned int sector_size = 0;
unsigned group_len = 0; unsigned int group_len = 0;
p = banks[i]; p = banks[i];
@ -2311,7 +2311,7 @@ static int get_reg_features_list(struct target *target, char const **feature_lis
*feature_list = calloc(1, sizeof(char *)); *feature_list = calloc(1, sizeof(char *));
for (int i = 0; i < reg_list_size; i++) { for (int i = 0; i < reg_list_size; i++) {
if (reg_list[i]->exist == false || reg_list[i]->hidden) if (!reg_list[i]->exist || reg_list[i]->hidden)
continue; continue;
if (reg_list[i]->feature if (reg_list[i]->feature
@ -2521,7 +2521,7 @@ static int gdb_generate_target_description(struct target *target, char **tdesc_o
int i; int i;
for (i = 0; i < reg_list_size; i++) { for (i = 0; i < reg_list_size; i++) {
if (reg_list[i]->exist == false || reg_list[i]->hidden) if (!reg_list[i]->exist || reg_list[i]->hidden)
continue; continue;
if (strcmp(reg_list[i]->feature->name, features[current_feature])) if (strcmp(reg_list[i]->feature->name, features[current_feature]))
@ -3563,7 +3563,7 @@ static int gdb_fileio_response_packet(struct connection *connection,
return ERROR_OK; return ERROR_OK;
} }
static void gdb_log_callback(void *priv, const char *file, unsigned line, static void gdb_log_callback(void *priv, const char *file, unsigned int line,
const char *function, const char *string) const char *function, const char *string)
{ {
struct connection *connection = priv; struct connection *connection = priv;

View File

@ -28,7 +28,7 @@ int gdb_target_add_all(struct target *target);
int gdb_register_commands(struct command_context *command_context); int gdb_register_commands(struct command_context *command_context);
void gdb_service_free(void); void gdb_service_free(void);
int gdb_put_packet(struct connection *connection, char *buffer, int len); int gdb_put_packet(struct connection *connection, const char *buffer, int len);
int gdb_get_actual_connections(void); int gdb_get_actual_connections(void);

Some files were not shown because too many files have changed in this diff Show More