blob: 72e3520598c640b0dd5b8ae3151e8345287200e7 [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
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 __LINUX_NFC_H
20#define __LINUX_NFC_H
21#include <linux/types.h>
22#include <linux/socket.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070023#define NFC_GENL_NAME "nfc"
24#define NFC_GENL_VERSION 1
25#define NFC_GENL_MCAST_EVENT_NAME "events"
26enum nfc_commands {
Tao Baod7db5942015-01-28 10:07:51 -080027 NFC_CMD_UNSPEC,
28 NFC_CMD_GET_DEVICE,
29 NFC_CMD_DEV_UP,
30 NFC_CMD_DEV_DOWN,
Tao Baod7db5942015-01-28 10:07:51 -080031 NFC_CMD_DEP_LINK_UP,
32 NFC_CMD_DEP_LINK_DOWN,
33 NFC_CMD_START_POLL,
34 NFC_CMD_STOP_POLL,
Tao Baod7db5942015-01-28 10:07:51 -080035 NFC_CMD_GET_TARGET,
36 NFC_EVENT_TARGETS_FOUND,
37 NFC_EVENT_DEVICE_ADDED,
38 NFC_EVENT_DEVICE_REMOVED,
Tao Baod7db5942015-01-28 10:07:51 -080039 NFC_EVENT_TARGET_LOST,
40 NFC_EVENT_TM_ACTIVATED,
41 NFC_EVENT_TM_DEACTIVATED,
42 NFC_CMD_LLC_GET_PARAMS,
Tao Baod7db5942015-01-28 10:07:51 -080043 NFC_CMD_LLC_SET_PARAMS,
44 NFC_CMD_ENABLE_SE,
45 NFC_CMD_DISABLE_SE,
46 NFC_CMD_LLC_SDREQ,
Tao Baod7db5942015-01-28 10:07:51 -080047 NFC_EVENT_LLC_SDRES,
48 NFC_CMD_FW_DOWNLOAD,
49 NFC_EVENT_SE_ADDED,
50 NFC_EVENT_SE_REMOVED,
Tao Baod7db5942015-01-28 10:07:51 -080051 NFC_EVENT_SE_CONNECTIVITY,
52 NFC_EVENT_SE_TRANSACTION,
53 NFC_CMD_GET_SE,
54 NFC_CMD_SE_IO,
Christopher Ferris05d08e92016-02-04 13:16:38 -080055 NFC_CMD_ACTIVATE_TARGET,
56 NFC_CMD_VENDOR,
Christopher Ferris934ec942018-01-31 15:29:16 -080057 NFC_CMD_DEACTIVATE_TARGET,
Tao Baod7db5942015-01-28 10:07:51 -080058 __NFC_CMD_AFTER_LAST
Ben Cheng655a7c02013-10-16 16:09:24 -070059};
60#define NFC_CMD_MAX (__NFC_CMD_AFTER_LAST - 1)
Elliott Hughes8cb52b02013-11-21 13:43:23 -080061enum nfc_attrs {
Tao Baod7db5942015-01-28 10:07:51 -080062 NFC_ATTR_UNSPEC,
63 NFC_ATTR_DEVICE_INDEX,
64 NFC_ATTR_DEVICE_NAME,
65 NFC_ATTR_PROTOCOLS,
Tao Baod7db5942015-01-28 10:07:51 -080066 NFC_ATTR_TARGET_INDEX,
67 NFC_ATTR_TARGET_SENS_RES,
68 NFC_ATTR_TARGET_SEL_RES,
69 NFC_ATTR_TARGET_NFCID1,
Tao Baod7db5942015-01-28 10:07:51 -080070 NFC_ATTR_TARGET_SENSB_RES,
71 NFC_ATTR_TARGET_SENSF_RES,
72 NFC_ATTR_COMM_MODE,
73 NFC_ATTR_RF_MODE,
Tao Baod7db5942015-01-28 10:07:51 -080074 NFC_ATTR_DEVICE_POWERED,
75 NFC_ATTR_IM_PROTOCOLS,
76 NFC_ATTR_TM_PROTOCOLS,
77 NFC_ATTR_LLC_PARAM_LTO,
Tao Baod7db5942015-01-28 10:07:51 -080078 NFC_ATTR_LLC_PARAM_RW,
79 NFC_ATTR_LLC_PARAM_MIUX,
80 NFC_ATTR_SE,
81 NFC_ATTR_LLC_SDP,
Tao Baod7db5942015-01-28 10:07:51 -080082 NFC_ATTR_FIRMWARE_NAME,
83 NFC_ATTR_SE_INDEX,
84 NFC_ATTR_SE_TYPE,
85 NFC_ATTR_SE_AID,
Tao Baod7db5942015-01-28 10:07:51 -080086 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS,
87 NFC_ATTR_SE_APDU,
88 NFC_ATTR_TARGET_ISO15693_DSFID,
89 NFC_ATTR_TARGET_ISO15693_UID,
Christopher Ferris05d08e92016-02-04 13:16:38 -080090 NFC_ATTR_SE_PARAMS,
91 NFC_ATTR_VENDOR_ID,
Christopher Ferris05d08e92016-02-04 13:16:38 -080092 NFC_ATTR_VENDOR_SUBCMD,
93 NFC_ATTR_VENDOR_DATA,
Tao Baod7db5942015-01-28 10:07:51 -080094 __NFC_ATTR_AFTER_LAST
Ben Cheng655a7c02013-10-16 16:09:24 -070095};
Christopher Ferris38062f92014-07-09 15:33:25 -070096#define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1)
Ben Cheng655a7c02013-10-16 16:09:24 -070097enum nfc_sdp_attr {
Tao Baod7db5942015-01-28 10:07:51 -080098 NFC_SDP_ATTR_UNSPEC,
99 NFC_SDP_ATTR_URI,
100 NFC_SDP_ATTR_SAP,
101 __NFC_SDP_ATTR_AFTER_LAST
Ben Cheng655a7c02013-10-16 16:09:24 -0700102};
Ben Cheng655a7c02013-10-16 16:09:24 -0700103#define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1)
Christopher Ferris38062f92014-07-09 15:33:25 -0700104#define NFC_DEVICE_NAME_MAXSIZE 8
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800105#define NFC_NFCID1_MAXSIZE 10
Christopher Ferris38062f92014-07-09 15:33:25 -0700106#define NFC_NFCID2_MAXSIZE 8
107#define NFC_NFCID3_MAXSIZE 10
Ben Cheng655a7c02013-10-16 16:09:24 -0700108#define NFC_SENSB_RES_MAXSIZE 12
109#define NFC_SENSF_RES_MAXSIZE 18
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110#define NFC_ATR_REQ_MAXSIZE 64
111#define NFC_ATR_RES_MAXSIZE 64
Christopher Ferris05d08e92016-02-04 13:16:38 -0800112#define NFC_ATR_REQ_GB_MAXSIZE 48
113#define NFC_ATR_RES_GB_MAXSIZE 47
Ben Cheng655a7c02013-10-16 16:09:24 -0700114#define NFC_GB_MAXSIZE 48
Christopher Ferris38062f92014-07-09 15:33:25 -0700115#define NFC_FIRMWARE_NAME_MAXSIZE 32
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700116#define NFC_ISO15693_UID_MAXSIZE 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700117#define NFC_PROTO_JEWEL 1
118#define NFC_PROTO_MIFARE 2
119#define NFC_PROTO_FELICA 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700120#define NFC_PROTO_ISO14443 4
121#define NFC_PROTO_NFC_DEP 5
122#define NFC_PROTO_ISO14443_B 6
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700123#define NFC_PROTO_ISO15693 7
124#define NFC_PROTO_MAX 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700125#define NFC_COMM_ACTIVE 0
126#define NFC_COMM_PASSIVE 1
127#define NFC_RF_INITIATOR 0
128#define NFC_RF_TARGET 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700129#define NFC_RF_NONE 2
130#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL)
131#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE)
132#define NFC_PROTO_FELICA_MASK (1 << NFC_PROTO_FELICA)
Ben Cheng655a7c02013-10-16 16:09:24 -0700133#define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443)
134#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP)
135#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700136#define NFC_PROTO_ISO15693_MASK (1 << NFC_PROTO_ISO15693)
Ben Cheng655a7c02013-10-16 16:09:24 -0700137#define NFC_SE_UICC 0x1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700138#define NFC_SE_EMBEDDED 0x2
Christopher Ferris38062f92014-07-09 15:33:25 -0700139#define NFC_SE_DISABLED 0x0
140#define NFC_SE_ENABLED 0x1
Ben Cheng655a7c02013-10-16 16:09:24 -0700141struct sockaddr_nfc {
Tao Baod7db5942015-01-28 10:07:51 -0800142 sa_family_t sa_family;
143 __u32 dev_idx;
144 __u32 target_idx;
145 __u32 nfc_protocol;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700146};
Christopher Ferris38062f92014-07-09 15:33:25 -0700147#define NFC_LLCP_MAX_SERVICE_NAME 63
Ben Cheng655a7c02013-10-16 16:09:24 -0700148struct sockaddr_nfc_llcp {
Tao Baod7db5942015-01-28 10:07:51 -0800149 sa_family_t sa_family;
Tao Baod7db5942015-01-28 10:07:51 -0800150 __u32 dev_idx;
151 __u32 target_idx;
152 __u32 nfc_protocol;
153 __u8 dsap;
Tao Baod7db5942015-01-28 10:07:51 -0800154 __u8 ssap;
155 char service_name[NFC_LLCP_MAX_SERVICE_NAME];
156;
157 size_t service_name_len;
Ben Cheng655a7c02013-10-16 16:09:24 -0700158};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700159#define NFC_SOCKPROTO_RAW 0
Christopher Ferris38062f92014-07-09 15:33:25 -0700160#define NFC_SOCKPROTO_LLCP 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700161#define NFC_SOCKPROTO_MAX 2
Tao Baod7db5942015-01-28 10:07:51 -0800162#define NFC_HEADER_SIZE 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700163#define NFC_RAW_HEADER_SIZE 2
164#define NFC_DIRECTION_RX 0x00
165#define NFC_DIRECTION_TX 0x01
Tao Baod7db5942015-01-28 10:07:51 -0800166#define RAW_PAYLOAD_LLCP 0
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700167#define RAW_PAYLOAD_NCI 1
168#define RAW_PAYLOAD_HCI 2
169#define RAW_PAYLOAD_DIGITAL 3
Tao Baod7db5942015-01-28 10:07:51 -0800170#define RAW_PAYLOAD_PROPRIETARY 4
Ben Cheng655a7c02013-10-16 16:09:24 -0700171#define NFC_LLCP_RW 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700172#define NFC_LLCP_MIUX 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700173#define NFC_LLCP_REMOTE_MIU 2
Tao Baod7db5942015-01-28 10:07:51 -0800174#define NFC_LLCP_REMOTE_LTO 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700175#define NFC_LLCP_REMOTE_RW 4
Ben Cheng655a7c02013-10-16 16:09:24 -0700176#endif