1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Author: Iliyan Malchev <ibm@android.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 */
15#ifndef _UAPI_LINUX_MSM_ADSP_H
16#define _UAPI_LINUX_MSM_ADSP_H
17
18#include <linux/types.h>
19#include <linux/ioctl.h>
20
21#define ADSP_IOCTL_MAGIC 'q'
22
23/* ADSP_IOCTL_WRITE_COMMAND */
24struct adsp_command_t {
25	uint16_t queue;
26	uint32_t len;		/* bytes */
27	uint8_t *data;
28};
29
30/* ADSP_IOCTL_GET_EVENT */
31struct adsp_event_t {
32	uint16_t type;		/* 1 == event (RPC), 0 == message (adsp) */
33	uint32_t timeout_ms;	/* -1 for infinite, 0 for immediate return */
34	uint16_t msg_id;
35	uint16_t flags;		/* 1 == 16--bit event, 0 == 32-bit event */
36	uint32_t len;		/* size in, number of bytes out */
37	uint8_t *data;
38};
39
40#define ADSP_IOCTL_ENABLE \
41	_IOR(ADSP_IOCTL_MAGIC, 1, unsigned)
42
43#define ADSP_IOCTL_DISABLE \
44	_IOR(ADSP_IOCTL_MAGIC, 2, unsigned)
45
46#define ADSP_IOCTL_DISABLE_ACK \
47	_IOR(ADSP_IOCTL_MAGIC, 3, unsigned)
48
49#define ADSP_IOCTL_WRITE_COMMAND \
50	_IOR(ADSP_IOCTL_MAGIC, 4, struct adsp_command_t *)
51
52#define ADSP_IOCTL_GET_EVENT \
53	_IOWR(ADSP_IOCTL_MAGIC, 5, struct adsp_event_data_t *)
54
55#define ADSP_IOCTL_SET_CLKRATE \
56	_IOR(ADSP_IOCTL_MAGIC, 6, unsigned)
57
58#define ADSP_IOCTL_DISABLE_EVENT_RSP \
59	_IOR(ADSP_IOCTL_MAGIC, 10, unsigned)
60
61#define ADSP_IOCTL_REGISTER_PMEM \
62	_IOW(ADSP_IOCTL_MAGIC, 13, unsigned)
63
64#define ADSP_IOCTL_UNREGISTER_PMEM \
65	_IOW(ADSP_IOCTL_MAGIC, 14, unsigned)
66
67/* Cause any further GET_EVENT ioctls to fail (-ENODEV)
68 * until the device is closed and reopened.  Useful for
69 * terminating event dispatch threads
70 */
71#define ADSP_IOCTL_ABORT_EVENT_READ \
72	_IOW(ADSP_IOCTL_MAGIC, 15, unsigned)
73
74#define ADSP_IOCTL_LINK_TASK \
75	_IOW(ADSP_IOCTL_MAGIC, 16, unsigned)
76
77#endif
78