00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00039 #ifndef _ALTERA_JTAG_
00040 #define _ALTERA_JTAG_
00041
00042 #include "jtag_driver.h"
00043 #include "jtag_commander.h"
00044
00046 class AlteraByteBlasterJTAG : public JTAG_Driver
00047 {
00048 public:
00049 bool init( int argc ,
00050 char **argv );
00051
00052 bool drive_signal( int signal ,
00053 bool value ,
00054 bool clock ,
00055 bool test );
00056
00057 unsigned long transfer_data( int bit_count ,
00058 unsigned long data ,
00059 bool instruction );
00060
00061 void flush();
00062
00063 const char *getName() const;
00064
00065 AlteraByteBlasterJTAG();
00066 ~AlteraByteBlasterJTAG();
00067
00068 private:
00069
00070 unsigned char dataVal;
00071 unsigned char ctrlVal;
00072
00073 #ifdef OS_LINUX
00074
00075 unsigned short base_port;
00076 #endif // OS_LINUX
00077
00078 #ifdef OS_WINDOWS
00079
00080 #define PORT_IO_BUFFER_SIZE 256
00081
00082 HANDLE nt_device_handle;
00083
00084 struct
00085 {
00086 unsigned short command;
00087 unsigned short data;
00088 }
00089 port_io_buffer[PORT_IO_BUFFER_SIZE];
00090
00091 int port_io_buffer_count;
00092
00093 #endif // OS_WINDOWS
00094
00095 bool detect();
00096 bool open_port();
00097 void close_port();
00098 bool read_port( unsigned int port ,
00099 unsigned char &data );
00100 bool write_port( unsigned int port ,
00101 unsigned char data ,
00102 bool test );
00103 void flush_ports();
00104
00105 };
00106
00107 #endif // _ALTERA_JTAG_
00108