Changeset 9546
- Timestamp:
- 09/14/09 01:22:02 (4 years ago)
- Location:
- ossiedev/branches/ttsou/gnuradio/trunk
- Files:
-
- 12 modified
-
config/usrp_libusb.m4 (modified) (1 diff)
-
usrp/host/lib/fusb.cc (modified) (1 diff)
-
usrp/host/lib/fusb.h (modified) (1 diff)
-
usrp/host/lib/fusb_sysconfig_linux.cc (modified) (1 diff)
-
usrp/host/lib/fusb_sysconfig_win32.cc (modified) (1 diff)
-
usrp/host/lib/fusb_win32.cc (modified) (1 diff)
-
usrp/host/lib/usrp_basic_common.cc (modified) (1 diff)
-
usrp/host/lib/usrp_basic_libusb.cc (modified) (3 diffs)
-
usrp/host/lib/usrp_basic_libusb1.cc (modified) (3 diffs)
-
usrp/host/lib/usrp_prims_common.cc (modified) (11 diffs)
-
usrp/host/lib/usrp_prims_libusb.cc (modified) (6 diffs)
-
usrp/host/lib/usrp_prims_libusb1.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/ttsou/gnuradio/trunk/config/usrp_libusb.m4
r9545 r9546 109 109 echo 'struct usb_device;'>> $tmpfile 110 110 echo 'struct usb_dev_handle;'>> $tmpfile 111 echo 'typedef struct usb_device libusb_device;' >> $tmpfile 112 echo 'typedef struct usb_dev_handle libusb_device_handle;' >> $tmpfile 111 echo 'struct usb_device_descriptor;' >> $tmpfile 112 echo 'typedef usb_device libusb_device;' >> $tmpfile 113 echo 'typedef usb_dev_handle libusb_device_handle;' >> $tmpfile 114 echo 'typedef usb_device_descriptor libusb_device_descriptor;' >> $tmpfile 113 115 echo >> $tmpfile 114 116 fi -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/fusb.cc
r9501 r9546 21 21 */ 22 22 23 #ifdef HAVE_CONFIG_H24 #include "config.h"25 #endif23 //#ifdef HAVE_CONFIG_H 24 //#include "config.h" 25 //#endif 26 26 27 27 #include <fusb.h> -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/fusb.h
r9543 r9546 66 66 67 67 // ACCESSORS 68 libusb_device_handle *get_ libusb_device_handle () const { return d_udh; }68 libusb_device_handle *get_usb_dev_handle () const { return d_udh; } 69 69 }; 70 70 -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/fusb_sysconfig_linux.cc
r9543 r9546 31 31 fusb_sysconfig::make_devhandle (usb_dev_handle *udh, libusb_context *ctx) 32 32 { 33 make_devhandle(udh);33 return new fusb_devhandle_linux (udh); 34 34 } 35 35 -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/fusb_sysconfig_win32.cc
r9501 r9546 28 28 29 29 fusb_devhandle * 30 fusb_sysconfig::make_devhandle (usb_dev_handle *udh )30 fusb_sysconfig::make_devhandle (usb_dev_handle *udh, libusb_context *ctx) 31 31 { 32 32 return new fusb_devhandle_win32 (udh); -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/fusb_win32.cc
r9501 r9546 21 21 */ 22 22 23 #ifdef HAVE_CONFIG_H24 #include "config.h"25 #endif23 //#ifdef HAVE_CONFIG_H 24 //#include "config.h" 25 //#endif 26 26 27 27 #include <fusb_win32.h> -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/usrp_basic_common.cc
r9539 r9546 21 21 */ 22 22 23 #ifdef HAVE_CONFIG_H24 #include "config.h"25 #endif23 //#ifdef HAVE_CONFIG_H 24 //#include "config.h" 25 //#endif 26 26 27 27 #include "usrp/usrp_basic.h" -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/usrp_basic_libusb.cc
r9539 r9546 21 21 */ 22 22 23 #ifdef HAVE_CONFIG_H24 #include "config.h"25 #endif23 //#ifdef HAVE_CONFIG_H 24 //#include "config.h" 25 //#endif 26 26 27 27 #include <usrp/usrp_basic.h> … … 44 44 #define NELEM(x) (sizeof (x) / sizeof (x[0])) 45 45 46 // These set the buffer size used for each end point using the fast47 // usb interface. The kernel ends up locking down this much memory.48 49 static const int FUSB_BUFFER_SIZE = fusb_sysconfig::default_buffer_size();50 static const int FUSB_BLOCK_SIZE = fusb_sysconfig::max_block_size();51 static const int FUSB_NBLOCKS = FUSB_BUFFER_SIZE / FUSB_BLOCK_SIZE;52 53 46 54 47 static const double POLLING_INTERVAL = 0.1; // seconds … … 66 59 // CLKSEL pin = high 67 60 // 68 // These settings give us:69 61 // CLKOUT1 = CLKIN = 64 MHz 70 62 // CLKOUT2 = CLKIN = 64 MHz -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/usrp_basic_libusb1.cc
r9539 r9546 44 44 45 45 #define NELEM(x) (sizeof (x) / sizeof (x[0])) 46 47 // These set the buffer size used for each end point using the fast48 // usb interface. The kernel ends up locking down this much memory.49 50 static const int FUSB_BUFFER_SIZE = fusb_sysconfig::default_buffer_size();51 static const int FUSB_BLOCK_SIZE = fusb_sysconfig::max_block_size();52 static const int FUSB_NBLOCKS = FUSB_BUFFER_SIZE / FUSB_BLOCK_SIZE;53 46 54 47 … … 104 97 memset (d_fpga_shadows, 0, sizeof (d_fpga_shadows)); 105 98 106 // d_ctx = usrp_one_time_init(true);107 99 usrp_one_time_init (&d_ctx); 108 100 … … 145 137 libusb_close (d_udh); 146 138 147 // Each object should be running in it's own context. If running in default 148 // context then leave the instance open as it may be shared. This might 149 // occur in mixed libusb-0.12 and libusb-1.0 environments. 139 // Each object _should_ be running in its own context. If running in default 140 // context then leave the instance open as it may be shared. 150 141 151 142 if (d_ctx != NULL) -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/usrp_prims_common.cc
r9542 r9546 41 41 #include <ad9862.h> 42 42 #include <assert.h> 43 #include "std_paths.h" 43 44 44 45 #ifdef HAVE_LIBUSB_1 … … 68 69 69 70 70 #include "std_paths.h"71 #include <stdio.h>72 73 71 static char * 74 72 find_file (const char *filename, int hw_rev) … … 108 106 109 107 110 void power_down_9862s (libusb_device_handle *udh); 108 static void power_down_9862s (libusb_device_handle *udh); 109 111 110 112 111 // ---------------------------------------------------------------- 113 112 113 /* 114 * q must be a real USRP, not an FX2. Return its hardware rev number. 115 */ 116 117 int 118 usrp_hw_rev (libusb_device *q) 119 { 120 libusb_device_descriptor desc = get_usb_device_descriptor(q); 121 return desc.bcdDevice & 0x00FF; 122 } 123 124 /* 125 * q must be a real USRP, not an FX2. Return true if it's configured. 126 */ 127 static bool 128 _usrp_configured_p (libusb_device *q) 129 { 130 libusb_device_descriptor desc = get_usb_device_descriptor(q); 131 return (desc.bcdDevice & 0xFF00) != 0; 132 } 133 134 bool 135 usrp_usrp_p (libusb_device *q) 136 { 137 libusb_device_descriptor desc = get_usb_device_descriptor(q); 138 return (desc.idVendor == USB_VID_FSF 139 && desc.idProduct == USB_PID_FSF_USRP); 140 } 141 142 bool 143 usrp_fx2_p (libusb_device *q) 144 { 145 libusb_device_descriptor desc = get_usb_device_descriptor(q); 146 return (desc.idVendor == USB_VID_CYPRESS 147 && desc.idProduct == USB_PID_CYPRESS_FX2); 148 } 149 114 150 bool 115 151 usrp_usrp0_p (libusb_device *q) … … 142 178 return usrp_usrp_p (q) && _usrp_configured_p (q); 143 179 } 180 181 182 // ---------------------------------------------------------------- 183 144 184 145 185 libusb_device_handle * … … 159 199 { 160 200 return usrp_open_interface (dev, USRP_TX_INTERFACE, USRP_TX_ALTINTERFACE); 201 } 202 203 204 // ---------------------------------------------------------------- 205 // write internal ram using Cypress vendor extension 206 207 static bool 208 write_internal_ram (libusb_device_handle *udh, unsigned char *buf, 209 int start_addr, size_t len) 210 { 211 int addr; 212 int n; 213 int a; 214 int quanta = MAX_EP0_PKTSIZE; 215 216 for (addr = start_addr; addr < start_addr + (int) len; addr += quanta){ 217 n = len + start_addr - addr; 218 if (n > quanta) 219 n = quanta; 220 221 a = usb_control_transfer (udh, 0x40, 0xA0, addr, 0, 222 (unsigned char*)(buf + (addr - start_addr)), n, 1000); 223 224 if (a < 0){ 225 fprintf(stderr,"write_internal_ram failed: %u\n", a); 226 return false; 227 } 228 } 229 return true; 161 230 } 162 231 … … 349 418 } 350 419 420 bool 421 usrp_set_hash (libusb_device_handle *udh, int which, 422 const unsigned char hash[USRP_HASH_SIZE]) 423 { 424 which &= 1; 425 426 // we use the Cypress firmware down load command to jam it in. 427 int r = usb_control_transfer (udh, 0x40, 0xa0, hash_slot_addr[which], 0, 428 (unsigned char *) hash, USRP_HASH_SIZE, 1000); 429 return r == USRP_HASH_SIZE; 430 } 431 432 bool 433 usrp_get_hash (libusb_device_handle *udh, int which, 434 unsigned char hash[USRP_HASH_SIZE]) 435 { 436 which &= 1; 437 438 // we use the Cypress firmware upload command to fetch it. 439 int r = usb_control_transfer (udh, 0xc0, 0xa0, hash_slot_addr[which], 0, 440 (unsigned char *) hash, USRP_HASH_SIZE, 1000); 441 return r == USRP_HASH_SIZE; 442 } 443 444 351 445 352 446 static bool … … 356 450 } 357 451 358 bool452 static bool 359 453 usrp1_fpga_write (libusb_device_handle *udh, 360 454 int regno, int value) … … 375 469 } 376 470 377 bool471 static bool 378 472 usrp1_fpga_read (libusb_device_handle *udh, 379 473 int regno, int *value) … … 393 487 } 394 488 489 bool 490 usrp_write_fpga_reg (libusb_device_handle *udh, int reg, int value) 491 { 492 switch (usrp_hw_rev (get_usb_device (udh))){ 493 case 0: // not supported ;) 494 abort(); 495 496 default: 497 return usrp1_fpga_write (udh, reg, value); 498 } 499 } 500 501 bool 502 usrp_read_fpga_reg (libusb_device_handle *udh, int reg, int *value) 503 { 504 switch (usrp_hw_rev (get_usb_device (udh))){ 505 case 0: // not supported ;) 506 abort(); 507 508 default: 509 return usrp1_fpga_read (udh, reg, value); 510 } 511 } 395 512 396 513 bool … … 815 932 } 816 933 934 static void 935 power_down_9862s (libusb_device_handle *udh) 936 { 937 static const unsigned char regs[] = { 938 REG_RX_PWR_DN, 0x01, // everything 939 REG_TX_PWR_DN, 0x0f, // pwr dn digital and analog_both 940 REG_TX_MODULATOR, 0x00 // coarse & fine modulators disabled 941 }; 942 943 switch (usrp_hw_rev (get_usb_device (udh))){ 944 case 0: 945 break; 946 947 default: 948 usrp_9862_write_many_all (udh, regs, sizeof (regs)); 949 break; 950 } 951 } 952 817 953 818 954 static const int EEPROM_PAGESIZE = 16; … … 1078 1214 0, buf, sizeof (buf)); 1079 1215 } 1216 1217 1218 1219 1220 -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/usrp_prims_libusb.cc
r9542 r9546 27 27 #include "usrp/usrp_prims.h" 28 28 #include "usrp_commands.h" 29 #include "usrp_ids.h"30 #include "usrp_i2c_addr.h"31 #include "fpga_regs_common.h"32 #include "fpga_regs_standard.h"33 29 #include <usb.h> 34 30 #include <errno.h> … … 38 34 #include <string.h> 39 35 #include <ctype.h> 40 #include <time.h> // FIXME should check with autoconf (nanosleep)41 #include <algorithm>42 36 #include <ad9862.h> 43 37 #include <assert.h> … … 47 41 }; 48 42 49 #define VERBOSE 050 51 43 using namespace ad9862; 52 44 53 static const int FIRMWARE_HASH_SLOT = 0; 54 static const int FPGA_HASH_SLOT = 1; 55 56 static const int hash_slot_addr[2] = { 57 USRP_HASH_SLOT_0_ADDR, 58 USRP_HASH_SLOT_1_ADDR 59 }; 60 61 static const char *default_firmware_filename = "std.ihx"; 62 static const char *default_fpga_filename = "std_2rxhb_2tx.rbf"; 63 64 #include "std_paths.h" 65 #include <stdio.h> 45 struct usb_device_descriptor 46 get_usb_device_descriptor (struct usb_device *q) 47 { 48 return q->descriptor; 49 } 50 51 struct usb_device * 52 get_usb_device (struct usb_dev_handle *udh) 53 { 54 return usb_device (udh); 55 } 56 57 int 58 usb_control_transfer (struct usb_dev_handle *udh, int request_type, 59 int request, int value, int index, 60 unsigned char *data, int length, unsigned int timeout) 61 { 62 return usb_control_msg (udh, request_type, 63 request, value, index, 64 (char*) data, length, (int) timeout); 65 66 } 67 68 69 // ---------------------------------------------------------------- 70 66 71 67 72 void … … 85 90 } 86 91 87 // ---------------------------------------------------------------- 88 89 /* 90 * q must be a real USRP, not an FX2. Return its hardware rev number. 91 */ 92 int 93 usrp_hw_rev (struct usb_device *q) 94 { 95 return q->descriptor.bcdDevice & 0x00FF; 96 } 97 98 /* 99 * q must be a real USRP, not an FX2. Return true if it's configured. 100 */ 101 bool 102 _usrp_configured_p (struct usb_device *q) 103 { 104 return (q->descriptor.bcdDevice & 0xFF00) != 0; 105 } 106 107 bool 108 usrp_usrp_p (struct usb_device *q) 109 { 110 return (q->descriptor.idVendor == USB_VID_FSF 111 && q->descriptor.idProduct == USB_PID_FSF_USRP); 112 } 113 114 bool 115 usrp_fx2_p (struct usb_device *q) 116 { 117 return (q->descriptor.idVendor == USB_VID_CYPRESS 118 && q->descriptor.idProduct == USB_PID_CYPRESS_FX2); 119 } 120 121 // ---------------------------------------------------------------- 92 93 // ---------------------------------------------------------------- 94 122 95 123 96 struct usb_device * … … 202 175 } 203 176 204 // ----------------------------------------------------------------205 // write internal ram using Cypress vendor extension206 207 bool208 write_internal_ram (struct usb_dev_handle *udh, unsigned char *buf,209 int start_addr, size_t len)210 {211 int addr;212 int n;213 int a;214 int quanta = MAX_EP0_PKTSIZE;215 216 for (addr = start_addr; addr < start_addr + (int) len; addr += quanta){217 n = len + start_addr - addr;218 if (n > quanta)219 n = quanta;220 221 a = usb_control_msg (udh, 0x40, 0xA0,222 addr, 0, (char *)(buf + (addr - start_addr)), n, 1000);223 224 if (a < 0){225 fprintf(stderr,"write_internal_ram failed: %s\n", usb_strerror());226 return false;227 }228 }229 return true;230 }231 232 177 233 178 // ---------------------------------------------------------------- 234 179 // write vendor extension command to USRP 180 235 181 236 182 int … … 253 199 254 200 255 bool 256 usrp_set_hash (struct usb_dev_handle *udh, int which, 257 const unsigned char hash[USRP_HASH_SIZE]) 258 { 259 which &= 1; 260 261 // we use the Cypress firmware down load command to jam it in. 262 int r = usb_control_msg (udh, 0x40, 0xa0, hash_slot_addr[which], 0, 263 (char *) hash, USRP_HASH_SIZE, 1000); 264 return r == USRP_HASH_SIZE; 265 } 266 267 bool 268 usrp_get_hash (struct usb_dev_handle *udh, int which, 269 unsigned char hash[USRP_HASH_SIZE]) 270 { 271 which &= 1; 272 273 // we use the Cypress firmware upload command to fetch it. 274 int r = usb_control_msg (udh, 0xc0, 0xa0, hash_slot_addr[which], 0, 275 (char *) hash, USRP_HASH_SIZE, 1000); 276 return r == USRP_HASH_SIZE; 277 } 278 279 bool 280 usrp_write_fpga_reg (struct usb_dev_handle *udh, int reg, int value) 281 { 282 switch (usrp_hw_rev (usb_device (udh))){ 283 case 0: // not supported ;) 284 abort(); 285 286 default: 287 return usrp1_fpga_write (udh, reg, value); 288 } 289 } 290 291 bool 292 usrp_read_fpga_reg (struct usb_dev_handle *udh, int reg, int *value) 293 { 294 switch (usrp_hw_rev (usb_device (udh))){ 295 case 0: // not supported ;) 296 abort(); 297 298 default: 299 return usrp1_fpga_read (udh, reg, value); 300 } 301 } 302 303 304 void 305 power_down_9862s (struct usb_dev_handle *udh) 306 { 307 static const unsigned char regs[] = { 308 REG_RX_PWR_DN, 0x01, // everything 309 REG_TX_PWR_DN, 0x0f, // pwr dn digital and analog_both 310 REG_TX_MODULATOR, 0x00 // coarse & fine modulators disabled 311 }; 312 313 switch (usrp_hw_rev (usb_device (udh))){ 314 case 0: 315 break; 316 317 default: 318 usrp_9862_write_many_all (udh, regs, sizeof (regs)); 319 break; 320 } 321 } 322 323 // ---------------------------------------------------------------- 201 // ---------------------------------------------------------------- 202 324 203 325 204 std::string -
ossiedev/branches/ttsou/gnuradio/trunk/usrp/host/lib/usrp_prims_libusb1.cc
r9542 r9546 42 42 #include <ad9862.h> 43 43 #include <assert.h> 44 #include "std_paths.h" 44 45 45 46 extern "C" { … … 47 48 }; 48 49 49 #define VERBOSE 050 51 50 using namespace ad9862; 52 51 53 static const int FIRMWARE_HASH_SLOT = 0; 54 static const int FPGA_HASH_SLOT = 1; 55 56 static const int hash_slot_addr[2] = { 57 USRP_HASH_SLOT_0_ADDR, 58 USRP_HASH_SLOT_1_ADDR 59 }; 60 61 static const char *default_firmware_filename = "std.ihx"; 62 static const char *default_fpga_filename = "std_2rxhb_2tx.rbf"; 63 64 #include "std_paths.h" 65 #include <stdio.h> 52 53 struct libusb_device_descriptor 54 get_usb_device_descriptor(struct libusb_device *q) 55 { 56 int ret; 57 struct libusb_device_descriptor desc; 58 59 if ((ret = libusb_get_device_descriptor(q, &desc)) < 0) 60 fprintf (stderr, "usrp: libusb_get_device_descriptor failed %d\n", ret); 61 62 return desc; 63 } 64 65 struct libusb_device * 66 get_usb_device (struct libusb_device_handle *udh) 67 { 68 return libusb_get_device (udh); 69 } 70 71 int 72 usb_control_transfer (struct usb_dev_handle *udh, uint8_t request_type, 73 uint8_t request, uint16_t value, uint16_t index, 74 unsigned char *data, uint16_t length, 75 unsigned int timeout) 76 { 77 return libusb_control_transfer (udh, request_type, request, value, index, 78 *data, length, timeout); 79 80 } 81 82 83 // ---------------------------------------------------------------- 84 66 85 67 86 void … … 80 99 } 81 100 82 // ----------------------------------------------------------------83 84 /*85 * q must be a real USRP, not an FX2. Return its hardware rev number.86 */87 int88 usrp_hw_rev (struct libusb_device *q)89 {90 struct libusb_device_descriptor desc;91 if (libusb_get_device_descriptor(q, &desc) < 0)92 fprintf (stderr, "usrp: libusb_get_device_descriptor failed\n");93 94 return desc.bcdDevice & 0x00FF;95 }96 97 /*98 * q must be a real USRP, not an FX2. Return true if it's configured.99 */100 bool101 _usrp_configured_p (struct libusb_device *q)102 {103 struct libusb_device_descriptor desc;104 if (libusb_get_device_descriptor(q, &desc) < 0)105 fprintf (stderr, "usrp: libusb_get_device_descriptor failed\n");106 107 return (desc.bcdDevice & 0xFF00) != 0;108 }109 110 bool111 usrp_usrp_p (struct libusb_device *q)112 {113 struct libusb_device_descriptor desc;114 if (libusb_get_device_descriptor(q, &desc) < 0)115 fprintf (stderr, "usrp: libusb_get_device_descriptor failed\n");116 117 return (desc.idVendor == USB_VID_FSF118 && desc.idProduct == USB_PID_FSF_USRP);119 }120 121 bool122 usrp_fx2_p (struct libusb_device *q)123 {124 struct libusb_device_descriptor desc;125 if (libusb_get_device_descriptor(q, &desc) < 0)126 fprintf (stderr, "usrp: libusb_get_device_descriptor failed\n");127 128 return (desc.idVendor == USB_VID_CYPRESS129 && desc.idProduct == USB_PID_CYPRESS_FX2);130 }131 132 133 // ----------------------------------------------------------------134 101 135 102 struct libusb_device * … … 208 175 } 209 176 210 // ----------------------------------------------------------------211 // write internal ram using Cypress vendor extension212 213 bool214 write_internal_ram (struct libusb_device_handle *udh, unsigned char *buf,215 int start_addr, size_t len)216 {217 int addr;218 int n;219 int a;220 int quanta = MAX_EP0_PKTSIZE;221 222 for (addr = start_addr; addr < start_addr + (int) len; addr += quanta){223 n = len + start_addr - addr;224 if (n > quanta)225 n = quanta;226 227 a = libusb_control_transfer (udh, 0x40, 0xA0,228 addr, 0, (unsigned char *)(buf + (addr - start_addr)), n, 1000);229 230 if (a < 0){231 fprintf(stderr,"write_internal_ram failed: %u\n", a);232 return false;233 }234 }235 return true;236 }237 177 238 178 // ---------------------------------------------------------------- 239 179 // write vendor extension command to USRP 180 240 181 241 182 int … … 259 200 } 260 201 261 bool262 usrp_set_hash (struct libusb_device_handle *udh, int which,263 const unsigned char hash[USRP_HASH_SIZE])264 {265 which &= 1;266 267 // we use the Cypress firmware down load command to jam it in.268 int r = libusb_control_transfer (udh, 0x40, 0xa0, hash_slot_addr[which], 0,269 (unsigned char *) hash, USRP_HASH_SIZE, 1000);270 return r == USRP_HASH_SIZE;271 }272 273 bool274 usrp_get_hash (struct libusb_device_handle *udh, int which,275 unsigned char hash[USRP_HASH_SIZE])276 {277 which &= 1;278 279 // we use the Cypress firmware upload command to fetch it.280 int r = libusb_control_transfer (udh, 0xc0, 0xa0, hash_slot_addr[which], 0,281 (unsigned char *) hash, USRP_HASH_SIZE, 1000);282 return r == USRP_HASH_SIZE;283 }284 285 bool286 usrp_write_fpga_reg (struct libusb_device_handle *udh, int reg, int value)287 {288 switch (usrp_hw_rev (libusb_get_device (udh))){289 case 0: // not supported ;)290 abort();291 292 default:293 return usrp1_fpga_write (udh, reg, value);294 }295 }296 297 bool298 usrp_read_fpga_reg (struct libusb_device_handle *udh, int reg, int *value)299 {300 switch (usrp_hw_rev (libusb_get_device (udh))){301 case 0: // not supported ;)302 abort();303 304 default:305 return usrp1_fpga_read (udh, reg, value);306 }307 }308 309 310 311 void312 power_down_9862s (struct libusb_device_handle *udh)313 {314 static const unsigned char regs[] = {315 REG_RX_PWR_DN, 0x01, // everything316 REG_TX_PWR_DN, 0x0f, // pwr dn digital and analog_both317 REG_TX_MODULATOR, 0x00 // coarse & fine modulators disabled318 };319 320 switch (usrp_hw_rev (libusb_get_device (udh))){321 case 0:322 break;323 324 default:325 usrp_9862_write_many_all (udh, regs, sizeof (regs));326 break;327 }328 }329 330 202 331 203 // ----------------------------------------------------------------