122851890Sopenharmony_ci/****************************************************************************
222851890Sopenharmony_ci ****************************************************************************
322851890Sopenharmony_ci ***
422851890Sopenharmony_ci ***   This header was automatically generated from a Linux kernel header
522851890Sopenharmony_ci ***   of the same name, to make information necessary for userspace to
622851890Sopenharmony_ci ***   call into the kernel available to libc.  It contains only constants,
722851890Sopenharmony_ci ***   structures, and macros generated from the original header, and thus,
822851890Sopenharmony_ci ***   contains no copyrightable information.
922851890Sopenharmony_ci ***
1022851890Sopenharmony_ci ***   To edit the content of this header, modify the corresponding
1122851890Sopenharmony_ci ***   source file (e.g. under external/kernel-headers/original/) then
1222851890Sopenharmony_ci ***   run bionic/libc/kernel/tools/update_all.py
1322851890Sopenharmony_ci ***
1422851890Sopenharmony_ci ***   Any manual change here will be lost the next time this script will
1522851890Sopenharmony_ci ***   be run. You've been warned!
1622851890Sopenharmony_ci ***
1722851890Sopenharmony_ci ****************************************************************************
1822851890Sopenharmony_ci ****************************************************************************/
1922851890Sopenharmony_ci#ifndef _CS_PROTOCOL_H
2022851890Sopenharmony_ci#define _CS_PROTOCOL_H
2122851890Sopenharmony_ci#include <linux/types.h>
2222851890Sopenharmony_ci#include <linux/ioctl.h>
2322851890Sopenharmony_ci#define CS_DEV_FILE_NAME "/dev/cmt_speech"
2422851890Sopenharmony_ci#define CS_IF_VERSION 2
2522851890Sopenharmony_ci#define CS_CMD_SHIFT 28
2622851890Sopenharmony_ci#define CS_DOMAIN_SHIFT 24
2722851890Sopenharmony_ci#define CS_CMD_MASK 0xff000000
2822851890Sopenharmony_ci#define CS_PARAM_MASK 0xffffff
2922851890Sopenharmony_ci#define CS_CMD(id,dom) (((id) << CS_CMD_SHIFT) | ((dom) << CS_DOMAIN_SHIFT))
3022851890Sopenharmony_ci#define CS_ERROR CS_CMD(1, 0)
3122851890Sopenharmony_ci#define CS_RX_DATA_RECEIVED CS_CMD(2, 0)
3222851890Sopenharmony_ci#define CS_TX_DATA_READY CS_CMD(3, 0)
3322851890Sopenharmony_ci#define CS_TX_DATA_SENT CS_CMD(4, 0)
3422851890Sopenharmony_ci#define CS_ERR_PEER_RESET 0
3522851890Sopenharmony_ci#define CS_FEAT_TSTAMP_RX_CTRL (1 << 0)
3622851890Sopenharmony_ci#define CS_FEAT_ROLLING_RX_COUNTER (2 << 0)
3722851890Sopenharmony_ci#define CS_STATE_CLOSED 0
3822851890Sopenharmony_ci#define CS_STATE_OPENED 1
3922851890Sopenharmony_ci#define CS_STATE_CONFIGURED 2
4022851890Sopenharmony_ci#define CS_MAX_BUFFERS_SHIFT 4
4122851890Sopenharmony_ci#define CS_MAX_BUFFERS (1 << CS_MAX_BUFFERS_SHIFT)
4222851890Sopenharmony_cistruct cs_buffer_config {
4322851890Sopenharmony_ci  __u32 rx_bufs;
4422851890Sopenharmony_ci  __u32 tx_bufs;
4522851890Sopenharmony_ci  __u32 buf_size;
4622851890Sopenharmony_ci  __u32 flags;
4722851890Sopenharmony_ci  __u32 reserved[4];
4822851890Sopenharmony_ci};
4922851890Sopenharmony_cistruct cs_timestamp {
5022851890Sopenharmony_ci  __u32 tv_sec;
5122851890Sopenharmony_ci  __u32 tv_nsec;
5222851890Sopenharmony_ci};
5322851890Sopenharmony_cistruct cs_mmap_config_block {
5422851890Sopenharmony_ci  __u32 reserved1;
5522851890Sopenharmony_ci  __u32 buf_size;
5622851890Sopenharmony_ci  __u32 rx_bufs;
5722851890Sopenharmony_ci  __u32 tx_bufs;
5822851890Sopenharmony_ci  __u32 reserved2;
5922851890Sopenharmony_ci  __u32 rx_offsets[CS_MAX_BUFFERS];
6022851890Sopenharmony_ci  __u32 tx_offsets[CS_MAX_BUFFERS];
6122851890Sopenharmony_ci  __u32 rx_ptr;
6222851890Sopenharmony_ci  __u32 rx_ptr_boundary;
6322851890Sopenharmony_ci  __u32 reserved3[2];
6422851890Sopenharmony_ci  struct cs_timestamp tstamp_rx_ctrl;
6522851890Sopenharmony_ci};
6622851890Sopenharmony_ci#define CS_IO_MAGIC 'C'
6722851890Sopenharmony_ci#define CS_IOW(num,dtype) _IOW(CS_IO_MAGIC, num, dtype)
6822851890Sopenharmony_ci#define CS_IOR(num,dtype) _IOR(CS_IO_MAGIC, num, dtype)
6922851890Sopenharmony_ci#define CS_IOWR(num,dtype) _IOWR(CS_IO_MAGIC, num, dtype)
7022851890Sopenharmony_ci#define CS_IO(num) _IO(CS_IO_MAGIC, num)
7122851890Sopenharmony_ci#define CS_GET_STATE CS_IOR(21, unsigned int)
7222851890Sopenharmony_ci#define CS_SET_WAKELINE CS_IOW(23, unsigned int)
7322851890Sopenharmony_ci#define CS_GET_IF_VERSION CS_IOR(30, unsigned int)
7422851890Sopenharmony_ci#define CS_CONFIG_BUFS CS_IOW(31, struct cs_buffer_config)
7522851890Sopenharmony_ci#endif
76