usbp_xilinx_xs3.cpp

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00007 #include <iostream>
00008 #include <stdio.h>  
00009 #include "usbp_xilinx_xs3.h"
00010 #include "config_files.h"
00011 #include "upl_err.h"
00012 
00018 int XILINX_XS3::downloadConfigFile(string file)
00019 {
00020   int err = UPL_OK;
00021   int herr;
00022   CConfigFiles cfg;
00023   byte b[64];
00024   int num_bytes = 0;
00025   
00026   // Start FPGA Config
00027   err = configStart();
00028   
00029   if(err){ 
00030     std::cerr << "  Control Write, VRQ_FPGA_CONFIG Failed" << endl;
00031     return UPL_ERR;
00032   }
00033   
00034   cfg.xbtOpen(file);
00035   
00036   // Get chucks of the file upto 64 bytes
00037   while(1){
00038     int len = 64;
00039     herr = cfg.xbtRead(b, len);    
00040     
00041     if(herr || len == 0){
00042       break;
00043     }
00044     err = configWrite(b, len);
00045     
00046     if(!err){ 
00047       num_bytes += len;
00048     }
00049     else {
00050       std::cerr << "FPGA Config Failed" << endl;
00051       break;
00052     }
00053   }
00054   
00055   err = configEnd();
00056   
00057   cfg.xbtClose();
00058   
00059   return err;
00060 }
00061 

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