1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ***   To edit the content of this header, modify the corresponding
11 ***   source file (e.g. under external/kernel-headers/original/) then
12 ***   run bionic/libc/kernel/tools/update_all.py
13 ***
14 ***   Any manual change here will be lost the next time this script will
15 ***   be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _CS_PROTOCOL_H
20#define _CS_PROTOCOL_H
21#include <linux/types.h>
22#include <linux/ioctl.h>
23#define CS_DEV_FILE_NAME "/dev/cmt_speech"
24#define CS_IF_VERSION 2
25#define CS_CMD_SHIFT 28
26#define CS_DOMAIN_SHIFT 24
27#define CS_CMD_MASK 0xff000000
28#define CS_PARAM_MASK 0xffffff
29#define CS_CMD(id,dom) (((id) << CS_CMD_SHIFT) | ((dom) << CS_DOMAIN_SHIFT))
30#define CS_ERROR CS_CMD(1, 0)
31#define CS_RX_DATA_RECEIVED CS_CMD(2, 0)
32#define CS_TX_DATA_READY CS_CMD(3, 0)
33#define CS_TX_DATA_SENT CS_CMD(4, 0)
34#define CS_ERR_PEER_RESET 0
35#define CS_FEAT_TSTAMP_RX_CTRL (1 << 0)
36#define CS_FEAT_ROLLING_RX_COUNTER (2 << 0)
37#define CS_STATE_CLOSED 0
38#define CS_STATE_OPENED 1
39#define CS_STATE_CONFIGURED 2
40#define CS_MAX_BUFFERS_SHIFT 4
41#define CS_MAX_BUFFERS (1 << CS_MAX_BUFFERS_SHIFT)
42struct cs_buffer_config {
43  __u32 rx_bufs;
44  __u32 tx_bufs;
45  __u32 buf_size;
46  __u32 flags;
47  __u32 reserved[4];
48};
49struct cs_timestamp {
50  __u32 tv_sec;
51  __u32 tv_nsec;
52};
53struct cs_mmap_config_block {
54  __u32 reserved1;
55  __u32 buf_size;
56  __u32 rx_bufs;
57  __u32 tx_bufs;
58  __u32 reserved2;
59  __u32 rx_offsets[CS_MAX_BUFFERS];
60  __u32 tx_offsets[CS_MAX_BUFFERS];
61  __u32 rx_ptr;
62  __u32 rx_ptr_boundary;
63  __u32 reserved3[2];
64  struct cs_timestamp tstamp_rx_ctrl;
65};
66#define CS_IO_MAGIC 'C'
67#define CS_IOW(num,dtype) _IOW(CS_IO_MAGIC, num, dtype)
68#define CS_IOR(num,dtype) _IOR(CS_IO_MAGIC, num, dtype)
69#define CS_IOWR(num,dtype) _IOWR(CS_IO_MAGIC, num, dtype)
70#define CS_IO(num) _IO(CS_IO_MAGIC, num)
71#define CS_GET_STATE CS_IOR(21, unsigned int)
72#define CS_SET_WAKELINE CS_IOW(23, unsigned int)
73#define CS_GET_IF_VERSION CS_IOR(30, unsigned int)
74#define CS_CONFIG_BUFS CS_IOW(31, struct cs_buffer_config)
75#endif
76