vmod/vmodttl: fixed bug related to luns not ordered and/or not starting from zero.
[ht-drivers.git] / vmod / driver / vmodttl.h
bloba222a0402b048aca0bf312c703235f1f88dc7274
1 #ifndef __VMODTTL_H__
2 #define __VMODTTL_H__
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 /*
9 * DEFINES
11 #define CHAN_A 0
12 #define CHAN_B 1
13 #define CHAN_C 2
15 #define A_CHAN_IN 0x00
16 #define A_CHAN_OUT 0x01
17 #define B_CHAN_IN 0x00
18 #define B_CHAN_OUT 0x02
19 #define C_CHAN_IN 0x00
20 #define C_CHAN_OUT 0x04
21 #define VMODTTL_O 0x08
23 #define A_CHAN_OPEN_COLLECTOR 0x01
24 #define B_CHAN_OPEN_COLLECTOR 0x02
25 #define C_CHAN_OPEN_COLLECTOR 0x04
27 #define NR_BITS 8
29 #define DEFAULT_DELAY 1 /* Used to wait for a while to allow the Z8536 to perform the read/write operations */
31 struct vmodttlarg {
32 int dev;
33 int val;
36 struct vmodttl_pattern {
37 unsigned char port; /* Port A (0) or B (1) */
38 unsigned char pos; /* Position of the bit [0 - 7] */
39 unsigned char ptr; /* Pattern Transition register */
40 unsigned char pmr; /* Pattern mask register */
41 unsigned char ppr; /* Pattern Polarity Register */
44 struct vmodttlconfig {
45 int io_flag;
46 int us_pulse;
47 int open_collector;
48 int invert;
49 int pattern_mode_a; /* 1: AND 0: OR */
50 int pattern_mode_b; /* 1: AND 0: OR */
51 struct vmodttl_pattern bit_pattern_a[NR_BITS];
52 struct vmodttl_pattern bit_pattern_b[NR_BITS];
56 * IOCTL commands
58 #define VMODTTL_READ_CHAN _IOR('v', 0, struct vmodttlarg)
59 #define VMODTTL_WRITE_CHAN _IOW('v', 1, struct vmodttlarg)
60 #define VMODTTL_CONFIG _IOW('v', 2, struct vmodttlconfig)
61 #define VMODTTL_PATTERN _IOW('v', 3, struct vmodttl_pattern)
62 #define VMODTTL_SIMPIO _IOW('v', 4, int)
63 #define VMODTTL_READ_CONFIG _IOR('v', 5, struct vmodttlconfig)
67 #define VMODTTL_MAX_BOARDS 64 /* max. # of boards supported */
69 #define VMODTTL_PORTC 0
70 #define VMODTTL_PORTB 2
71 #define VMODTTL_PORTA 4
72 #define VMODTTL_CONTROL 6
74 struct vmodttl {
75 int lun; /** logical unit number */
76 char *cname; /** carrier name */
77 int carrier; /** supporting carrier */
78 int slot; /** slot we're plugged in */
79 unsigned long address; /** address space */
80 int is_big_endian; /** endianness */
83 #ifdef __cplusplus
85 #endif
87 #endif /* __VMODTTL_H__ */