tcl/interface: support for Raspberry Pi 5
[openocd.git] / src / jtag / drivers / versaloon / versaloon_internal.h
blobedeb335a2d3bc548f5272d35a429be23a37b0cdf
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 /***************************************************************************
4 * Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com> *
5 ***************************************************************************/
7 #ifndef OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INTERNAL_H
8 #define OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INTERNAL_H
10 #define VERSALOON_PRODUCTSTRING_INDEX 2
11 #define VERSALOON_SERIALSTRING_INDEX 3
13 #define VERSALOON_PRODUCTSTRING "Versaloon"
15 #define VERSALOON_VID 0x0483
16 #define VERSALOON_PID 0xA038
17 #define VERSALOON_INP 0x82
18 #define VERSALOON_OUTP 0x03
19 #define VERSALOON_IFACE 0x00
21 #define VERSALOON_FULL 1
22 #define VERSALOON_MINI 2
23 #define VERSALOON_NANO 3
25 #define VERSALOON_TIMEOUT 5000
26 #define VERSALOON_TIMEOUT_LONG 60000
28 /* USB Commands */
29 /* Common Commands */
30 #define VERSALOON_COMMON_CMD_START 0x00
31 #define VERSALOON_COMMON_CMD_END 0x0F
33 #define VERSALOON_GET_INFO 0x00
34 #define VERSALOON_GET_TVCC 0x01
35 #define VERSALOON_GET_HARDWARE 0x02
36 #define VERSALOON_GET_OFFLINE_SIZE 0x08
37 #define VERSALOON_ERASE_OFFLINE_DATA 0x09
38 #define VERSALOON_WRITE_OFFLINE_DATA 0x0A
39 #define VERSALOON_GET_OFFLINE_CHECKSUM 0x0B
40 #define VERSALOON_FW_UPDATE 0x0F
41 #define VERSALOON_FW_UPDATE_KEY 0xAA
43 /* MCU Command */
44 #define VERSALOON_MCU_CMD_START 0x10
45 #define VERSALOON_MCU_CMD_END 0x1F
47 /* USB_TO_XXX Command */
48 #define VERSALOON_USB_TO_XXX_CMD_START 0x20
49 #define VERSALOON_USB_TO_XXX_CMD_END 0x7F
51 /* VSLLink Command */
52 #define VERSALOON_VSLLINK_CMD_START 0x80
53 #define VERSALOON_VSLLINK_CMD_END 0xFF
55 /* Mass-product */
56 #define MP_OK 0x00
57 #define MP_FAIL 0x01
59 #define MP_ISSP 0x11
61 /* pending struct */
62 #define VERSALOON_MAX_PENDING_NUMBER 4096
63 typedef RESULT(*versaloon_callback_t)(void *, uint8_t *, uint8_t *);
64 struct versaloon_want_pos_t {
65 uint16_t offset;
66 uint16_t size;
67 uint8_t *buff;
68 struct versaloon_want_pos_t *next;
70 struct versaloon_pending_t {
71 uint8_t type;
72 uint8_t cmd;
73 uint16_t want_data_pos;
74 uint16_t want_data_size;
75 uint16_t actual_data_size;
76 uint8_t *data_buffer;
77 uint8_t collect;
78 uint32_t id;
79 struct versaloon_want_pos_t *pos;
80 void *extra_data;
81 versaloon_callback_t callback;
83 extern struct versaloon_pending_t
84 versaloon_pending[VERSALOON_MAX_PENDING_NUMBER];
85 extern uint16_t versaloon_pending_idx;
86 void versaloon_set_pending_id(uint32_t id);
87 void versaloon_set_callback(versaloon_callback_t callback);
88 void versaloon_set_extra_data(void *p);
89 RESULT versaloon_add_want_pos(uint16_t offset, uint16_t size, uint8_t *buff);
90 RESULT versaloon_add_pending(uint8_t type, uint8_t cmd, uint16_t actual_szie,
91 uint16_t want_pos, uint16_t want_size, uint8_t *buffer, uint8_t collect);
92 void versaloon_free_want_pos(void);
94 RESULT versaloon_send_command(uint16_t out_len, uint16_t *inlen);
95 extern uint8_t *versaloon_buf;
96 extern uint8_t *versaloon_cmd_buf;
97 extern uint16_t versaloon_buf_size;
99 #endif /* OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INTERNAL_H */