]> git.zerfleddert.de Git - rigol/blobdiff - usbtmc.c
include stdint.h
[rigol] / usbtmc.c
index 622ea8099914c8f26746ef288d4e6483a8b29308..835b6c8b84b2a6449f13f4e98e16052248f5dc9d 100644 (file)
--- a/usbtmc.c
+++ b/usbtmc.c
@@ -8,6 +8,14 @@
 
 #define USB_TIMEOUT 50000
 
 
 #define USB_TIMEOUT 50000
 
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define LE32(x) x
+#elif BYTE_ORDER == BIG_ENDIAN
+#define LE32(x) ((uint32_t)((((uint32_t)x)>>24) | ((((uint32_t)x)>>8) & 0xff00) | ((((uint32_t)x)<<8) & 0xff0000) | (((uint32_t)x)<<24)))
+#else
+#error BYTE_ORDER not defined/known!
+#endif
+
 //Helper-routine: Convert a little-endian 4-byte word to an int
 static void int2chars(unsigned char *buff,unsigned int a) {
        buff[3]=(a>>24)&0xff;
 //Helper-routine: Convert a little-endian 4-byte word to an int
 static void int2chars(unsigned char *buff,unsigned int a) {
        buff[3]=(a>>24)&0xff;
@@ -126,8 +134,7 @@ usb_dev_handle* usbtmc_initscope(void) {
        //Locate and open the scope
        dev = usbtmc_find_scope();
        if (!dev) {
        //Locate and open the scope
        dev = usbtmc_find_scope();
        if (!dev) {
-               printf("No scope found.\n");
-               exit(1);
+               return NULL;
        }
        usbtmc_claim(dev);
        //The following code isn't really necessary, the program works
        }
        usbtmc_claim(dev);
        //The following code isn't really necessary, the program works
Impressum, Datenschutz