-
Notifications
You must be signed in to change notification settings - Fork 3
/
ch341a_bitbang_wch.h
68 lines (52 loc) · 1.95 KB
/
ch341a_bitbang_wch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* avrdude - A Downloader/Uploader for AVR device programmers
*
* avrdude support for CH341
* Copyright (C) 2016 Alexey Sadkov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef ch341a_bitbang_wch_h
#define ch341a_bitbang_wch_h
#if defined(WIN32NATIVE)
#define CH341A_VID 0x1A86
#define CH341A_PID 0x5512
#define CH341A_PACKET_LENGTH 0x20
#define CH341A_USB_BULK_ENDPOINT 0x02
#define CH341A_PACKET_LENGTH 0x20
#define CH341A_USB_TIMEOUT 15000
#define CH341A_CMD_SPI_STREAM 0xA8 //SPI command
#define CH341A_CMD_UIO_STREAM 0xAB //UIO command
#define CH341A_CMD_UIO_STM_IN 0x00 // UIO Interface In ( D0 ~ D7 )
#define CH341A_CMD_UIO_STM_DIR 0x40 // UIO interface Dir( set dir of D0~D5 )
#define CH341A_CMD_UIO_STM_OUT 0x80 // UIO Interface Output(D0~D5)
#define CH341A_CMD_UIO_STM_END 0x20 // UIO Interface End Command
#define CH341A_CMD_UIO_STM_US 0xC0
#define CH341A_CMD_I2C_STREAM 0xAA
#define CH341A_CMD_I2C_STM_SET 0x60 // bit 2: SPI with two data pairs D5,D4=out, D7,D6=in
#define CH341A_CMD_I2C_STM_END 0x00
/* USB error identifiers */
#define USB_ERROR_NOTFOUND 1
#define USB_ERROR_ACCESS 2
#define USB_ERROR_IO 3
#ifdef __cplusplus
extern "C" {
#endif
extern const char ch341a_bitbang_wch_desc[];
void ch341a_bitbang_wch_initpgm (PROGRAMMER * pgm);
#ifdef __cplusplus
}
#endif
#endif
#endif /* ch341a_bitbang_wch_h */