| Mikael Starvik | dcf1310 | 2005-07-27 11:44:42 -0700 | [diff] [blame] | 1 | /* | 
 | 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 | 
 | 70 |  | 
 | 71 | #define BIT_SYNC                   4 | 
 | 72 | #define WORD_SYNC                  8 | 
 | 73 | #define EXTENDED_SYNC           0x10 | 
 | 74 |  | 
 | 75 | #define SYNC_OFF                0x20 | 
 | 76 | #define SYNC_ON                 0x40 | 
 | 77 | #define WORD_SIZE_8             0x80 | 
 | 78 | #define WORD_SIZE_12           0x100 | 
 | 79 | #define WORD_SIZE_16           0x200 | 
 | 80 | #define WORD_SIZE_24           0x400 | 
 | 81 | #define WORD_SIZE_32           0x800 | 
 | 82 | #define BIT_ORDER_LSB         0x1000 | 
 | 83 | #define BIT_ORDER_MSB         0x2000 | 
 | 84 | #define FLOW_CONTROL_ENABLE   0x4000 | 
 | 85 | #define FLOW_CONTROL_DISABLE  0x8000 | 
 | 86 | #define CLOCK_GATED          0x10000 | 
 | 87 | #define CLOCK_NOT_GATED      0x20000 | 
 | 88 |  | 
 | 89 | /* Values for SSP_IPOLARITY and SSP_OPOLARITY */ | 
 | 90 | #define CLOCK_NORMAL         1 | 
 | 91 | #define CLOCK_INVERT         2 | 
 | 92 | #define CLOCK_INEGEDGE       CLOCK_NORMAL | 
 | 93 | #define CLOCK_IPOSEDGE       CLOCK_INVERT | 
 | 94 | #define FRAME_NORMAL         4 | 
 | 95 | #define FRAME_INVERT         8 | 
 | 96 | #define STATUS_NORMAL      0x10 | 
 | 97 | #define STATUS_INVERT      0x20 | 
 | 98 |  | 
 | 99 | /* Values for SSP_SPI */ | 
 | 100 | #define SPI_MASTER           0 | 
 | 101 | #define SPI_SLAVE            1 | 
 | 102 |  | 
 | 103 | /* Values for SSP_INBUFCHUNK */ | 
 | 104 | /* plain integer with the size of DMA chunks */ | 
 | 105 |  | 
 | 106 | #endif |