OpenOCD
versaloon_internal.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com> *
5  ***************************************************************************/
6 
7 #ifndef OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INTERNAL_H
8 #define OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INTERNAL_H
9 
10 #define VERSALOON_PRODUCTSTRING_INDEX 2
11 #define VERSALOON_SERIALSTRING_INDEX 3
12 
13 #define VERSALOON_PRODUCTSTRING "Versaloon"
14 
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
20 
21 #define VERSALOON_FULL 1
22 #define VERSALOON_MINI 2
23 #define VERSALOON_NANO 3
24 
25 #define VERSALOON_TIMEOUT 5000
26 #define VERSALOON_TIMEOUT_LONG 60000
27 
28 /* USB Commands */
29 /* Common Commands */
30 #define VERSALOON_COMMON_CMD_START 0x00
31 #define VERSALOON_COMMON_CMD_END 0x0F
32 
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
42 
43 /* MCU Command */
44 #define VERSALOON_MCU_CMD_START 0x10
45 #define VERSALOON_MCU_CMD_END 0x1F
46 
47 /* USB_TO_XXX Command */
48 #define VERSALOON_USB_TO_XXX_CMD_START 0x20
49 #define VERSALOON_USB_TO_XXX_CMD_END 0x7F
50 
51 /* VSLLink Command */
52 #define VERSALOON_VSLLINK_CMD_START 0x80
53 #define VERSALOON_VSLLINK_CMD_END 0xFF
54 
55 /* Mass-product */
56 #define MP_OK 0x00
57 #define MP_FAIL 0x01
58 
59 #define MP_ISSP 0x11
60 
61 /* pending struct */
62 #define VERSALOON_MAX_PENDING_NUMBER 4096
63 typedef RESULT(*versaloon_callback_t)(void *, uint8_t *, uint8_t *);
65  uint16_t offset;
66  uint16_t size;
67  uint8_t *buff;
69 };
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;
80  void *extra_data;
82 };
83 extern struct versaloon_pending_t
85 extern uint16_t versaloon_pending_idx;
86 void versaloon_set_pending_id(uint32_t id);
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);
93 
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;
98 
99 #endif /* OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INTERNAL_H */
uint8_t type
Definition: esp_usb_jtag.c:0
size_t size
Size of the control block search area.
Definition: rtt/rtt.c:30
struct versaloon_want_pos_t * pos
versaloon_callback_t callback
struct versaloon_want_pos_t * next
uint8_t cmd
Definition: vdebug.c:1
uint8_t offset[4]
Definition: vdebug.c:9
#define RESULT
RESULT(* versaloon_callback_t)(void *, uint8_t *, uint8_t *)
void versaloon_set_callback(versaloon_callback_t callback)
Definition: versaloon.c:93
void versaloon_free_want_pos(void)
Definition: versaloon.c:102
void versaloon_set_pending_id(uint32_t id)
Definition: versaloon.c:89
uint8_t * versaloon_buf
Definition: versaloon.c:21
uint16_t versaloon_pending_idx
Definition: versaloon.c:26
void versaloon_set_extra_data(void *p)
Definition: versaloon.c:97
struct versaloon_pending_t versaloon_pending[VERSALOON_MAX_PENDING_NUMBER]
Definition: versaloon.c:25
uint8_t * versaloon_cmd_buf
Definition: versaloon.c:22
uint16_t versaloon_buf_size
Definition: versaloon.c:23
RESULT versaloon_add_pending(uint8_t type, uint8_t cmd, uint16_t actual_szie, uint16_t want_pos, uint16_t want_size, uint8_t *buffer, uint8_t collect)
Definition: versaloon.c:153
#define VERSALOON_MAX_PENDING_NUMBER
RESULT versaloon_send_command(uint16_t out_len, uint16_t *inlen)
Definition: versaloon.c:184
RESULT versaloon_add_want_pos(uint16_t offset, uint16_t size, uint8_t *buff)
Definition: versaloon.c:126