File: /usr/src/linux/include/asm-cris/sync_serial.h
1 /*
2 * ioctl defines for synchrnous serial port driver
3 *
4 * Copyright (c) 2001 Axis Communications AB
5 *
6 * Author: Mikael Starvik
7 *
8 */
9
10 #ifndef SYNC_SERIAL_H
11 #define SYNC_SERIAL_H
12
13 #include <linux/ioctl.h>
14
15 #define SSP_SPEED _IOR('S', 0, unsigned int)
16 #define SSP_MODE _IOR('S', 1, unsigned int)
17 #define SSP_FRAME_SYNC _IOR('S', 2, unsigned int)
18 #define SSP_IPOLARITY _IOR('S', 3, unsigned int)
19 #define SSP_OPOLARITY _IOR('S', 4, unsigned int)
20 #define SSP_SPI _IOR('S', 5, unsigned int)
21
22 /* Values for SSP_SPEED */
23 #define SSP150 0
24 #define SSP300 1
25 #define SSP600 2
26 #define SSP1200 3
27 #define SSP2400 4
28 #define SSP4800 5
29 #define SSP9600 6
30 #define SSP19200 7
31 #define SSP28800 8
32 #define SSP57600 9
33 #define SSP115200 10
34 #define SSP230400 11
35 #define SSP460800 12
36 #define SSP921600 13
37 #define SSP3125000 14
38 #define CODEC 15
39
40 #define FREQ_4MHz 0
41 #define FREQ_2MHz 1
42 #define FREQ_1MHz 2
43 #define FREQ_512kHz 3
44 #define FREQ_256kHz 4
45 #define FREQ_128kHz 5
46 #define FREQ_64kHz 6
47 #define FREQ_32kHz 7
48
49 /* Used by application to set CODEC divider, word rate and frame rate */
50 #define CODEC_VAL(freq, word, frame) (CODEC | (freq << 8) | (word << 16) | (frame << 28))
51
52 /* Used by driver to extract speed */
53 #define GET_SPEED(x) (x & 0xff)
54 #define GET_FREQ(x) ((x & 0xff00) >> 8)
55 #define GET_WORD_RATE(x) (((x & 0x0fff0000) >> 16) - 1)
56 #define GET_FRAME_RATE(x) (((x & 0xf0000000) >> 28) - 1)
57
58 /* Values for SSP_MODE */
59 #define MASTER_OUTPUT 0
60 #define SLAVE_OUTPUT 1
61 #define MASTER_INPUT 2
62 #define SLAVE_INPUT 3
63 #define MASTER_BIDIR 4
64 #define SLAVE_BIDIR 5
65
66 /* Values for SSP_FRAME_SYNC */
67 #define NORMAL_SYNC 1
68 #define EARLY_SYNC 2
69 #define BIT_SYNC 4
70 #define WORD_SYNC 8
71 #define EXTENDED_SYNC 0x10
72 #define SYNC_OFF 0x20
73 #define SYNC_ON 0x40
74 #define WORD_SIZE_8 0x80
75 #define WORD_SIZE_12 0x100
76 #define WORD_SIZE_16 0x200
77 #define WORD_SIZE_24 0x300
78 #define WORD_SIZE_32 0x800
79 #define BIT_ORDER_LSB 0x1000
80 #define BIT_ORDER_MSB 0x2000
81 #define FLOW_CONTROL_ENABLE 0x4000
82 #define FLOW_CONTROL_DISABLE 0x8000
83 #define CLOCK_GATED 0x10000
84 #define CLOCK_NOT_GATED 0x20000
85
86 /* Values for SSP_IPOLARITY and SSP_OPOLARITY */
87 #define CLOCK_NORMAL 1
88 #define CLOCK_INVERT 2
89 #define FRAME_NORMAL 4
90 #define FRAME_INVERT 8
91 #define STATUS_NORMAL 0x10
92 #define STATUS_INVERT 0x20
93
94 /* Values for SSP_SPI */
95 #define SPI_MASTER 0
96 #define SPI_SLAVE 1
97 #endif
98