MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / ledman.h
blob66ac3396686b86f34dbca36a4242203bd63be089
1 #ifndef __LINUX_LEDMAN_H__
2 #define __LINUX_LEDMAN_H__ 1
3 /****************************************************************************/
4 /*
5 * ledman.h: LED manager header, generic, device indepedant LED stuff
7 * defines for led functionality which may/may not be implemented by the
8 * currently active LED configuration
10 * NOTE: do not change the numbering of the defines below, tables of
11 * LED patterns rely on these values
14 #define LEDMAN_ALL 0 /* special case, all LED's */
16 #define LEDMAN_POWER 1
17 #define LEDMAN_HEARTBEAT 2
18 #define LEDMAN_COM1_RX 3
19 #define LEDMAN_COM1_TX 4
20 #define LEDMAN_COM2_RX 5
21 #define LEDMAN_COM2_TX 6
22 #define LEDMAN_LAN1_RX 7
23 #define LEDMAN_LAN1_TX 8
24 #define LEDMAN_LAN2_RX 9
25 #define LEDMAN_LAN2_TX 10
26 #define LEDMAN_USB1_RX 11
27 #define LEDMAN_USB1_TX 12
28 #define LEDMAN_USB2_RX 13
29 #define LEDMAN_USB2_TX 14
30 #define LEDMAN_NVRAM_1 15
31 #define LEDMAN_NVRAM_2 16
32 #define LEDMAN_VPN 17
33 #define LEDMAN_LAN1_DHCP 18
34 #define LEDMAN_LAN2_DHCP 19
35 #define LEDMAN_COM1_DCD 20
36 #define LEDMAN_COM2_DCD 21
37 #define LEDMAN_ONLINE 22
38 #define LEDMAN_LAN1_LINK 23
39 #define LEDMAN_LAN2_LINK 24
40 #define LEDMAN_VPN_RX 25
41 #define LEDMAN_VPN_TX 26
42 #define LEDMAN_RESET 27
43 #define LEDMAN_STATIC 28
44 #define LEDMAN_LAN3_RX 29
45 #define LEDMAN_LAN3_TX 30
46 #define LEDMAN_LAN3_LINK 31
47 #define LEDMAN_LAN3_DHCP 32
48 #define LEDMAN_MAX 33 /* one more than the highest LED above */
50 #define LEDMAN_MAX_NAME 16
52 /****************************************************************************/
54 * ioctl cmds
57 #define LEDMAN_CMD_SET 0x01 /* turn on briefly to show activity */
58 #define LEDMAN_CMD_ON 0x02 /* turn LED on permanently */
59 #define LEDMAN_CMD_OFF 0x03 /* turn LED off permanently */
60 #define LEDMAN_CMD_FLASH 0x04 /* flash this LED */
61 #define LEDMAN_CMD_RESET 0x05 /* reset LED to default behaviour */
63 #define LEDMAN_CMD_ALT_ON 0x06 /* LED is being used for non-std reasons */
64 #define LEDMAN_CMD_ALT_OFF 0x07 /* LED is being used for std reasons */
66 #define LEDMAN_CMD_MODE 0x80 /* set LED to named mode (led=char *) */
67 #define LEDMAN_CMD_STARTTIMER 0x81 /* enable and init the ledman driver */
68 #define LEDMAN_CMD_KILLTIMER 0x82 /* disable the ledman driver */
70 #define LEDMAN_CMD_SIGNAL 0x100 /* pid of process to signal on reset */
72 #define LEDMAN_CMD_ALTBIT 0x8000 /* operate on alternate LED settings */
74 /****************************************************************************/
76 #define LEDMAN_MAJOR 126
78 /****************************************************************************/
79 #ifdef __KERNEL__
81 #if LINUX_VERSION_CODE < 0x020100
82 extern int ledman_init(void);
83 #endif
85 extern int ledman_setup(char *arg);
86 extern void ledman_killtimer(void);
87 extern void ledman_starttimer(void);
88 extern int ledman_cmd(int cmd, unsigned long led);
89 extern void ledman_signalreset(void);
91 #else
93 #include <fcntl.h>
95 #define ledman_cmd(cmd, led) ({ \
96 int fd; \
97 if ((fd = open("/dev/ledman", O_RDWR)) != -1) { \
98 ioctl(fd, cmd, led); \
99 close(fd); \
103 #endif
104 /****************************************************************************/
105 #endif /* __LINUX_LEDMAN_H__ */