blob: d87c24df2b3822ce36b17b5f3c95add48d9db0c3 [file] [log] [blame]
Mikael Starvikdcf13102005-07-27 11:44:42 -07001/*
2 * ioctl defines for synchronous serial port driver
3 *
4 * Copyright (c) 2001-2003 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#define SSP_INBUFCHUNK _IOR('S', 6, unsigned int)
22
23/* Values for SSP_SPEED */
24#define SSP150 0
25#define SSP300 1
26#define SSP600 2
27#define SSP1200 3
28#define SSP2400 4
29#define SSP4800 5
30#define SSP9600 6
31#define SSP19200 7
32#define SSP28800 8
33#define SSP57600 9
34#define SSP115200 10
35#define SSP230400 11
36#define SSP460800 12
37#define SSP921600 13
38#define SSP3125000 14
39#define CODEC 15
40
41#define FREQ_4MHz 0
42#define FREQ_2MHz 1
43#define FREQ_1MHz 2
44#define FREQ_512kHz 3
45#define FREQ_256kHz 4
46#define FREQ_128kHz 5
47#define FREQ_64kHz 6
48#define FREQ_32kHz 7
49
50/* Used by application to set CODEC divider, word rate and frame rate */
51#define CODEC_VAL(freq, clk_per_sync, sync_per_frame) (CODEC | (freq << 8) | (clk_per_sync << 16) | (sync_per_frame << 28))
52
53/* Used by driver to extract speed */
54#define GET_SPEED(x) (x & 0xff)
55#define GET_FREQ(x) ((x & 0xff00) >> 8)
56#define GET_WORD_RATE(x) (((x & 0x0fff0000) >> 16) - 1)
57#define GET_FRAME_RATE(x) (((x & 0xf0000000) >> 28) - 1)
58
59/* Values for SSP_MODE */
60#define MASTER_OUTPUT 0
61#define SLAVE_OUTPUT 1
62#define MASTER_INPUT 2
63#define SLAVE_INPUT 3
64#define MASTER_BIDIR 4
65#define SLAVE_BIDIR 5
66
67/* Values for SSP_FRAME_SYNC */
68#define NORMAL_SYNC 1
69#define EARLY_SYNC 2
Jesper Nilssonca91d5b2007-11-29 17:26:24 +010070#define SECOND_WORD_SYNC 0x40000
Mikael Starvikdcf13102005-07-27 11:44:42 -070071
72#define BIT_SYNC 4
73#define WORD_SYNC 8
74#define EXTENDED_SYNC 0x10
75
76#define SYNC_OFF 0x20
77#define SYNC_ON 0x40
78#define WORD_SIZE_8 0x80
79#define WORD_SIZE_12 0x100
80#define WORD_SIZE_16 0x200
81#define WORD_SIZE_24 0x400
82#define WORD_SIZE_32 0x800
83#define BIT_ORDER_LSB 0x1000
84#define BIT_ORDER_MSB 0x2000
85#define FLOW_CONTROL_ENABLE 0x4000
86#define FLOW_CONTROL_DISABLE 0x8000
87#define CLOCK_GATED 0x10000
88#define CLOCK_NOT_GATED 0x20000
89
90/* Values for SSP_IPOLARITY and SSP_OPOLARITY */
91#define CLOCK_NORMAL 1
92#define CLOCK_INVERT 2
93#define CLOCK_INEGEDGE CLOCK_NORMAL
94#define CLOCK_IPOSEDGE CLOCK_INVERT
95#define FRAME_NORMAL 4
96#define FRAME_INVERT 8
97#define STATUS_NORMAL 0x10
98#define STATUS_INVERT 0x20
99
100/* Values for SSP_SPI */
101#define SPI_MASTER 0
102#define SPI_SLAVE 1
103
104/* Values for SSP_INBUFCHUNK */
105/* plain integer with the size of DMA chunks */
106
107#endif