Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame^] | 1 | /* |
| 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 | */ |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 7 | #ifndef __LINUX_NFC_H |
| 8 | #define __LINUX_NFC_H |
| 9 | #include <linux/types.h> |
| 10 | #include <linux/socket.h> |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 11 | #define NFC_GENL_NAME "nfc" |
| 12 | #define NFC_GENL_VERSION 1 |
| 13 | #define NFC_GENL_MCAST_EVENT_NAME "events" |
| 14 | enum nfc_commands { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 15 | NFC_CMD_UNSPEC, |
| 16 | NFC_CMD_GET_DEVICE, |
| 17 | NFC_CMD_DEV_UP, |
| 18 | NFC_CMD_DEV_DOWN, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 19 | NFC_CMD_DEP_LINK_UP, |
| 20 | NFC_CMD_DEP_LINK_DOWN, |
| 21 | NFC_CMD_START_POLL, |
| 22 | NFC_CMD_STOP_POLL, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 23 | NFC_CMD_GET_TARGET, |
| 24 | NFC_EVENT_TARGETS_FOUND, |
| 25 | NFC_EVENT_DEVICE_ADDED, |
| 26 | NFC_EVENT_DEVICE_REMOVED, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 27 | NFC_EVENT_TARGET_LOST, |
| 28 | NFC_EVENT_TM_ACTIVATED, |
| 29 | NFC_EVENT_TM_DEACTIVATED, |
| 30 | NFC_CMD_LLC_GET_PARAMS, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 31 | NFC_CMD_LLC_SET_PARAMS, |
| 32 | NFC_CMD_ENABLE_SE, |
| 33 | NFC_CMD_DISABLE_SE, |
| 34 | NFC_CMD_LLC_SDREQ, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 35 | NFC_EVENT_LLC_SDRES, |
| 36 | NFC_CMD_FW_DOWNLOAD, |
| 37 | NFC_EVENT_SE_ADDED, |
| 38 | NFC_EVENT_SE_REMOVED, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 39 | NFC_EVENT_SE_CONNECTIVITY, |
| 40 | NFC_EVENT_SE_TRANSACTION, |
| 41 | NFC_CMD_GET_SE, |
| 42 | NFC_CMD_SE_IO, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 43 | NFC_CMD_ACTIVATE_TARGET, |
| 44 | NFC_CMD_VENDOR, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 45 | NFC_CMD_DEACTIVATE_TARGET, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 46 | __NFC_CMD_AFTER_LAST |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 47 | }; |
| 48 | #define NFC_CMD_MAX (__NFC_CMD_AFTER_LAST - 1) |
Elliott Hughes | 8cb52b0 | 2013-11-21 13:43:23 -0800 | [diff] [blame] | 49 | enum nfc_attrs { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 50 | NFC_ATTR_UNSPEC, |
| 51 | NFC_ATTR_DEVICE_INDEX, |
| 52 | NFC_ATTR_DEVICE_NAME, |
| 53 | NFC_ATTR_PROTOCOLS, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 54 | NFC_ATTR_TARGET_INDEX, |
| 55 | NFC_ATTR_TARGET_SENS_RES, |
| 56 | NFC_ATTR_TARGET_SEL_RES, |
| 57 | NFC_ATTR_TARGET_NFCID1, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 58 | NFC_ATTR_TARGET_SENSB_RES, |
| 59 | NFC_ATTR_TARGET_SENSF_RES, |
| 60 | NFC_ATTR_COMM_MODE, |
| 61 | NFC_ATTR_RF_MODE, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 62 | NFC_ATTR_DEVICE_POWERED, |
| 63 | NFC_ATTR_IM_PROTOCOLS, |
| 64 | NFC_ATTR_TM_PROTOCOLS, |
| 65 | NFC_ATTR_LLC_PARAM_LTO, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 66 | NFC_ATTR_LLC_PARAM_RW, |
| 67 | NFC_ATTR_LLC_PARAM_MIUX, |
| 68 | NFC_ATTR_SE, |
| 69 | NFC_ATTR_LLC_SDP, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 70 | NFC_ATTR_FIRMWARE_NAME, |
| 71 | NFC_ATTR_SE_INDEX, |
| 72 | NFC_ATTR_SE_TYPE, |
| 73 | NFC_ATTR_SE_AID, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 74 | NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, |
| 75 | NFC_ATTR_SE_APDU, |
| 76 | NFC_ATTR_TARGET_ISO15693_DSFID, |
| 77 | NFC_ATTR_TARGET_ISO15693_UID, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 78 | NFC_ATTR_SE_PARAMS, |
| 79 | NFC_ATTR_VENDOR_ID, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 80 | NFC_ATTR_VENDOR_SUBCMD, |
| 81 | NFC_ATTR_VENDOR_DATA, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 82 | __NFC_ATTR_AFTER_LAST |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 83 | }; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 84 | #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 85 | enum nfc_sdp_attr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 86 | NFC_SDP_ATTR_UNSPEC, |
| 87 | NFC_SDP_ATTR_URI, |
| 88 | NFC_SDP_ATTR_SAP, |
| 89 | __NFC_SDP_ATTR_AFTER_LAST |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 90 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 91 | #define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 92 | #define NFC_DEVICE_NAME_MAXSIZE 8 |
Elliott Hughes | 8cb52b0 | 2013-11-21 13:43:23 -0800 | [diff] [blame] | 93 | #define NFC_NFCID1_MAXSIZE 10 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 94 | #define NFC_NFCID2_MAXSIZE 8 |
| 95 | #define NFC_NFCID3_MAXSIZE 10 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 96 | #define NFC_SENSB_RES_MAXSIZE 12 |
| 97 | #define NFC_SENSF_RES_MAXSIZE 18 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 98 | #define NFC_ATR_REQ_MAXSIZE 64 |
| 99 | #define NFC_ATR_RES_MAXSIZE 64 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 100 | #define NFC_ATR_REQ_GB_MAXSIZE 48 |
| 101 | #define NFC_ATR_RES_GB_MAXSIZE 47 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 102 | #define NFC_GB_MAXSIZE 48 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 103 | #define NFC_FIRMWARE_NAME_MAXSIZE 32 |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 104 | #define NFC_ISO15693_UID_MAXSIZE 8 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 105 | #define NFC_PROTO_JEWEL 1 |
| 106 | #define NFC_PROTO_MIFARE 2 |
| 107 | #define NFC_PROTO_FELICA 3 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 108 | #define NFC_PROTO_ISO14443 4 |
| 109 | #define NFC_PROTO_NFC_DEP 5 |
| 110 | #define NFC_PROTO_ISO14443_B 6 |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 111 | #define NFC_PROTO_ISO15693 7 |
| 112 | #define NFC_PROTO_MAX 8 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 113 | #define NFC_COMM_ACTIVE 0 |
| 114 | #define NFC_COMM_PASSIVE 1 |
| 115 | #define NFC_RF_INITIATOR 0 |
| 116 | #define NFC_RF_TARGET 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 117 | #define NFC_RF_NONE 2 |
| 118 | #define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL) |
| 119 | #define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE) |
| 120 | #define NFC_PROTO_FELICA_MASK (1 << NFC_PROTO_FELICA) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 121 | #define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443) |
| 122 | #define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP) |
| 123 | #define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B) |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 124 | #define NFC_PROTO_ISO15693_MASK (1 << NFC_PROTO_ISO15693) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 125 | #define NFC_SE_UICC 0x1 |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 126 | #define NFC_SE_EMBEDDED 0x2 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 127 | #define NFC_SE_DISABLED 0x0 |
| 128 | #define NFC_SE_ENABLED 0x1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 129 | struct sockaddr_nfc { |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 130 | __kernel_sa_family_t sa_family; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 131 | __u32 dev_idx; |
| 132 | __u32 target_idx; |
| 133 | __u32 nfc_protocol; |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 134 | }; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 135 | #define NFC_LLCP_MAX_SERVICE_NAME 63 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 136 | struct sockaddr_nfc_llcp { |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 137 | __kernel_sa_family_t sa_family; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 138 | __u32 dev_idx; |
| 139 | __u32 target_idx; |
| 140 | __u32 nfc_protocol; |
| 141 | __u8 dsap; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 142 | __u8 ssap; |
| 143 | char service_name[NFC_LLCP_MAX_SERVICE_NAME]; |
| 144 | ; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 145 | __kernel_size_t service_name_len; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 146 | }; |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 147 | #define NFC_SOCKPROTO_RAW 0 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 148 | #define NFC_SOCKPROTO_LLCP 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 149 | #define NFC_SOCKPROTO_MAX 2 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 150 | #define NFC_HEADER_SIZE 1 |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 151 | #define NFC_RAW_HEADER_SIZE 2 |
| 152 | #define NFC_DIRECTION_RX 0x00 |
| 153 | #define NFC_DIRECTION_TX 0x01 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 154 | #define RAW_PAYLOAD_LLCP 0 |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 155 | #define RAW_PAYLOAD_NCI 1 |
| 156 | #define RAW_PAYLOAD_HCI 2 |
| 157 | #define RAW_PAYLOAD_DIGITAL 3 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 158 | #define RAW_PAYLOAD_PROPRIETARY 4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 159 | #define NFC_LLCP_RW 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 160 | #define NFC_LLCP_MIUX 1 |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 161 | #define NFC_LLCP_REMOTE_MIU 2 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 162 | #define NFC_LLCP_REMOTE_LTO 3 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 163 | #define NFC_LLCP_REMOTE_RW 4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 164 | #endif |