* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include <target/target.h>
-static struct hl_interface_s hl_if = { {0, 0, 0, 0, 0, HL_TRANSPORT_UNKNOWN, false, -1}, 0, 0 };
+static struct hl_interface_s hl_if = { {0, 0, { 0 }, { 0 }, 0, HL_TRANSPORT_UNKNOWN, false, -1}, 0, 0 };
int hl_interface_open(enum hl_transports tr)
{
if (hl_if.layout->api->close)
hl_if.layout->api->close(hl_if.handle);
+ jtag_command_queue_reset();
+
+ free((void *)hl_if.param.device_desc);
+ free((void *)hl_if.param.serial);
+
return ERROR_OK;
}
return ERROR_FAIL;
}
-int hl_interface_config_trace(bool enabled, enum tpio_pin_protocol pin_protocol,
- uint32_t port_size, unsigned int *trace_freq)
+int hl_interface_config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol,
+ uint32_t port_size, unsigned int *trace_freq,
+ unsigned int traceclkin_freq, uint16_t *prescaler)
{
if (hl_if.layout->api->config_trace)
- return hl_if.layout->api->config_trace(hl_if.handle, enabled, pin_protocol,
- port_size, trace_freq);
+ return hl_if.layout->api->config_trace(hl_if.handle, enabled,
+ pin_protocol, port_size, trace_freq, traceclkin_freq, prescaler);
else if (enabled) {
LOG_ERROR("The selected interface does not support tracing");
return ERROR_FAIL;
COMMAND_HANDLER(hl_interface_handle_vid_pid_command)
{
- LOG_DEBUG("hl_interface_handle_vid_pid_command");
-
- if (CMD_ARGC != 2) {
- LOG_WARNING("ignoring extra IDs in hl_vid_pid (maximum is 1 pair)");
+ if (CMD_ARGC > HLA_MAX_USB_IDS * 2) {
+ LOG_WARNING("ignoring extra IDs in hla_vid_pid "
+ "(maximum is %d pairs)", HLA_MAX_USB_IDS);
+ CMD_ARGC = HLA_MAX_USB_IDS * 2;
+ }
+ if (CMD_ARGC < 2 || (CMD_ARGC & 1)) {
+ LOG_WARNING("incomplete hla_vid_pid configuration directive");
return ERROR_COMMAND_SYNTAX_ERROR;
}
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], hl_if.param.vid);
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[1], hl_if.param.pid);
+ unsigned i;
+ 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 + 1], hl_if.param.pid[i / 2]);
+ }
+
+ /*
+ * Explicitly terminate, in case there are multiple instances of
+ * hla_vid_pid.
+ */
+ hl_if.param.vid[i / 2] = hl_if.param.pid[i / 2] = 0;
return ERROR_OK;
}