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 _SPCOM_H_
20 #define _SPCOM_H_
21 #include <linux/types.h>
22 #ifndef BIT
23 #define BIT(x) (1 << x)
24 #endif
25 #ifndef PAGE_SIZE
26 #define PAGE_SIZE 4096
27 #endif
28 #define SPCOM_MAX_CHANNELS 0x20
29 #define SPCOM_CHANNEL_NAME_SIZE 32
30 #define SPCOM_GET_NEXT_REQUEST_SIZE (PAGE_SIZE - 1)
31 enum spcom_cmd_id {
32   SPCOM_CMD_LOAD_APP = 0x4C4F4144,
33   SPCOM_CMD_RESET_SP = 0x52455354,
34   SPCOM_CMD_SEND = 0x53454E44,
35   SPCOM_CMD_SEND_MODIFIED = 0x534E444D,
36   SPCOM_CMD_LOCK_ION_BUF = 0x4C4F434B,
37   SPCOM_CMD_UNLOCK_ION_BUF = 0x554C434B,
38   SPCOM_CMD_FSSR = 0x46535352,
39   SPCOM_CMD_CREATE_CHANNEL = 0x43524554,
40 };
41 enum spcom_poll_events {
42   SPCOM_POLL_LINK_STATE = BIT(1),
43   SPCOM_POLL_CH_CONNECT = BIT(2),
44   SPCOM_POLL_READY_FLAG = BIT(14),
45   SPCOM_POLL_WAIT_FLAG = BIT(15),
46 };
47 struct spcom_user_command {
48   enum spcom_cmd_id cmd_id;
49   uint32_t arg;
50 } __attribute__((packed));
51 struct spcom_send_command {
52   enum spcom_cmd_id cmd_id;
53   uint32_t timeout_msec;
54   uint32_t buf_size;
55   char buf[0];
56 } __attribute__((packed));
57 struct spcom_user_create_channel_command {
58   enum spcom_cmd_id cmd_id;
59   char ch_name[SPCOM_CHANNEL_NAME_SIZE];
60 } __attribute__((packed));
61 #define SPCOM_MAX_ION_BUF 4
62 struct spcom_ion_info {
63   int32_t fd;
64   uint32_t buf_offset;
65 };
66 #define SPCOM_ION_FD_UNLOCK_ALL 0xFFFF
67 struct spcom_ion_handle {
68   int32_t fd;
69 };
70 struct spcom_user_send_modified_command {
71   enum spcom_cmd_id cmd_id;
72   struct spcom_ion_info ion_info[SPCOM_MAX_ION_BUF];
73   uint32_t timeout_msec;
74   uint32_t buf_size;
75   char buf[0];
76 } __attribute__((packed));
77 #endif
78 
79