xref: /openbmc/linux/include/net/nfc/nci.h (revision ac206838403411e617dbe0e7df1891ee957f1f9a)
16a2968aaSIlan Elias /*
26a2968aaSIlan Elias  *  The NFC Controller Interface is the communication protocol between an
36a2968aaSIlan Elias  *  NFC Controller (NFCC) and a Device Host (DH).
46a2968aaSIlan Elias  *
56a2968aaSIlan Elias  *  Copyright (C) 2011 Texas Instruments, Inc.
66a2968aaSIlan Elias  *
76a2968aaSIlan Elias  *  Written by Ilan Elias <ilane@ti.com>
86a2968aaSIlan Elias  *
96a2968aaSIlan Elias  *  Acknowledgements:
106a2968aaSIlan Elias  *  This file is based on hci.h, which was written
116a2968aaSIlan Elias  *  by Maxim Krasnyansky.
126a2968aaSIlan Elias  *
136a2968aaSIlan Elias  *  This program is free software; you can redistribute it and/or modify
146a2968aaSIlan Elias  *  it under the terms of the GNU General Public License version 2
156a2968aaSIlan Elias  *  as published by the Free Software Foundation
166a2968aaSIlan Elias  *
176a2968aaSIlan Elias  *  This program is distributed in the hope that it will be useful,
186a2968aaSIlan Elias  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
196a2968aaSIlan Elias  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
206a2968aaSIlan Elias  *  GNU General Public License for more details.
216a2968aaSIlan Elias  *
226a2968aaSIlan Elias  *  You should have received a copy of the GNU General Public License
236a2968aaSIlan Elias  *  along with this program; if not, write to the Free Software
246a2968aaSIlan Elias  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
256a2968aaSIlan Elias  *
266a2968aaSIlan Elias  */
276a2968aaSIlan Elias 
286a2968aaSIlan Elias #ifndef __NCI_H
296a2968aaSIlan Elias #define __NCI_H
306a2968aaSIlan Elias 
316a2968aaSIlan Elias /* NCI constants */
326a2968aaSIlan Elias #define NCI_MAX_NUM_MAPPING_CONFIGS				10
336a2968aaSIlan Elias #define NCI_MAX_NUM_RF_CONFIGS					10
346a2968aaSIlan Elias #define NCI_MAX_NUM_CONN					10
357e035230SIlan Elias #define NCI_MAX_PARAM_LEN					251
366a2968aaSIlan Elias 
376a2968aaSIlan Elias /* NCI Status Codes */
386a2968aaSIlan Elias #define NCI_STATUS_OK						0x00
396a2968aaSIlan Elias #define NCI_STATUS_REJECTED					0x01
40e8c0dacdSIlan Elias #define NCI_STATUS_RF_FRAME_CORRUPTED				0x02
41e8c0dacdSIlan Elias #define NCI_STATUS_FAILED					0x03
42e8c0dacdSIlan Elias #define NCI_STATUS_NOT_INITIALIZED				0x04
43e8c0dacdSIlan Elias #define NCI_STATUS_SYNTAX_ERROR					0x05
44e8c0dacdSIlan Elias #define NCI_STATUS_SEMANTIC_ERROR				0x06
45e8c0dacdSIlan Elias #define NCI_STATUS_UNKNOWN_GID					0x07
46e8c0dacdSIlan Elias #define NCI_STATUS_UNKNOWN_OID					0x08
47e8c0dacdSIlan Elias #define NCI_STATUS_INVALID_PARAM				0x09
48e8c0dacdSIlan Elias #define NCI_STATUS_MESSAGE_SIZE_EXCEEDED			0x0a
496a2968aaSIlan Elias /* Discovery Specific Status Codes */
506a2968aaSIlan Elias #define NCI_STATUS_DISCOVERY_ALREADY_STARTED			0xa0
516a2968aaSIlan Elias #define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED		0xa1
52e8c0dacdSIlan Elias #define NCI_STATUS_DISCOVERY_TEAR_DOWN				0xa2
536a2968aaSIlan Elias /* RF Interface Specific Status Codes */
546a2968aaSIlan Elias #define NCI_STATUS_RF_TRANSMISSION_ERROR			0xb0
556a2968aaSIlan Elias #define NCI_STATUS_RF_PROTOCOL_ERROR				0xb1
566a2968aaSIlan Elias #define NCI_STATUS_RF_TIMEOUT_ERROR				0xb2
576a2968aaSIlan Elias /* NFCEE Interface Specific Status Codes */
58637d85a7SIlan Elias #define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED		0xc0
59637d85a7SIlan Elias #define NCI_STATUS_NFCEE_TRANSMISSION_ERROR			0xc1
60637d85a7SIlan Elias #define NCI_STATUS_NFCEE_PROTOCOL_ERROR				0xc2
61637d85a7SIlan Elias #define NCI_STATUS_NFCEE_TIMEOUT_ERROR				0xc3
626a2968aaSIlan Elias 
636a2968aaSIlan Elias /* NCI RF Technology and Mode */
646a2968aaSIlan Elias #define NCI_NFC_A_PASSIVE_POLL_MODE				0x00
656a2968aaSIlan Elias #define NCI_NFC_B_PASSIVE_POLL_MODE				0x01
666a2968aaSIlan Elias #define NCI_NFC_F_PASSIVE_POLL_MODE				0x02
676a2968aaSIlan Elias #define NCI_NFC_A_ACTIVE_POLL_MODE				0x03
686a2968aaSIlan Elias #define NCI_NFC_F_ACTIVE_POLL_MODE				0x05
69637d85a7SIlan Elias #define NCI_NFC_15693_PASSIVE_POLL_MODE				0x06
706a2968aaSIlan Elias #define NCI_NFC_A_PASSIVE_LISTEN_MODE				0x80
716a2968aaSIlan Elias #define NCI_NFC_B_PASSIVE_LISTEN_MODE				0x81
726a2968aaSIlan Elias #define NCI_NFC_F_PASSIVE_LISTEN_MODE				0x82
736a2968aaSIlan Elias #define NCI_NFC_A_ACTIVE_LISTEN_MODE				0x83
746a2968aaSIlan Elias #define NCI_NFC_F_ACTIVE_LISTEN_MODE				0x85
75637d85a7SIlan Elias #define NCI_NFC_15693_PASSIVE_LISTEN_MODE			0x86
766a2968aaSIlan Elias 
77e8c0dacdSIlan Elias /* NCI RF Technologies */
78e8c0dacdSIlan Elias #define NCI_NFC_RF_TECHNOLOGY_A					0x00
79e8c0dacdSIlan Elias #define NCI_NFC_RF_TECHNOLOGY_B					0x01
80e8c0dacdSIlan Elias #define NCI_NFC_RF_TECHNOLOGY_F					0x02
81e8c0dacdSIlan Elias #define NCI_NFC_RF_TECHNOLOGY_15693				0x03
82e8c0dacdSIlan Elias 
83e8c0dacdSIlan Elias /* NCI Bit Rates */
84e8c0dacdSIlan Elias #define NCI_NFC_BIT_RATE_106					0x00
85e8c0dacdSIlan Elias #define NCI_NFC_BIT_RATE_212					0x01
86e8c0dacdSIlan Elias #define NCI_NFC_BIT_RATE_424					0x02
87e8c0dacdSIlan Elias #define NCI_NFC_BIT_RATE_848					0x03
88637d85a7SIlan Elias #define NCI_NFC_BIT_RATE_1695					0x04
89637d85a7SIlan Elias #define NCI_NFC_BIT_RATE_3390					0x05
90637d85a7SIlan Elias #define NCI_NFC_BIT_RATE_6780					0x06
91e8c0dacdSIlan Elias 
926a2968aaSIlan Elias /* NCI RF Protocols */
936a2968aaSIlan Elias #define NCI_RF_PROTOCOL_UNKNOWN					0x00
946a2968aaSIlan Elias #define NCI_RF_PROTOCOL_T1T					0x01
956a2968aaSIlan Elias #define NCI_RF_PROTOCOL_T2T					0x02
966a2968aaSIlan Elias #define NCI_RF_PROTOCOL_T3T					0x03
976a2968aaSIlan Elias #define NCI_RF_PROTOCOL_ISO_DEP					0x04
986a2968aaSIlan Elias #define NCI_RF_PROTOCOL_NFC_DEP					0x05
996a2968aaSIlan Elias 
1006a2968aaSIlan Elias /* NCI RF Interfaces */
101e8c0dacdSIlan Elias #define NCI_RF_INTERFACE_NFCEE_DIRECT				0x00
1026a2968aaSIlan Elias #define NCI_RF_INTERFACE_FRAME					0x01
1036a2968aaSIlan Elias #define NCI_RF_INTERFACE_ISO_DEP				0x02
1046a2968aaSIlan Elias #define NCI_RF_INTERFACE_NFC_DEP				0x03
1056a2968aaSIlan Elias 
1067e035230SIlan Elias /* NCI Configuration Parameter Tags */
1077e035230SIlan Elias #define NCI_PN_ATR_REQ_GEN_BYTES				0x29
1087e035230SIlan Elias 
109e8c0dacdSIlan Elias /* NCI Reset types */
110e8c0dacdSIlan Elias #define NCI_RESET_TYPE_KEEP_CONFIG				0x00
111e8c0dacdSIlan Elias #define NCI_RESET_TYPE_RESET_CONFIG				0x01
112e8c0dacdSIlan Elias 
113e8c0dacdSIlan Elias /* NCI Static RF connection ID */
114e8c0dacdSIlan Elias #define NCI_STATIC_RF_CONN_ID					0x00
115e8c0dacdSIlan Elias 
116db98c829SIlan Elias /* NCI Data Flow Control */
117db98c829SIlan Elias #define NCI_DATA_FLOW_CONTROL_NOT_USED				0xff
118db98c829SIlan Elias 
1196a2968aaSIlan Elias /* NCI RF_DISCOVER_MAP_CMD modes */
1206a2968aaSIlan Elias #define NCI_DISC_MAP_MODE_POLL					0x01
1216a2968aaSIlan Elias #define NCI_DISC_MAP_MODE_LISTEN				0x02
1226a2968aaSIlan Elias 
123019c4fbaSIlan Elias /* NCI Discover Notification Type */
124019c4fbaSIlan Elias #define NCI_DISCOVER_NTF_TYPE_LAST				0x00
125019c4fbaSIlan Elias #define NCI_DISCOVER_NTF_TYPE_LAST_NFCC				0x01
126019c4fbaSIlan Elias #define NCI_DISCOVER_NTF_TYPE_MORE				0x02
127019c4fbaSIlan Elias 
1286a2968aaSIlan Elias /* NCI Deactivation Type */
1296a2968aaSIlan Elias #define NCI_DEACTIVATE_TYPE_IDLE_MODE				0x00
1306a2968aaSIlan Elias #define NCI_DEACTIVATE_TYPE_SLEEP_MODE				0x01
1316a2968aaSIlan Elias #define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE			0x02
132e8c0dacdSIlan Elias #define NCI_DEACTIVATE_TYPE_DISCOVERY				0x03
1336a2968aaSIlan Elias 
1346a2968aaSIlan Elias /* Message Type (MT) */
1356a2968aaSIlan Elias #define NCI_MT_DATA_PKT						0x00
1366a2968aaSIlan Elias #define NCI_MT_CMD_PKT						0x01
1376a2968aaSIlan Elias #define NCI_MT_RSP_PKT						0x02
1386a2968aaSIlan Elias #define NCI_MT_NTF_PKT						0x03
1396a2968aaSIlan Elias 
1406a2968aaSIlan Elias #define nci_mt(hdr)			(((hdr)[0]>>5)&0x07)
1416a2968aaSIlan Elias #define nci_mt_set(hdr, mt)		((hdr)[0] |= (__u8)(((mt)&0x07)<<5))
1426a2968aaSIlan Elias 
1436a2968aaSIlan Elias /* Packet Boundary Flag (PBF) */
1446a2968aaSIlan Elias #define NCI_PBF_LAST						0x00
1456a2968aaSIlan Elias #define NCI_PBF_CONT						0x01
1466a2968aaSIlan Elias 
1476a2968aaSIlan Elias #define nci_pbf(hdr)			(__u8)(((hdr)[0]>>4)&0x01)
1486a2968aaSIlan Elias #define nci_pbf_set(hdr, pbf)		((hdr)[0] |= (__u8)(((pbf)&0x01)<<4))
1496a2968aaSIlan Elias 
1506a2968aaSIlan Elias /* Control Opcode manipulation */
1516a2968aaSIlan Elias #define nci_opcode_pack(gid, oid)	(__u16)((((__u16)((gid)&0x0f))<<8)|\
1526a2968aaSIlan Elias 					((__u16)((oid)&0x3f)))
1536a2968aaSIlan Elias #define nci_opcode(hdr)			nci_opcode_pack(hdr[0], hdr[1])
1546a2968aaSIlan Elias #define nci_opcode_gid(op)		(__u8)(((op)&0x0f00)>>8)
1556a2968aaSIlan Elias #define nci_opcode_oid(op)		(__u8)((op)&0x003f)
1566a2968aaSIlan Elias 
1576a2968aaSIlan Elias /* Payload Length */
1586a2968aaSIlan Elias #define nci_plen(hdr)			(__u8)((hdr)[2])
1596a2968aaSIlan Elias 
1606a2968aaSIlan Elias /* Connection ID */
1616a2968aaSIlan Elias #define nci_conn_id(hdr)		(__u8)(((hdr)[0])&0x0f)
1626a2968aaSIlan Elias 
1636a2968aaSIlan Elias /* GID values */
1646a2968aaSIlan Elias #define NCI_GID_CORE						0x0
1656a2968aaSIlan Elias #define NCI_GID_RF_MGMT						0x1
1666a2968aaSIlan Elias #define NCI_GID_NFCEE_MGMT					0x2
1676a2968aaSIlan Elias #define NCI_GID_PROPRIETARY					0xf
1686a2968aaSIlan Elias 
1696a2968aaSIlan Elias /* ---- NCI Packet structures ---- */
1706a2968aaSIlan Elias #define NCI_CTRL_HDR_SIZE					3
1716a2968aaSIlan Elias #define NCI_DATA_HDR_SIZE					3
1726a2968aaSIlan Elias 
1736a2968aaSIlan Elias struct nci_ctrl_hdr {
1746a2968aaSIlan Elias 	__u8	gid;		/* MT & PBF & GID */
1756a2968aaSIlan Elias 	__u8	oid;
1766a2968aaSIlan Elias 	__u8	plen;
1776a2968aaSIlan Elias } __packed;
1786a2968aaSIlan Elias 
1796a2968aaSIlan Elias struct nci_data_hdr {
1806a2968aaSIlan Elias 	__u8	conn_id;	/* MT & PBF & ConnID */
1816a2968aaSIlan Elias 	__u8	rfu;
1826a2968aaSIlan Elias 	__u8	plen;
1836a2968aaSIlan Elias } __packed;
1846a2968aaSIlan Elias 
1856a2968aaSIlan Elias /* ------------------------ */
1866a2968aaSIlan Elias /* -----  NCI Commands ---- */
1876a2968aaSIlan Elias /* ------------------------ */
1886a2968aaSIlan Elias #define NCI_OP_CORE_RESET_CMD		nci_opcode_pack(NCI_GID_CORE, 0x00)
189e8c0dacdSIlan Elias struct nci_core_reset_cmd {
190e8c0dacdSIlan Elias 	__u8	reset_type;
191e8c0dacdSIlan Elias } __packed;
1926a2968aaSIlan Elias 
1936a2968aaSIlan Elias #define NCI_OP_CORE_INIT_CMD		nci_opcode_pack(NCI_GID_CORE, 0x01)
1946a2968aaSIlan Elias 
1957e035230SIlan Elias #define NCI_OP_CORE_SET_CONFIG_CMD	nci_opcode_pack(NCI_GID_CORE, 0x02)
1967e035230SIlan Elias struct set_config_param {
1977e035230SIlan Elias 	__u8	id;
1987e035230SIlan Elias 	__u8	len;
1997e035230SIlan Elias 	__u8	val[NCI_MAX_PARAM_LEN];
2007e035230SIlan Elias } __packed;
2017e035230SIlan Elias 
2027e035230SIlan Elias struct nci_core_set_config_cmd {
2037e035230SIlan Elias 	__u8	num_params;
2047e035230SIlan Elias 	struct	set_config_param param; /* support 1 param per cmd is enough */
2057e035230SIlan Elias } __packed;
2067e035230SIlan Elias 
2076a2968aaSIlan Elias #define NCI_OP_RF_DISCOVER_MAP_CMD	nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
2086a2968aaSIlan Elias struct disc_map_config {
2096a2968aaSIlan Elias 	__u8	rf_protocol;
2106a2968aaSIlan Elias 	__u8	mode;
211637d85a7SIlan Elias 	__u8	rf_interface;
2126a2968aaSIlan Elias } __packed;
2136a2968aaSIlan Elias 
2146a2968aaSIlan Elias struct nci_rf_disc_map_cmd {
2156a2968aaSIlan Elias 	__u8				num_mapping_configs;
2166a2968aaSIlan Elias 	struct disc_map_config		mapping_configs
2176a2968aaSIlan Elias 					[NCI_MAX_NUM_MAPPING_CONFIGS];
2186a2968aaSIlan Elias } __packed;
2196a2968aaSIlan Elias 
2206a2968aaSIlan Elias #define NCI_OP_RF_DISCOVER_CMD		nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
2216a2968aaSIlan Elias struct disc_config {
222637d85a7SIlan Elias 	__u8	rf_tech_and_mode;
2236a2968aaSIlan Elias 	__u8	frequency;
2246a2968aaSIlan Elias } __packed;
2256a2968aaSIlan Elias 
2266a2968aaSIlan Elias struct nci_rf_disc_cmd {
2276a2968aaSIlan Elias 	__u8				num_disc_configs;
2286a2968aaSIlan Elias 	struct disc_config		disc_configs[NCI_MAX_NUM_RF_CONFIGS];
2296a2968aaSIlan Elias } __packed;
2306a2968aaSIlan Elias 
231019c4fbaSIlan Elias #define NCI_OP_RF_DISCOVER_SELECT_CMD	nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
232019c4fbaSIlan Elias struct nci_rf_discover_select_cmd {
233019c4fbaSIlan Elias 	__u8	rf_discovery_id;
234019c4fbaSIlan Elias 	__u8	rf_protocol;
235019c4fbaSIlan Elias 	__u8	rf_interface;
236019c4fbaSIlan Elias } __packed;
237019c4fbaSIlan Elias 
2386a2968aaSIlan Elias #define NCI_OP_RF_DEACTIVATE_CMD	nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
2396a2968aaSIlan Elias struct nci_rf_deactivate_cmd {
2406a2968aaSIlan Elias 	__u8	type;
2416a2968aaSIlan Elias } __packed;
2426a2968aaSIlan Elias 
2436a2968aaSIlan Elias /* ----------------------- */
2446a2968aaSIlan Elias /* ---- NCI Responses ---- */
2456a2968aaSIlan Elias /* ----------------------- */
2466a2968aaSIlan Elias #define NCI_OP_CORE_RESET_RSP		nci_opcode_pack(NCI_GID_CORE, 0x00)
2476a2968aaSIlan Elias struct nci_core_reset_rsp {
2486a2968aaSIlan Elias 	__u8	status;
2496a2968aaSIlan Elias 	__u8	nci_ver;
250e8c0dacdSIlan Elias 	__u8	config_status;
2516a2968aaSIlan Elias } __packed;
2526a2968aaSIlan Elias 
2536a2968aaSIlan Elias #define NCI_OP_CORE_INIT_RSP		nci_opcode_pack(NCI_GID_CORE, 0x01)
2546a2968aaSIlan Elias struct nci_core_init_rsp_1 {
2556a2968aaSIlan Elias 	__u8	status;
2566a2968aaSIlan Elias 	__le32	nfcc_features;
2576a2968aaSIlan Elias 	__u8	num_supported_rf_interfaces;
2586a2968aaSIlan Elias 	__u8	supported_rf_interfaces[0];	/* variable size array */
2596a2968aaSIlan Elias 	/* continuted in nci_core_init_rsp_2 */
2606a2968aaSIlan Elias } __packed;
2616a2968aaSIlan Elias 
2626a2968aaSIlan Elias struct nci_core_init_rsp_2 {
2636a2968aaSIlan Elias 	__u8	max_logical_connections;
2646a2968aaSIlan Elias 	__le16	max_routing_table_size;
265e8c0dacdSIlan Elias 	__u8	max_ctrl_pkt_payload_len;
266e8c0dacdSIlan Elias 	__le16	max_size_for_large_params;
267e8c0dacdSIlan Elias 	__u8	manufact_id;
268e8c0dacdSIlan Elias 	__le32	manufact_specific_info;
2696a2968aaSIlan Elias } __packed;
2706a2968aaSIlan Elias 
2717e035230SIlan Elias #define NCI_OP_CORE_SET_CONFIG_RSP	nci_opcode_pack(NCI_GID_CORE, 0x02)
2727e035230SIlan Elias struct nci_core_set_config_rsp {
2737e035230SIlan Elias 	__u8	status;
2747e035230SIlan Elias 	__u8	num_params;
2757e035230SIlan Elias 	__u8	params_id[0];	/* variable size array */
2767e035230SIlan Elias } __packed;
2777e035230SIlan Elias 
2786a2968aaSIlan Elias #define NCI_OP_RF_DISCOVER_MAP_RSP	nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
2796a2968aaSIlan Elias 
2806a2968aaSIlan Elias #define NCI_OP_RF_DISCOVER_RSP		nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
2816a2968aaSIlan Elias 
282019c4fbaSIlan Elias #define NCI_OP_RF_DISCOVER_SELECT_RSP	nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
283019c4fbaSIlan Elias 
2846a2968aaSIlan Elias #define NCI_OP_RF_DEACTIVATE_RSP	nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
2856a2968aaSIlan Elias 
2866a2968aaSIlan Elias /* --------------------------- */
2876a2968aaSIlan Elias /* ---- NCI Notifications ---- */
2886a2968aaSIlan Elias /* --------------------------- */
289637d85a7SIlan Elias #define NCI_OP_CORE_CONN_CREDITS_NTF	nci_opcode_pack(NCI_GID_CORE, 0x06)
2906a2968aaSIlan Elias struct conn_credit_entry {
2916a2968aaSIlan Elias 	__u8	conn_id;
2926a2968aaSIlan Elias 	__u8	credits;
2936a2968aaSIlan Elias } __packed;
2946a2968aaSIlan Elias 
2956a2968aaSIlan Elias struct nci_core_conn_credit_ntf {
2966a2968aaSIlan Elias 	__u8				num_entries;
2976a2968aaSIlan Elias 	struct conn_credit_entry	conn_entries[NCI_MAX_NUM_CONN];
2986a2968aaSIlan Elias } __packed;
2996a2968aaSIlan Elias 
300019c4fbaSIlan Elias #define NCI_OP_CORE_GENERIC_ERROR_NTF	nci_opcode_pack(NCI_GID_CORE, 0x07)
301019c4fbaSIlan Elias 
302004161cbSIlan Elias #define NCI_OP_CORE_INTF_ERROR_NTF	nci_opcode_pack(NCI_GID_CORE, 0x08)
303004161cbSIlan Elias struct nci_core_intf_error_ntf {
304004161cbSIlan Elias 	__u8	status;
305004161cbSIlan Elias 	__u8	conn_id;
306004161cbSIlan Elias } __packed;
307004161cbSIlan Elias 
308019c4fbaSIlan Elias #define NCI_OP_RF_DISCOVER_NTF		nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
3096a2968aaSIlan Elias struct rf_tech_specific_params_nfca_poll {
3106a2968aaSIlan Elias 	__u16	sens_res;
3116a2968aaSIlan Elias 	__u8	nfcid1_len;	/* 0, 4, 7, or 10 Bytes */
3126a2968aaSIlan Elias 	__u8	nfcid1[10];
3136a2968aaSIlan Elias 	__u8	sel_res_len;	/* 0 or 1 Bytes */
3146a2968aaSIlan Elias 	__u8	sel_res;
3156a2968aaSIlan Elias } __packed;
3166a2968aaSIlan Elias 
317d5a2ca60SIlan Elias struct rf_tech_specific_params_nfcb_poll {
318d5a2ca60SIlan Elias 	__u8	sensb_res_len;
319d5a2ca60SIlan Elias 	__u8	sensb_res[12];	/* 11 or 12 Bytes */
320d5a2ca60SIlan Elias } __packed;
321d5a2ca60SIlan Elias 
322d5a2ca60SIlan Elias struct rf_tech_specific_params_nfcf_poll {
323d5a2ca60SIlan Elias 	__u8	bit_rate;
324d5a2ca60SIlan Elias 	__u8	sensf_res_len;
325d5a2ca60SIlan Elias 	__u8	sensf_res[18];	/* 16 or 18 Bytes */
326d5a2ca60SIlan Elias } __packed;
327d5a2ca60SIlan Elias 
328019c4fbaSIlan Elias struct nci_rf_discover_ntf {
329019c4fbaSIlan Elias 	__u8	rf_discovery_id;
330019c4fbaSIlan Elias 	__u8	rf_protocol;
331019c4fbaSIlan Elias 	__u8	rf_tech_and_mode;
332019c4fbaSIlan Elias 	__u8	rf_tech_specific_params_len;
333019c4fbaSIlan Elias 
334019c4fbaSIlan Elias 	union {
335019c4fbaSIlan Elias 		struct rf_tech_specific_params_nfca_poll nfca_poll;
336019c4fbaSIlan Elias 		struct rf_tech_specific_params_nfcb_poll nfcb_poll;
337019c4fbaSIlan Elias 		struct rf_tech_specific_params_nfcf_poll nfcf_poll;
338019c4fbaSIlan Elias 	} rf_tech_specific_params;
339019c4fbaSIlan Elias 
340019c4fbaSIlan Elias 	__u8	ntf_type;
341019c4fbaSIlan Elias } __packed;
342019c4fbaSIlan Elias 
343019c4fbaSIlan Elias #define NCI_OP_RF_INTF_ACTIVATED_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
3446a2968aaSIlan Elias struct activation_params_nfca_poll_iso_dep {
3456a2968aaSIlan Elias 	__u8	rats_res_len;
3466a2968aaSIlan Elias 	__u8	rats_res[20];
3476a2968aaSIlan Elias };
3486a2968aaSIlan Elias 
349d5a2ca60SIlan Elias struct activation_params_nfcb_poll_iso_dep {
350d5a2ca60SIlan Elias 	__u8	attrib_res_len;
351d5a2ca60SIlan Elias 	__u8	attrib_res[50];
352d5a2ca60SIlan Elias };
353d5a2ca60SIlan Elias 
354*ac206838SIlan Elias struct activation_params_poll_nfc_dep {
355*ac206838SIlan Elias 	__u8	atr_res_len;
356*ac206838SIlan Elias 	__u8	atr_res[63];
357*ac206838SIlan Elias };
358*ac206838SIlan Elias 
359e8c0dacdSIlan Elias struct nci_rf_intf_activated_ntf {
360e8c0dacdSIlan Elias 	__u8	rf_discovery_id;
361637d85a7SIlan Elias 	__u8	rf_interface;
3626a2968aaSIlan Elias 	__u8	rf_protocol;
363e8c0dacdSIlan Elias 	__u8	activation_rf_tech_and_mode;
364637d85a7SIlan Elias 	__u8	max_data_pkt_payload_size;
365637d85a7SIlan Elias 	__u8	initial_num_credits;
3666a2968aaSIlan Elias 	__u8	rf_tech_specific_params_len;
3676a2968aaSIlan Elias 
3686a2968aaSIlan Elias 	union {
3696a2968aaSIlan Elias 		struct rf_tech_specific_params_nfca_poll nfca_poll;
370d5a2ca60SIlan Elias 		struct rf_tech_specific_params_nfcb_poll nfcb_poll;
371d5a2ca60SIlan Elias 		struct rf_tech_specific_params_nfcf_poll nfcf_poll;
3726a2968aaSIlan Elias 	} rf_tech_specific_params;
3736a2968aaSIlan Elias 
374e8c0dacdSIlan Elias 	__u8	data_exch_rf_tech_and_mode;
375e8c0dacdSIlan Elias 	__u8	data_exch_tx_bit_rate;
376e8c0dacdSIlan Elias 	__u8	data_exch_rx_bit_rate;
3776a2968aaSIlan Elias 	__u8	activation_params_len;
3786a2968aaSIlan Elias 
3796a2968aaSIlan Elias 	union {
3806a2968aaSIlan Elias 		struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
381d5a2ca60SIlan Elias 		struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep;
382*ac206838SIlan Elias 		struct activation_params_poll_nfc_dep poll_nfc_dep;
3836a2968aaSIlan Elias 	} activation_params;
3846a2968aaSIlan Elias 
3856a2968aaSIlan Elias } __packed;
3866a2968aaSIlan Elias 
3876a2968aaSIlan Elias #define NCI_OP_RF_DEACTIVATE_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
388e8c0dacdSIlan Elias struct nci_rf_deactivate_ntf {
389e8c0dacdSIlan Elias 	__u8	type;
390e8c0dacdSIlan Elias 	__u8	reason;
391e8c0dacdSIlan Elias } __packed;
3926a2968aaSIlan Elias 
3936a2968aaSIlan Elias #endif /* __NCI_H */
394