Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

altera_jtag.h

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  * altera_jtag.hpp -- Altera ByteBlasterMV Parallel Port to JTAG 
00003  *                    interface 
00004  *--------------------------------------------------------------------
00005  * $Id: altera_jtag.h,v 1.2 2003/03/18 16:50:43 cgaudin Exp $
00006  *--------------------------------------------------------------------
00007  * This file is part of JTAG Framework
00008  * (c) 2002 Julien Pilet <julien.pilet@epfl.ch> and
00009  *          Stephane Magnenat <stephane.magnenat@epfl.ch>
00010  *--------------------------------------------------------------------
00011  * JTAG Framework is free software; you can redistribute it
00012  * and/or modify it under the terms of the GNU General Public License 
00013  * as published by the Free Software Foundation; either version 2 of 
00014  * the License, or (at your option) any later version.
00015  *
00016  * JTAG Framework is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with Foobar; if not, write to: 
00023  * Free Software Foundation, Inc., 
00024  * 59 Temple Place, 
00025  * Suite 330, Boston, MA  02111-1307  USA
00026  *--------------------------------------------------------------------
00027  * OS_LINUX          for Linux
00028  * OS_WINDOWS        for Windows NT/2000/XP
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; // handle on LPT1 device
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 

Generated on Fri May 16 13:01:44 2003 for Jelie by doxygen1.2.15