Subversion Repositories f9daq

Rev

Rev 82 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #include "wusbvme_dll.h"
  2.  
  3. usb_dev_handle *udev;
  4. static HINSTANCE DLLHandle;
  5.  
  6. void _VI_FUNC WUSBVME_load (char* module_path)
  7. {
  8.   if (module_path == NULL)
  9.     DLLHandle = LoadLibrary("libxxusb.dll");
  10.    else
  11.     DLLHandle = LoadLibrary(module_path);
  12.    
  13.   if (!(xxusb_register_read_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_register_read"))) exit(1);
  14.   if (!(xxusb_stack_read_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_stack_read"))) exit(1);
  15.   if (!(xxusb_stack_write_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_stack_write"))) exit(1);
  16.   if (!(xxusb_stack_execute_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_stack_execute"))) exit(1);
  17.   if (!(xxusb_register_write_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_register_write"))) exit(1);
  18.   if (!(xxusb_usbfifo_read_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_usbfifo_read"))) exit(1);
  19.   if (!(xxusb_bulk_read_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_bulk_read"))) exit(1);
  20.   if (!(xxusb_bulk_write_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_bulk_write"))) exit(1);
  21.   if (!(xxusb_reset_toggle_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_reset_toggle"))) exit(1);
  22.  
  23.   if (!(xxusb_devices_find_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_devices_find"))) exit(1);
  24.   if (!(xxusb_device_close_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_device_close"))) exit(1);
  25.   if (!(xxusb_device_open_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_device_open"))) exit(1);
  26.   if (!(xxusb_flash_program_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_flash_program"))) exit(1);
  27.   if (!(xxusb_flashblock_program_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_flashblock_program"))) exit(1);
  28.   if (!(xxusb_serial_open_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_serial_open"))) exit(1);
  29.   if (!(VME_register_write_Ptr = (void*) GetProcAddress(DLLHandle,"VME_register_write"))) exit(1);
  30.   if (!(VME_register_read_Ptr = (void*) GetProcAddress(DLLHandle,"VME_register_read"))) exit(1);
  31.   if (!(VME_LED_settings_Ptr = (void*) GetProcAddress(DLLHandle,"VME_LED_settings"))) exit(1);
  32.   if (!(VME_DGG_Ptr = (void*) GetProcAddress(DLLHandle,"VME_DGG"))) exit(1);
  33.   if (!(VME_Output_settings_Ptr = (void*) GetProcAddress(DLLHandle,"VME_Output_settings"))) exit(1);
  34.   if (!(VME_read_16_Ptr = (void*) GetProcAddress(DLLHandle,"VME_read_16"))) exit(1);
  35.   if (!(VME_read_32_Ptr = (void*) GetProcAddress(DLLHandle,"VME_read_32"))) exit(1);
  36.   if (!(VME_BLT_read_32_Ptr = (void*) GetProcAddress(DLLHandle,"VME_BLT_read_32"))) exit(1);
  37.   if (!(VME_write_16_Ptr = (void*) GetProcAddress(DLLHandle,"VME_write_16"))) exit(1);
  38.   if (!(VME_write_32_Ptr = (void*) GetProcAddress(DLLHandle,"VME_write_32"))) exit(1);
  39. }
  40.  
  41. void _VI_FUNC WUSBVME_open (char *serial)
  42. {
  43.   if (serial != NULL)
  44.         udev = xxusb_serial_open(serial);
  45. }
  46.  
  47. void _VI_FUNC WUSBVME_close (void)
  48. {
  49.   if (udev) xxusb_device_close(udev);
  50. }
  51.