]> oss.titaniummirror.com Git - cp210x.git/blobdiff - src/cp210x.h
Several fixes.
[cp210x.git] / src / cp210x.h
index 2de79d3077d1c1de2fe76e92c7eb4557ebda9fc3..f3c96a801baa7a97e7221a227b549c1359fc4b3a 100644 (file)
 #if !defined(CP210X_H)
 #define CP210X_H
 
+#if defined(__KERNEL__)
+#include <linux/sockios.h>
+#else
+#include <asm/types.h>
+#include <sys/ioctl.h>
+#endif
+
 /* CP2103 GPIO ioctls */
-#define IOCTL_GPIOGET          0x8000  /* Get gpio bits */
-#define IOCTL_GPIOSET          0x8001  /* Set gpio bits */
-#define IOCTL_GPIOBIC          0x8002  /* Clear specific gpio bit(s) */
-#define IOCTL_GPIOBIS          0x8003  /* Set specific gpio bit(s) */
+#define CP210x_IOCTL_GPIOGET           (SIOCDEVPRIVATE + 0)    /* Get gpio bits */
+#define CP210x_IOCTL_GPIOSET           (SIOCDEVPRIVATE + 1)    /* Set gpio bits */
+#define CP210x_IOCTL_GPIOBIC           (SIOCDEVPRIVATE + 2)    /* Clear specific gpio bit(s) */
+#define CP210x_IOCTL_GPIOBIS           (SIOCDEVPRIVATE + 3)    /* Set specific gpio bit(s) */
 
 /* CP210x ioctls principally used during initial device configuration */
-#define IOCTL_DEVICERESET      0x8004  /* Reset the cp210x */
-#define IOCTL_PORTCONFGET      0x8005  /* Get port configuration */
-#define IOCTL_PORTCONFSET      0x8006  /* Set port configuration */
-#define IOCTL_SETVID           0x8007  /* Set vendor id */
-#define IOCTL_SETPID           0x8008  /* Set product id */
-#define IOCTL_SETMFG           0x8009  /* Set manufacturer string */
-#define IOCTL_SETPRODUCT       0x800a  /* Set product string */
-#define IOCTL_SETSERIAL                0x800b  /* Set serial number string */
-#define IOCTL_SETDEVVER                0x800c  /* Set device version id */
+#define CP210x_IOCTL_DEVICERESET       (SIOCDEVPRIVATE + 4)    /* Reset the cp210x */
+#define CP210x_IOCTL_PORTCONFGET       (SIOCDEVPRIVATE + 5)    /* Get port configuration */
+#define CP210x_IOCTL_PORTCONFSET       (SIOCDEVPRIVATE + 6)    /* Set port configuration */
+#define CP210x_IOCTL_SETVID            (SIOCDEVPRIVATE + 7)    /* Set vendor id */
+#define CP210x_IOCTL_SETPID            (SIOCDEVPRIVATE + 8)    /* Set product id */
+#define CP210x_IOCTL_SETMFG            (SIOCDEVPRIVATE + 9)    /* Set manufacturer string */
+#define CP210x_IOCTL_SETPRODUCT        (SIOCDEVPRIVATE + 10)   /* Set product string */
+#define CP210x_IOCTL_SETSERIAL         (SIOCDEVPRIVATE + 11)   /* Set serial number string */
+#define CP210x_IOCTL_SETDEVVER         (SIOCDEVPRIVATE + 12)   /* Set device version id */
 
 /* CP2103 GPIO bit positions */
 #define GPIO_0                 0x01
 #define GPIO_1                 0x02
 #define GPIO_2                 0x04
 #define GPIO_3                 0x08
-#define GPIO_MASK              (GPIO_0|GPIO_1|GPIO_2|GPIO_3)
+#define GPIO_MASK              (GPIO_3|GPIO_2|GPIO_1|GPIO_0)
 
 /* USB descriptor sizes */
 #define        CP210x_MAX_MFG_STRLEN           255