00001 00027 #ifndef __USBP_PBRD_BLANK_H__ 00028 #define __USBP_PBRD_BLANK_H__ 00029 00030 #include <string> 00031 #include "usbp_iusb_driver.h" 00032 #include "usbp_iusb_device.h" 00033 #include "usbp_iusb_fpga.h" 00034 00035 #include "usbp_cyusb.h" 00036 #include "usbp_fx2lp_8051.h" 00037 #include "usbp_xilinx_xs3.h" 00038 00039 #include "usbp.h" 00040 00041 using namespace std; 00042 00046 class USBP_PBRD_BLANK : public USBP 00047 { 00048 00049 public: 00054 USBP_PBRD_BLANK(){ 00055 // if(LIBUSB) 00056 UsbD = new CUsbpCyUSB; 00057 UsbFpga = new XILINX_XS3; // Not used in blank board 00058 UsbDevice = new FX2LP_8051; // Load firmware and reprogramm PROM. 00059 00060 UsbFpga->setUSB(UsbD); 00061 UsbDevice->setUSB(UsbD); 00062 00063 iVid = 0x04B4; iPid = 0x8613; // Unprogrammed EEPROM. 00064 rVid = 0xFFFE; rPid = 0x8613; // 00065 } 00066 00070 virtual ~USBP_PBRD_BLANK(){ 00071 if(UsbD) 00072 delete UsbD; 00073 if(UsbFpga) 00074 delete UsbFpga; 00075 if(UsbDevice) 00076 delete UsbDevice; 00077 00078 UsbD = NULL; 00079 UsbFpga = NULL; 00080 UsbDevice = NULL; 00081 } 00082 00084 int init_usb(void){ 00085 return init(iVid, iPid); 00086 } 00088 int loadFxFirmware(string file){ 00089 return UsbDevice->downloadFirmware(file, rVid, rPid); 00090 } 00091 00092 // ****** Don't Have Boost.Python 100% figured out, ****** 00093 // ****** some temp funcs ****** 00094 // ****** also found in usbp_python.cpp ****** 00096 string info() { return "USB Protoype System, Blank EEPROM"; } 00097 int deviceInfo(){ UsbD->deviceInfo(); return 0; } 00098 00114 int writeVID_PID(){ 00115 int err; 00116 byte b[9]; 00117 00118 b[0] = 0x00; // Byte Address 00119 b[1] = 0xC0; 00120 b[2] = 0xFE; 00121 b[3] = 0xFF; 00122 b[4] = 0x13; 00123 b[5] = 0x86; 00124 b[6] = 0x01; 00125 b[7] = 0x00; 00126 b[8] = 0x00; 00127 00128 err = UsbDevice->i2c_write(0xA0, b, 9); 00129 00130 return err; 00131 } 00132 00136 #ifdef __UNCOMMENT__ 00137 int writeVID_PID(int vid, int pid){ 00138 int err; 00139 byte b[9]; 00140 00141 b[0] = 0x00; // Byte Address 00142 b[1] = 0xC0; 00143 b[2] = (byte)(vid & 0xFF); //0xFE; 00144 b[3] = (byte)((vid >> 8) & 0xFF); //0xFF; 00145 b[4] = (byte)(pid & 0xFF); //0x13; 00146 b[5] = (byte)((pid >> 8) & 0xFF); //0x86; 00147 b[6] = 0x01; 00148 b[7] = 0x00; 00149 b[8] = 0x00; 00150 00151 err = UsbDevice->i2c_write(0xA0, b, 9); 00152 00153 return err; 00154 } 00155 #endif 00156 00157 }; 00158 00159 #endif
1.5.1-p1