1 /****************************************************************************
3 * Copyright (c) 2006 Dave Hylands <dhylands@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
14 ****************************************************************************/
21 * This implements a driver for using the robostix from the gumstix
23 * Initially, this contains the required support to emulate enough of the
24 * parallel port interface to allow avrdude to program the ATMega128.
26 *****************************************************************************/
28 #if !defined( LINUX_ROBOSTIX_H )
29 #define LINUX_ROBOSTIX_H )
31 /* ---- Include Files ----------------------------------------------------- */
33 #include <linux/ioctl.h>
35 /* ---- Constants and Types ----------------------------------------------- */
37 #define ROBOSTIX_MAJOR 240
39 #define ROBOSTIX_IOCTL_MAGIC 'R'
42 * Deefines for each of the commands. Note that since we want to reduce
43 * the possibility that a user mode program gets out of sync with a given
44 * driver, we explicitly assign a value to each enumeration. This makes
45 * it more difficult to stick new ioctl's in the middle of the list.
50 ROBOSTIX_CMD_FIRST = 0x80,
52 ROBOSTIX_CMD_POWER_VCC5 = 0x80,
53 ROBOSTIX_CMD_RESET = 0x81,
54 ROBOSTIX_CMD_245_ENABLE = 0x82,
55 ROBOSTIX_CMD_SET_SCK = 0x83,
56 ROBOSTIX_CMD_SET_SS = 0x84,
57 ROBOSTIX_CMD_SET_IR_TXD = 0x85,
58 ROBOSTIX_CMD_GET_IR_RXD = 0x86,
59 ROBOSTIX_CMD_SET_MOSI = 0x87,
60 ROBOSTIX_CMD_GET_MISO = 0x88,
61 ROBOSTIX_CMD_GET_IRQ = 0x89,
62 ROBOSTIX_CMD_DELAY_USEC = 0x8A, // value is hardocded in uisp DAPA.C
64 /* Insert new ioctls here */
71 * The following are arguments to the various ioctl's
74 #define ROBOSTIX_PIN_OFF 0
75 #define ROBOSTIX_PIN_ON 1
76 #define ROBOSTIX_PIN_PULSE 2 // only used or Reset
79 * Definitions for the actual ioctl commands
82 #define ROBOSTIX_IOCTL_POWER_VCC5 _IO( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_POWER_VCC5 ) // arg is int
83 #define ROBOSTIX_IOCTL_RESET _IO( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_RESET ) // arg is int
84 #define ROBOSTIX_IOCTL_245_ENABLE _IO( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_245_ENABLE ) // arg is int
85 #define ROBOSTIX_IOCTL_SET_SCK _IO( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_SET_SCK ) // arg is int
86 #define ROBOSTIX_IOCTL_SET_SS _IO( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_SET_SS ) // arg is int
87 #define ROBOSTIX_IOCTL_SET_IR_TXD _IO( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_SET_IR_TXD ) // arg is int
88 #define ROBOSTIX_IOCTL_GET_IR_RXD _IOR( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_GET_IR_RXD, int ) // arg is int *
89 #define ROBOSTIX_IOCTL_SET_MOSI _IO( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_SET_MOSI ) // arg is int
90 #define ROBOSTIX_IOCTL_GET_MISO _IOR( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_GET_MISO, int ) // arg is int *
91 #define ROBOSTIX_IOCTL_GET_IRQ _IOR( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_GET_IRQ, int ) // arg is int *
92 #define ROBOSTIX_IOCTL_DELAY_USEC _IO( ROBOSTIX_IOCTL_MAGIC, ROBOSTIX_CMD_DELAY_USEC ) // arg is int
96 * Definitions for sysctl. The top level define has to be unique system wide.
97 * The kernel defines values 1 thru about 10 (see include/linunx/sysctl.h)
100 #define CTL_ROBOSTIX 0x526F626F /* 'Robo' in hex form */
103 * The following are for entries in /proc/sys/robostix
108 CTL_ROBOSTIX_DEBUG_TRACE = 101,
109 CTL_ROBOSTIX_DEBUG_IOCTL = 102,
110 CTL_ROBOSTIX_DEBUG_ERROR = 103
113 #endif // LINUX_ROBOSTIX_H