1 |
39 |
julius |
/*$$HEADER*/
|
2 |
|
|
/******************************************************************************/
|
3 |
|
|
/* */
|
4 |
|
|
/* H E A D E R I N F O R M A T I O N */
|
5 |
|
|
/* */
|
6 |
|
|
/******************************************************************************/
|
7 |
|
|
|
8 |
|
|
// Project Name : OpenRISC Debug Proxy
|
9 |
|
|
// File Name : usb_functions.h
|
10 |
|
|
// Prepared By : jb
|
11 |
|
|
// Project Start : 2008-10-01
|
12 |
|
|
|
13 |
|
|
/*$$COPYRIGHT NOTICE*/
|
14 |
|
|
/******************************************************************************/
|
15 |
|
|
/* */
|
16 |
|
|
/* C O P Y R I G H T N O T I C E */
|
17 |
|
|
/* */
|
18 |
|
|
/******************************************************************************/
|
19 |
|
|
/*
|
20 |
|
|
This library is free software; you can redistribute it and/or
|
21 |
|
|
modify it under the terms of the GNU Lesser General Public
|
22 |
|
|
License as published by the Free Software Foundation;
|
23 |
|
|
version 2.1 of the License, a copy of which is available from
|
24 |
|
|
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
|
25 |
|
|
|
26 |
|
|
This library is distributed in the hope that it will be useful,
|
27 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
29 |
|
|
Lesser General Public License for more details.
|
30 |
|
|
|
31 |
|
|
You should have received a copy of the GNU Lesser General Public
|
32 |
|
|
License along with this library; if not, write to the Free Software
|
33 |
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
34 |
|
|
*/
|
35 |
|
|
|
36 |
|
|
/*$$CHANGE HISTORY*/
|
37 |
|
|
/******************************************************************************/
|
38 |
|
|
/* */
|
39 |
|
|
/* C H A N G E H I S T O R Y */
|
40 |
|
|
/* */
|
41 |
|
|
/******************************************************************************/
|
42 |
|
|
|
43 |
|
|
// Date Version Description
|
44 |
|
|
//------------------------------------------------------------------------
|
45 |
|
|
// 081101 First revision jb
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
#ifndef CYGWIN_COMPILE
|
49 |
|
|
#include "WinTypes.h"
|
50 |
|
|
#endif
|
51 |
|
|
#include <stdint.h> // for uint_t types
|
52 |
|
|
/* Function prototypes */
|
53 |
|
|
uint32_t crc_calc(uint32_t crc, uint32_t input_bit);
|
54 |
|
|
/* Crc of current read or written data. */
|
55 |
|
|
extern uint32_t crc_r, crc_w;
|
56 |
|
|
|
57 |
|
|
int retry_do();
|
58 |
|
|
void retry_ok();
|
59 |
|
|
|
60 |
|
|
void usb_close_device_handle();
|
61 |
|
|
void usb_write_stream (uint32_t stream, uint32_t num_bits, DWORD dwTapControllerState);
|
62 |
|
|
void usb_readwritewrite_stream (uint32_t num_bits);
|
63 |
|
|
uint32_t usb_read_stream(uint32_t num_bits, DWORD dwTapControllerState);
|
64 |
|
|
uint32_t bit_reverse_data(uint32_t data, uint32_t length);
|
65 |
|
|
|
66 |
|
|
void usb_set_tap_ir(uint32_t ir);
|
67 |
|
|
void usb_dbg_test();
|
68 |
|
|
int usb_dbg_reset();
|
69 |
|
|
int usb_dbg_set_chain(int chain);
|
70 |
|
|
int usb_dbg_command(uint32_t type, uint32_t adr, uint32_t len);
|
71 |
|
|
int usb_dbg_ctrl(uint32_t reset, uint32_t stall);
|
72 |
|
|
int usb_dbg_ctrl_read(uint32_t *reset, uint32_t *stall);
|
73 |
|
|
int usb_dbg_go(unsigned char *data, uint16_t len, uint32_t read);
|
74 |
|
|
|
75 |
94 |
julius |
int usb_dbg_wb_read8(uint32_t adr, uint8_t *data);
|
76 |
39 |
julius |
int usb_dbg_wb_read32(uint32_t adr, uint32_t *data);
|
77 |
|
|
int usb_dbg_wb_read_block32(uint32_t adr, uint32_t *data, uint32_t len);
|
78 |
46 |
julius |
int usb_dbg_wb_write8(uint32_t adr, uint8_t data);
|
79 |
39 |
julius |
int usb_dbg_wb_write32(uint32_t adr, uint32_t data);
|
80 |
|
|
int usb_dbg_wb_write_block32(uint32_t adr, uint32_t *data, uint32_t len);
|
81 |
47 |
julius |
int usb_dbg_cpu0_read(uint32_t adr, uint32_t *data, uint32_t length);
|
82 |
39 |
julius |
int usb_dbg_cpu0_read_ctrl(uint32_t adr, unsigned char *data);
|
83 |
47 |
julius |
int usb_dbg_cpu0_write(uint32_t adr, uint32_t *data, uint32_t length);
|
84 |
39 |
julius |
int usb_dbg_cpu0_write_ctrl(uint32_t adr, unsigned char data);
|