OpenOCD
versaloon.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * Copyright (C) 2009 by Simon Qian <SimonQian@SimonQian.com> *
5  ***************************************************************************/
6 
7 #ifndef OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_H
8 #define OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_H
9 
10 #include <libusb.h>
11 
13  uint32_t tx_buff_avail;
14  uint32_t tx_buff_size;
15  uint32_t rx_buff_avail;
16  uint32_t rx_buff_size;
17 };
18 
19 #include "usbtoxxx/usbtoxxx.h"
20 
21 /* GPIO pins */
22 #define GPIO_SRST (1 << 0)
23 #define GPIO_TRST (1 << 1)
24 #define GPIO_USR1 (1 << 2)
25 #define GPIO_USR2 (1 << 3)
26 #define GPIO_TCK (1 << 4)
27 #define GPIO_TDO (1 << 5)
28 #define GPIO_TDI (1 << 6)
29 #define GPIO_RTCK (1 << 7)
30 #define GPIO_TMS (1 << 8)
31 
33  RESULT(*init)(uint8_t interface_index);
34  RESULT(*fini)(uint8_t interface_index);
35  RESULT(*config)(uint8_t interface_index, uint32_t pin_mask, uint32_t io,
36  uint32_t pull_en_mask, uint32_t input_pull_mask);
37  RESULT(*out)(uint8_t interface_index, uint32_t pin_mask, uint32_t value);
38  RESULT(*in)(uint8_t interface_index, uint32_t pin_mask, uint32_t *value);
39 };
40 
42  RESULT(*delayms)(uint16_t ms);
43  RESULT(*delayus)(uint16_t us);
44 };
45 
47  RESULT(*init)(uint8_t interface_index);
48  RESULT(*fini)(uint8_t interface_index);
49  RESULT(*config)(uint8_t interface_index, uint8_t trn, uint16_t retry,
50  uint16_t dly);
51  RESULT(*seqout)(uint8_t interface_index, const uint8_t *data,
52  uint16_t bitlen);
53  RESULT(*seqin)(uint8_t interface_index, uint8_t *data, uint16_t bitlen);
54  RESULT(*transact)(uint8_t interface_index, uint8_t request,
55  uint32_t *data, uint8_t *ack);
56 };
57 
59  RESULT(*init)(uint8_t interface_index);
60  RESULT(*fini)(uint8_t interface_index);
61  RESULT(*config)(uint8_t interface_index, uint32_t khz);
62  RESULT(*execute)(uint8_t interface_index, uint8_t *tdi, uint8_t *tms,
63  uint8_t *tdo, uint32_t bitlen);
64 };
65 
67  RESULT(*get)(uint16_t *voltage);
68  RESULT(*set)(uint16_t voltage);
69 };
70 
73  struct interface_gpio_t gpio;
74  struct interface_delay_t delay;
75  struct interface_swd_t swd;
78 };
79 
81  uint16_t vid;
82  uint16_t pid;
83  uint8_t ep_out;
84  uint8_t ep_in;
85  uint8_t interface;
86  uint16_t buf_size;
87 };
88 
90  RESULT(*init)(void);
91  RESULT(*fini)(void);
94 };
95 
97 extern struct libusb_device_handle *versaloon_usb_device_handle;
98 
99 #endif /* OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_H */
RESULT(* delayms)(uint16_t ms)
Definition: versaloon.h:42
RESULT(* delayus)(uint16_t us)
Definition: versaloon.h:43
RESULT(* fini)(uint8_t interface_index)
Definition: versaloon.h:34
RESULT(* init)(uint8_t interface_index)
Definition: versaloon.h:33
RESULT(* out)(uint8_t interface_index, uint32_t pin_mask, uint32_t value)
Definition: versaloon.h:37
RESULT(* config)(uint8_t interface_index, uint32_t pin_mask, uint32_t io, uint32_t pull_en_mask, uint32_t input_pull_mask)
Definition: versaloon.h:35
RESULT(* in)(uint8_t interface_index, uint32_t pin_mask, uint32_t *value)
Definition: versaloon.h:38
RESULT(* init)(uint8_t interface_index)
Definition: versaloon.h:59
RESULT(* execute)(uint8_t interface_index, uint8_t *tdi, uint8_t *tms, uint8_t *tdo, uint32_t bitlen)
Definition: versaloon.h:62
RESULT(* config)(uint8_t interface_index, uint32_t khz)
Definition: versaloon.h:61
RESULT(* fini)(uint8_t interface_index)
Definition: versaloon.h:60
RESULT(* seqin)(uint8_t interface_index, uint8_t *data, uint16_t bitlen)
Definition: versaloon.h:53
RESULT(* seqout)(uint8_t interface_index, const uint8_t *data, uint16_t bitlen)
Definition: versaloon.h:51
RESULT(* init)(uint8_t interface_index)
Definition: versaloon.h:47
RESULT(* transact)(uint8_t interface_index, uint8_t request, uint32_t *data, uint8_t *ack)
Definition: versaloon.h:54
RESULT(* config)(uint8_t interface_index, uint8_t trn, uint16_t retry, uint16_t dly)
Definition: versaloon.h:49
RESULT(* fini)(uint8_t interface_index)
Definition: versaloon.h:48
RESULT(* get)(uint16_t *voltage)
Definition: versaloon.h:67
RESULT(* set)(uint16_t voltage)
Definition: versaloon.h:68
uint32_t tx_buff_avail
Definition: versaloon.h:13
uint32_t tx_buff_size
Definition: versaloon.h:14
uint32_t rx_buff_avail
Definition: versaloon.h:15
uint32_t rx_buff_size
Definition: versaloon.h:16
struct interface_target_voltage_t target_voltage
Definition: versaloon.h:72
struct interface_swd_t swd
Definition: versaloon.h:75
struct interface_gpio_t gpio
Definition: versaloon.h:73
RESULT(* peripheral_commit)(void)
Definition: versaloon.h:77
struct interface_delay_t delay
Definition: versaloon.h:74
struct interface_jtag_raw_t jtag_raw
Definition: versaloon.h:76
RESULT(* fini)(void)
Definition: versaloon.h:91
struct versaloon_adaptors_t adaptors
Definition: versaloon.h:92
RESULT(* init)(void)
Definition: versaloon.h:90
struct versaloon_usb_setting_t usb_setting
Definition: versaloon.h:93
struct libusb_device_handle * versaloon_usb_device_handle
Definition: versaloon.c:28
struct versaloon_interface_t versaloon_interface
Definition: versaloon.c:38
#define RESULT