-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later
/***************************************************************************
* Copyright (C) 2017 by Texas Instruments, Inc. *
static bool usb_send_command(uint16_t size)
{
- int written;
- bool success = true;
-
/* Check the packet length */
if (size > USB_PAYLOAD_SIZE)
return false;
size += 3;
/* Send the data via the USB connection */
- success = usb_write(xds110.write_packet, (int)size, &written);
-
- /* Check if the correct number of bytes was written */
- if (written != (int)size)
- success = false;
-
- return success;
+ return usb_write(xds110.write_packet, (int)size, NULL);
}
/***************************************************************************
/* Transfer results into caller's buffers */
for (result = 0; result < xds110.txn_result_count; result++)
- if (xds110.txn_dap_results[result] != 0)
+ if (xds110.txn_dap_results[result])
*xds110.txn_dap_results[result] = dap_results[result];
xds110.txn_request_size = 0;
static void xds110_swd_read_reg(uint8_t cmd, uint32_t *value,
uint32_t ap_delay_clk)
{
+ assert(cmd & SWD_CMD_RNW);
xds110_swd_queue_cmd(cmd, value);
}
static void xds110_swd_write_reg(uint8_t cmd, uint32_t value,
uint32_t ap_delay_clk)
{
+ assert(!(cmd & SWD_CMD_RNW));
xds110_swd_queue_cmd(cmd, &value);
}
}
bits = 0;
}
- if (xds110.txn_scan_results[result].buffer != 0)
+ if (xds110.txn_scan_results[result].buffer)
bit_copy(xds110.txn_scan_results[result].buffer, 0, data_pntr,
bits, xds110.txn_scan_results[result].num_bits);
bits += xds110.txn_scan_results[result].num_bits;
if (num_states == 0)
return;
- path = (uint8_t *)malloc(num_states * sizeof(uint8_t));
- if (path == 0) {
+ path = malloc(num_states * sizeof(uint8_t));
+ if (!path) {
LOG_ERROR("XDS110: unable to allocate memory");
return;
}
/* Clear data out buffer to default value of all zeros */
memset((void *)buffer, 0x00, total_bytes);
for (i = 0; i < cmd->cmd.scan->num_fields; i++) {
- if (cmd->cmd.scan->fields[i].out_value != 0) {
+ if (cmd->cmd.scan->fields[i].out_value) {
/* Copy over data to scan out into request buffer */
bit_copy(buffer, offset, cmd->cmd.scan->fields[i].out_value, 0,
cmd->cmd.scan->fields[i].num_bits);
}
}
-static int xds110_execute_queue(void)
+static int xds110_execute_queue(struct jtag_command *cmd_queue)
{
- struct jtag_command *cmd = jtag_command_queue;
+ struct jtag_command *cmd = cmd_queue;
while (cmd) {
xds110_execute_command(cmd);