* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
- * Definitions usable by both the cp210x kernel module and userspace.
+ * Header file shared by both the cp210x kernel module and userspace.
*
*/
#if defined(__KERNEL__)
#include <linux/sockios.h>
#else
-#include <asm/types.h>
+#include <linux/types.h>
#include <sys/ioctl.h>
#endif
/* CP2103 GPIO ioctls */
-#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) */
+#define CP210x_IOCTL_GPIOGET (SIOCDEVPRIVATE + 0)
+#define CP210x_IOCTL_GPIOSET (SIOCDEVPRIVATE + 1)
+#define CP210x_IOCTL_GPIOBIC (SIOCDEVPRIVATE + 2)
+#define CP210x_IOCTL_GPIOBIS (SIOCDEVPRIVATE + 3)
/* CP210x ioctls principally used during initial device configuration */
-#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 */
+#define CP210x_IOCTL_DEVICERESET (SIOCDEVPRIVATE + 4)
+#define CP210x_IOCTL_PORTCONFGET (SIOCDEVPRIVATE + 5)
+#define CP210x_IOCTL_PORTCONFSET (SIOCDEVPRIVATE + 6)
+#define CP210x_IOCTL_SETVID (SIOCDEVPRIVATE + 7)
+#define CP210x_IOCTL_SETPID (SIOCDEVPRIVATE + 8)
+#define CP210x_IOCTL_SETPRODUCT (SIOCDEVPRIVATE + 9)
+#define CP210x_IOCTL_SETSERIAL (SIOCDEVPRIVATE + 10)
+#define CP210x_IOCTL_SETDEVVER (SIOCDEVPRIVATE + 11)
/* CP2103 GPIO bit positions */
#define GPIO_0 0x01
#define GPIO_MASK (GPIO_3|GPIO_2|GPIO_1|GPIO_0)
/* USB descriptor sizes */
-#define CP210x_MAX_MFG_STRLEN 255
#define CP210x_MAX_PRODUCT_STRLEN 126
#define CP210x_MAX_SERIAL_STRLEN 63
+#if !defined(__KERNEL__)
/* Mode and latch bit to pin assignments. See AN223 from SiLabs:
* https://www.silabs.com/Support Documents/TechnicalDocs/an223.pdf
*
#define CP210x_ENH_nRS485_TX 0x04
#define CP210x_ENH_nRXLED 0x02
#define CP210x_ENH_nTXLED 0x01
+#endif /* __KERNEL__ */
-/* Used to pass variable sized buffers between user and kernel space (ioctls) */
+/* Used to pass variable size buffers between user and kernel space (ioctls) */
struct cp210x_buffer {
__u8 *buf;
__s32 len;