usbp_pbrd_v01.h

Go to the documentation of this file.
00001 
00027 #ifndef __USBP_PBRD_V01_H__
00028 #define __USBP_PBRD_V01_H__
00029 
00030 #include <string>
00031 
00032 #include <boost/python.hpp>
00033 #include <boost/python/list.hpp>
00034 #include <boost/python/extract.hpp>
00035 
00036 #include "usbp_iusb_driver.h"
00037 #include "usbp_iusb_device.h"
00038 #include "usbp_iusb_fpga.h"
00039 
00040 #include "usbp_cyusb.h"
00041 #include "usbp_fx2lp_8051.h"
00042 #include "usbp_xilinx_xs3.h"
00043 
00044 #include "usbp.h"
00045 
00046 using namespace std;
00047 namespace BP=boost::python;
00048 //namespace numpy=num_util;
00049 
00050 #define MAX_LEN  (512)
00051 
00055 class USBP_PBRD_V01 : public USBP
00056 {
00057 
00058 public:
00063   USBP_PBRD_V01(){
00064     // if(LIBUSB)
00065     UsbD      = new CUsbpCyUSB;
00066     UsbFpga   = new XILINX_XS3;
00067     UsbDevice = new FX2LP_8051;
00068 
00069     UsbFpga->setUSB(UsbD);
00070     UsbDevice->setUSB(UsbD);
00071 
00072     iVid = 0xFFFE; iPid = 0x8613;
00073     rVid = 0xFFFE; rPid = 0x8613;
00074   }
00075   
00079   virtual ~USBP_PBRD_V01(){
00080     if(UsbD)
00081       delete UsbD;
00082     if(UsbFpga)
00083       delete UsbFpga;
00084     if(UsbDevice)
00085       delete UsbDevice;
00086 
00087     UsbD      = NULL;
00088     UsbFpga   = NULL;
00089     UsbDevice = NULL;
00090   }
00091 
00092   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00094   int init_usb(void){
00095     return init(iVid, iPid);
00096   }
00098   int loadFxFirmware(string file){
00099     return UsbDevice->downloadFirmware(file, iVid, iPid);
00100   }
00102   int configFPGA(string file){
00103     return UsbFpga->downloadConfigFile(file);
00104   }
00105 
00106   // ****** Don't Have Boost.Python 100% figured out, ******
00107   // ****** some temp funcs                           ******
00108   // ****** also found in usbp_python.cpp             ******
00110   string info() { return "USB Protype System"; } 
00111   int deviceInfo(){ UsbD->deviceInfo(); return 0; }
00113   int testFPGAXfer(int data);
00114   int testXferLoopback(int x);
00115   int testFPGAXferSpeed(void);
00116 
00117   int PyReadData(BP::list& pyList);
00118   int PyWriteData(BP::list& pyList);
00119   
00120   int ReadReg(int addr, int& data);
00121   int WriteReg(int addr, int data);
00122 
00123 };
00124 
00125 #endif

Generated on Mon Mar 5 20:44:19 2007 for usbp by  doxygen 1.5.1-p1