blob: f81534c443274f9fc1e2bb7d11af26e5ed6abf26 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferris05d08e92016-02-04 13:16:38 -08007#ifndef _CS_PROTOCOL_H
8#define _CS_PROTOCOL_H
9#include <linux/types.h>
10#include <linux/ioctl.h>
Christopher Ferris05d08e92016-02-04 13:16:38 -080011#define CS_DEV_FILE_NAME "/dev/cmt_speech"
12#define CS_IF_VERSION 2
13#define CS_CMD_SHIFT 28
14#define CS_DOMAIN_SHIFT 24
Christopher Ferris05d08e92016-02-04 13:16:38 -080015#define CS_CMD_MASK 0xff000000
16#define CS_PARAM_MASK 0xffffff
17#define CS_CMD(id,dom) (((id) << CS_CMD_SHIFT) | ((dom) << CS_DOMAIN_SHIFT))
18#define CS_ERROR CS_CMD(1, 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -080019#define CS_RX_DATA_RECEIVED CS_CMD(2, 0)
20#define CS_TX_DATA_READY CS_CMD(3, 0)
21#define CS_TX_DATA_SENT CS_CMD(4, 0)
22#define CS_ERR_PEER_RESET 0
Christopher Ferris05d08e92016-02-04 13:16:38 -080023#define CS_FEAT_TSTAMP_RX_CTRL (1 << 0)
24#define CS_FEAT_ROLLING_RX_COUNTER (2 << 0)
25#define CS_STATE_CLOSED 0
26#define CS_STATE_OPENED 1
Christopher Ferris05d08e92016-02-04 13:16:38 -080027#define CS_STATE_CONFIGURED 2
28#define CS_MAX_BUFFERS_SHIFT 4
29#define CS_MAX_BUFFERS (1 << CS_MAX_BUFFERS_SHIFT)
30struct cs_buffer_config {
Christopher Ferris05d08e92016-02-04 13:16:38 -080031 __u32 rx_bufs;
32 __u32 tx_bufs;
33 __u32 buf_size;
34 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -080035 __u32 reserved[4];
36};
37struct cs_timestamp {
38 __u32 tv_sec;
Christopher Ferris05d08e92016-02-04 13:16:38 -080039 __u32 tv_nsec;
40};
41struct cs_mmap_config_block {
42 __u32 reserved1;
Christopher Ferris05d08e92016-02-04 13:16:38 -080043 __u32 buf_size;
44 __u32 rx_bufs;
45 __u32 tx_bufs;
46 __u32 reserved2;
Christopher Ferris05d08e92016-02-04 13:16:38 -080047 __u32 rx_offsets[CS_MAX_BUFFERS];
48 __u32 tx_offsets[CS_MAX_BUFFERS];
49 __u32 rx_ptr;
50 __u32 rx_ptr_boundary;
Christopher Ferris05d08e92016-02-04 13:16:38 -080051 __u32 reserved3[2];
52 struct cs_timestamp tstamp_rx_ctrl;
53};
54#define CS_IO_MAGIC 'C'
Christopher Ferris05d08e92016-02-04 13:16:38 -080055#define CS_IOW(num,dtype) _IOW(CS_IO_MAGIC, num, dtype)
56#define CS_IOR(num,dtype) _IOR(CS_IO_MAGIC, num, dtype)
57#define CS_IOWR(num,dtype) _IOWR(CS_IO_MAGIC, num, dtype)
58#define CS_IO(num) _IO(CS_IO_MAGIC, num)
Christopher Ferris05d08e92016-02-04 13:16:38 -080059#define CS_GET_STATE CS_IOR(21, unsigned int)
60#define CS_SET_WAKELINE CS_IOW(23, unsigned int)
61#define CS_GET_IF_VERSION CS_IOR(30, unsigned int)
62#define CS_CONFIG_BUFS CS_IOW(31, struct cs_buffer_config)
Christopher Ferris05d08e92016-02-04 13:16:38 -080063#endif