Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4 | lvd | 1 | #ifndef _TAP_H |
2 | #define _TAP_H |
||
3 | |||
4 | /* |
||
5 | * INFO: |
||
6 | * tap.h (C) 2004 Dr. Yuri Klimets (www.jtag.tk, jtagtools.sf.net) |
||
7 | * E-mail: klimets@jtag.tk |
||
8 | * Rev. 1.2 - 04.01.2004 |
||
9 | * |
||
10 | * |
||
11 | * DESCRIPTION: |
||
12 | * Contains definitions for TAP class |
||
13 | * |
||
14 | * |
||
15 | * NOTES: |
||
16 | * 1. Additional operations (update() and realize()) were added to increase |
||
17 | * the speed of communication with parallel port. You should setup global |
||
18 | * buffer size for these operations during the invoking of class constructor |
||
19 | * |
||
20 | * |
||
21 | * DISCLAIMER: |
||
22 | * This program is free software; you can redistribute it and/or modify |
||
23 | * it under the terms of the GNU General Public License as published by |
||
24 | * the Free Software Foundation; either version 2 of the License, or |
||
25 | * (at your option) any later version. |
||
26 | * |
||
27 | * This program is distributed in the hope that it will be useful, |
||
28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
30 | * GNU General Public License for more details. |
||
31 | * |
||
32 | * You should have received a copy of the GNU General Public License |
||
33 | * along with this program; if not, write to the Free Software |
||
34 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||
35 | */ |
||
36 | |||
37 | #include <stdio.h> |
||
38 | #include <conio.h> |
||
39 | #include "t_tap.h" |
||
40 | #include "types.h" |
||
41 | |||
42 | class TAP { |
||
43 | |||
44 | BYTE oldv; // current state of data register of parallel port (for pins: TDI,TCK,TMS) |
||
45 | int FD; // FILE descriptor to open driver as a file |
||
46 | BYTE MODE; // access method (reserved for Linux and non-standard JTAG cables) |
||
47 | BYTE* g_buf; // global buffer: stores the sequence of signals for JTAG port |
||
48 | DWORD g_pos; // current position in global buffer |
||
49 | int status; // the status of last operation with class TAP (see defs TAP_ ...) |
||
50 | |||
51 | void set_bit(int bit, int val); // sets specified BIT in data port to specified in DATA value |
||
52 | BYTE get_bit(int bit); // returns the current status of specified bit of STATUS reg. |
||
53 | |||
54 | public: |
||
55 | |||
56 | TAP(int port,int g_size); // opens the specified driver to get access to parallel port |
||
57 | ~TAP(); // closes previously opened driver, delete allocated memory |
||
58 | |||
59 | int GetStatus() // returns the status of last operation (see defs TAP_ ...) |
||
60 | {return status;} |
||
61 | |||
62 | void update(); // adds to global buffer curretn state of DATA register (oldv) |
||
63 | void realize(); // realize burst-write of all stored in g_buf data to driver |
||
64 | |||
65 | BYTE TDO() { // returns current state of TDO signal (either '0' or '1') |
||
66 | return get_bit(_TDO_); |
||
67 | } |
||
68 | |||
69 | void TCK(BYTE val) { // sets TCK to specified in 'val' value (either '0' or '1') |
||
70 | set_bit(_TCK_,val); |
||
71 | } |
||
72 | |||
73 | void TMS(BYTE val) { // sets TMS to specified in 'val' value (either '0' or '1') |
||
74 | set_bit(_TMS_,val); |
||
75 | } |
||
76 | |||
77 | void TDI(BYTE val) { // sets TDI to specified in 'val' value (either '0' or '1') |
||
78 | set_bit(_TDI_,val); |
||
79 | } |
||
80 | |||
81 | void TCK_CLOCK(int NUM=1); |
||
82 | |||
83 | }; |
||
84 | |||
85 | #endif |