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 #define SPCOM_CMD_RESTART_SP SPCOM_CMD_RESTART_SP 41 SPCOM_CMD_RESTART_SP = 0x52535452, 42 }; 43 enum spcom_poll_events { 44 SPCOM_POLL_LINK_STATE = BIT(1), 45 SPCOM_POLL_CH_CONNECT = BIT(2), 46 SPCOM_POLL_READY_FLAG = BIT(14), 47 SPCOM_POLL_WAIT_FLAG = BIT(15), 48 }; 49 struct spcom_user_command { 50 enum spcom_cmd_id cmd_id; 51 uint32_t arg; 52 } __attribute__((packed)); 53 struct spcom_send_command { 54 enum spcom_cmd_id cmd_id; 55 uint32_t timeout_msec; 56 uint32_t buf_size; 57 char buf[0]; 58 } __attribute__((packed)); 59 struct spcom_user_create_channel_command { 60 enum spcom_cmd_id cmd_id; 61 char ch_name[SPCOM_CHANNEL_NAME_SIZE]; 62 } __attribute__((packed)); 63 #define SPCOM_USER_RESTART_SP_CMD 64 struct spcom_user_restart_sp_command { 65 enum spcom_cmd_id cmd_id; 66 uint32_t arg; 67 } __attribute__((packed)); 68 #define SPCOM_MAX_ION_BUF 4 69 struct spcom_ion_info { 70 int32_t fd; 71 uint32_t buf_offset; 72 }; 73 #define SPCOM_ION_FD_UNLOCK_ALL 0xFFFF 74 struct spcom_ion_handle { 75 int32_t fd; 76 }; 77 struct spcom_user_send_modified_command { 78 enum spcom_cmd_id cmd_id; 79 struct spcom_ion_info ion_info[SPCOM_MAX_ION_BUF]; 80 uint32_t timeout_msec; 81 uint32_t buf_size; 82 char buf[0]; 83 } __attribute__((packed)); 84 #endif 85