#include <jtag/hla/hla_transport.h>
#include <jtag/hla/hla_interface.h>
#include <jtag/swim.h>
+#include <target/arm_adi_v5.h>
#include <target/target.h>
#include <transport/transport.h>
#define STLINK_V3E_PID (0x374E)
#define STLINK_V3S_PID (0x374F)
#define STLINK_V3_2VCP_PID (0x3753)
+#define STLINK_V3E_NO_MSD_PID (0x3754)
/*
* ST-Link/V1, ST-Link/V2 and ST-Link/V2.1 are full-speed USB devices and
transfers[i].transfer_size = 0;
transfers[i].transfer = libusb_alloc_transfer(0);
- if (transfers[i].transfer == NULL) {
+ if (!transfers[i].transfer) {
for (size_t j = 0; j < i; ++j)
libusb_free_transfer(transfers[j].transfer);
}
}
- if (h->version.jtag_api == STLINK_JTAG_API_V3) {
+ if (h->version.jtag_api == STLINK_JTAG_API_V3 &&
+ (emode == STLINK_MODE_DEBUG_JTAG || emode == STLINK_MODE_DEBUG_SWD)) {
struct speed_map map[STLINK_V3_MAX_FREQ_NB];
stlink_get_com_freq(h, (emode == STLINK_MODE_DEBUG_JTAG), map);
h->cmdbuf = malloc(STLINK_SG_SIZE);
h->databuf = malloc(STLINK_DATA_SIZE);
- if (h->cmdbuf == NULL || h->databuf == NULL)
+ if (!h->cmdbuf || !h->databuf)
return ERROR_FAIL;
/*
case STLINK_V3E_PID:
case STLINK_V3S_PID:
case STLINK_V3_2VCP_PID:
+ case STLINK_V3E_NO_MSD_PID:
h->version.stlink = 3;
h->tx_ep = STLINK_V2_1_TX_EP;
h->trace_ep = STLINK_V2_1_TRACE_EP;
h->tcp_backend_priv.send_buf = malloc(STLINK_TCP_SEND_BUFFER_SIZE);
h->tcp_backend_priv.recv_buf = malloc(STLINK_TCP_RECV_BUFFER_SIZE);
- if (h->tcp_backend_priv.send_buf == NULL || h->tcp_backend_priv.recv_buf == NULL)
+ if (!h->tcp_backend_priv.send_buf || !h->tcp_backend_priv.recv_buf)
return ERROR_FAIL;
h->cmdbuf = &h->tcp_backend_priv.send_buf[8];