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 * 5cfdbeeafSVincent Cuissard * Copyright (C) 2014 Marvell International Ltd. 66a2968aaSIlan Elias * Copyright (C) 2011 Texas Instruments, Inc. 76a2968aaSIlan Elias * 86a2968aaSIlan Elias * Written by Ilan Elias <ilane@ti.com> 96a2968aaSIlan Elias * 106a2968aaSIlan Elias * Acknowledgements: 116a2968aaSIlan Elias * This file is based on hci.h, which was written 126a2968aaSIlan Elias * by Maxim Krasnyansky. 136a2968aaSIlan Elias * 146a2968aaSIlan Elias * This program is free software; you can redistribute it and/or modify 156a2968aaSIlan Elias * it under the terms of the GNU General Public License version 2 166a2968aaSIlan Elias * as published by the Free Software Foundation 176a2968aaSIlan Elias * 186a2968aaSIlan Elias * This program is distributed in the hope that it will be useful, 196a2968aaSIlan Elias * but WITHOUT ANY WARRANTY; without even the implied warranty of 206a2968aaSIlan Elias * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 216a2968aaSIlan Elias * GNU General Public License for more details. 226a2968aaSIlan Elias * 236a2968aaSIlan Elias * You should have received a copy of the GNU General Public License 24a6227e26SJeff Kirsher * along with this program; if not, see <http://www.gnu.org/licenses/>. 256a2968aaSIlan Elias * 266a2968aaSIlan Elias */ 276a2968aaSIlan Elias 286a2968aaSIlan Elias #ifndef __NCI_H 296a2968aaSIlan Elias #define __NCI_H 306a2968aaSIlan Elias 31a99903ecSJulien Lefrique #include <net/nfc/nfc.h> 32a99903ecSJulien Lefrique 336a2968aaSIlan Elias /* NCI constants */ 346a2968aaSIlan Elias #define NCI_MAX_NUM_MAPPING_CONFIGS 10 356a2968aaSIlan Elias #define NCI_MAX_NUM_RF_CONFIGS 10 366a2968aaSIlan Elias #define NCI_MAX_NUM_CONN 10 377e035230SIlan Elias #define NCI_MAX_PARAM_LEN 251 386a2968aaSIlan Elias 396a2968aaSIlan Elias /* NCI Status Codes */ 406a2968aaSIlan Elias #define NCI_STATUS_OK 0x00 416a2968aaSIlan Elias #define NCI_STATUS_REJECTED 0x01 42e8c0dacdSIlan Elias #define NCI_STATUS_RF_FRAME_CORRUPTED 0x02 43e8c0dacdSIlan Elias #define NCI_STATUS_FAILED 0x03 44e8c0dacdSIlan Elias #define NCI_STATUS_NOT_INITIALIZED 0x04 45e8c0dacdSIlan Elias #define NCI_STATUS_SYNTAX_ERROR 0x05 46e8c0dacdSIlan Elias #define NCI_STATUS_SEMANTIC_ERROR 0x06 47e8c0dacdSIlan Elias #define NCI_STATUS_UNKNOWN_GID 0x07 48e8c0dacdSIlan Elias #define NCI_STATUS_UNKNOWN_OID 0x08 49e8c0dacdSIlan Elias #define NCI_STATUS_INVALID_PARAM 0x09 50e8c0dacdSIlan Elias #define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0a 516a2968aaSIlan Elias /* Discovery Specific Status Codes */ 526a2968aaSIlan Elias #define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0 536a2968aaSIlan Elias #define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1 54e8c0dacdSIlan Elias #define NCI_STATUS_DISCOVERY_TEAR_DOWN 0xa2 556a2968aaSIlan Elias /* RF Interface Specific Status Codes */ 566a2968aaSIlan Elias #define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0 576a2968aaSIlan Elias #define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1 586a2968aaSIlan Elias #define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2 596a2968aaSIlan Elias /* NFCEE Interface Specific Status Codes */ 60637d85a7SIlan Elias #define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc0 61637d85a7SIlan Elias #define NCI_STATUS_NFCEE_TRANSMISSION_ERROR 0xc1 62637d85a7SIlan Elias #define NCI_STATUS_NFCEE_PROTOCOL_ERROR 0xc2 63637d85a7SIlan Elias #define NCI_STATUS_NFCEE_TIMEOUT_ERROR 0xc3 646a2968aaSIlan Elias 65*8277f693SChristophe Ricard /* NFCEE Interface/Protocols */ 66*8277f693SChristophe Ricard #define NCI_NFCEE_INTERFACE_APDU 0x00 67*8277f693SChristophe Ricard #define NCI_NFCEE_INTERFACE_HCI_ACCESS 0x01 68*8277f693SChristophe Ricard #define NCI_NFCEE_INTERFACE_TYPE3_CMD_SET 0x02 69*8277f693SChristophe Ricard #define NCI_NFCEE_INTERFACE_TRANSPARENT 0x03 70*8277f693SChristophe Ricard 71*8277f693SChristophe Ricard /* Destination type */ 72*8277f693SChristophe Ricard #define NCI_DESTINATION_NFCC_LOOPBACK 0x01 73*8277f693SChristophe Ricard #define NCI_DESTINATION_REMOTE_NFC_ENDPOINT 0x02 74*8277f693SChristophe Ricard #define NCI_DESTINATION_NFCEE 0x03 75*8277f693SChristophe Ricard 76*8277f693SChristophe Ricard /* Destination-specific parameters type */ 77*8277f693SChristophe Ricard #define NCI_DESTINATION_SPECIFIC_PARAM_RF_TYPE 0x00 78*8277f693SChristophe Ricard #define NCI_DESTINATION_SPECIFIC_PARAM_NFCEE_TYPE 0x01 79*8277f693SChristophe Ricard 80*8277f693SChristophe Ricard /* NFCEE Discovery Action */ 81*8277f693SChristophe Ricard #define NCI_NFCEE_DISCOVERY_ACTION_DISABLE 0x00 82*8277f693SChristophe Ricard #define NCI_NFCEE_DISCOVERY_ACTION_ENABLE 0x01 83*8277f693SChristophe Ricard 846a2968aaSIlan Elias /* NCI RF Technology and Mode */ 856a2968aaSIlan Elias #define NCI_NFC_A_PASSIVE_POLL_MODE 0x00 866a2968aaSIlan Elias #define NCI_NFC_B_PASSIVE_POLL_MODE 0x01 876a2968aaSIlan Elias #define NCI_NFC_F_PASSIVE_POLL_MODE 0x02 886a2968aaSIlan Elias #define NCI_NFC_A_ACTIVE_POLL_MODE 0x03 896a2968aaSIlan Elias #define NCI_NFC_F_ACTIVE_POLL_MODE 0x05 90cfdbeeafSVincent Cuissard #define NCI_NFC_V_PASSIVE_POLL_MODE 0x06 916a2968aaSIlan Elias #define NCI_NFC_A_PASSIVE_LISTEN_MODE 0x80 926a2968aaSIlan Elias #define NCI_NFC_B_PASSIVE_LISTEN_MODE 0x81 936a2968aaSIlan Elias #define NCI_NFC_F_PASSIVE_LISTEN_MODE 0x82 946a2968aaSIlan Elias #define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 956a2968aaSIlan Elias #define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 966a2968aaSIlan Elias 97a99903ecSJulien Lefrique #define NCI_RF_TECH_MODE_LISTEN_MASK 0x80 98a99903ecSJulien Lefrique 99e8c0dacdSIlan Elias /* NCI RF Technologies */ 100e8c0dacdSIlan Elias #define NCI_NFC_RF_TECHNOLOGY_A 0x00 101e8c0dacdSIlan Elias #define NCI_NFC_RF_TECHNOLOGY_B 0x01 102e8c0dacdSIlan Elias #define NCI_NFC_RF_TECHNOLOGY_F 0x02 103cfdbeeafSVincent Cuissard #define NCI_NFC_RF_TECHNOLOGY_V 0x03 104e8c0dacdSIlan Elias 105e8c0dacdSIlan Elias /* NCI Bit Rates */ 106e8c0dacdSIlan Elias #define NCI_NFC_BIT_RATE_106 0x00 107e8c0dacdSIlan Elias #define NCI_NFC_BIT_RATE_212 0x01 108e8c0dacdSIlan Elias #define NCI_NFC_BIT_RATE_424 0x02 109e8c0dacdSIlan Elias #define NCI_NFC_BIT_RATE_848 0x03 110637d85a7SIlan Elias #define NCI_NFC_BIT_RATE_1695 0x04 111637d85a7SIlan Elias #define NCI_NFC_BIT_RATE_3390 0x05 112637d85a7SIlan Elias #define NCI_NFC_BIT_RATE_6780 0x06 113cfdbeeafSVincent Cuissard #define NCI_NFC_BIT_RATE_26 0x20 114e8c0dacdSIlan Elias 1156a2968aaSIlan Elias /* NCI RF Protocols */ 1166a2968aaSIlan Elias #define NCI_RF_PROTOCOL_UNKNOWN 0x00 1176a2968aaSIlan Elias #define NCI_RF_PROTOCOL_T1T 0x01 1186a2968aaSIlan Elias #define NCI_RF_PROTOCOL_T2T 0x02 1196a2968aaSIlan Elias #define NCI_RF_PROTOCOL_T3T 0x03 1206a2968aaSIlan Elias #define NCI_RF_PROTOCOL_ISO_DEP 0x04 1216a2968aaSIlan Elias #define NCI_RF_PROTOCOL_NFC_DEP 0x05 122cfdbeeafSVincent Cuissard #define NCI_RF_PROTOCOL_T5T 0x06 1236a2968aaSIlan Elias 1246a2968aaSIlan Elias /* NCI RF Interfaces */ 125e8c0dacdSIlan Elias #define NCI_RF_INTERFACE_NFCEE_DIRECT 0x00 1266a2968aaSIlan Elias #define NCI_RF_INTERFACE_FRAME 0x01 1276a2968aaSIlan Elias #define NCI_RF_INTERFACE_ISO_DEP 0x02 1286a2968aaSIlan Elias #define NCI_RF_INTERFACE_NFC_DEP 0x03 1296a2968aaSIlan Elias 1307e035230SIlan Elias /* NCI Configuration Parameter Tags */ 1317e035230SIlan Elias #define NCI_PN_ATR_REQ_GEN_BYTES 0x29 132529ee066SJulien Lefrique #define NCI_LN_ATR_RES_GEN_BYTES 0x61 13390d78c13SJulien Lefrique #define NCI_LA_SEL_INFO 0x32 13490d78c13SJulien Lefrique #define NCI_LF_PROTOCOL_TYPE 0x50 13590d78c13SJulien Lefrique #define NCI_LF_CON_BITR_F 0x54 13690d78c13SJulien Lefrique 13790d78c13SJulien Lefrique /* NCI Configuration Parameters masks */ 13890d78c13SJulien Lefrique #define NCI_LA_SEL_INFO_ISO_DEP_MASK 0x20 13990d78c13SJulien Lefrique #define NCI_LA_SEL_INFO_NFC_DEP_MASK 0x40 14090d78c13SJulien Lefrique #define NCI_LF_PROTOCOL_TYPE_NFC_DEP_MASK 0x02 14190d78c13SJulien Lefrique #define NCI_LF_CON_BITR_F_212 0x02 14290d78c13SJulien Lefrique #define NCI_LF_CON_BITR_F_424 0x04 1437e035230SIlan Elias 144e8c0dacdSIlan Elias /* NCI Reset types */ 145e8c0dacdSIlan Elias #define NCI_RESET_TYPE_KEEP_CONFIG 0x00 146e8c0dacdSIlan Elias #define NCI_RESET_TYPE_RESET_CONFIG 0x01 147e8c0dacdSIlan Elias 148e8c0dacdSIlan Elias /* NCI Static RF connection ID */ 149e8c0dacdSIlan Elias #define NCI_STATIC_RF_CONN_ID 0x00 150e8c0dacdSIlan Elias 151db98c829SIlan Elias /* NCI Data Flow Control */ 152db98c829SIlan Elias #define NCI_DATA_FLOW_CONTROL_NOT_USED 0xff 153db98c829SIlan Elias 1546a2968aaSIlan Elias /* NCI RF_DISCOVER_MAP_CMD modes */ 1556a2968aaSIlan Elias #define NCI_DISC_MAP_MODE_POLL 0x01 1566a2968aaSIlan Elias #define NCI_DISC_MAP_MODE_LISTEN 0x02 1576a2968aaSIlan Elias 158019c4fbaSIlan Elias /* NCI Discover Notification Type */ 159019c4fbaSIlan Elias #define NCI_DISCOVER_NTF_TYPE_LAST 0x00 160019c4fbaSIlan Elias #define NCI_DISCOVER_NTF_TYPE_LAST_NFCC 0x01 161019c4fbaSIlan Elias #define NCI_DISCOVER_NTF_TYPE_MORE 0x02 162019c4fbaSIlan Elias 1636a2968aaSIlan Elias /* NCI Deactivation Type */ 1646a2968aaSIlan Elias #define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 1656a2968aaSIlan Elias #define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 1666a2968aaSIlan Elias #define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02 167e8c0dacdSIlan Elias #define NCI_DEACTIVATE_TYPE_DISCOVERY 0x03 1686a2968aaSIlan Elias 1696a2968aaSIlan Elias /* Message Type (MT) */ 1706a2968aaSIlan Elias #define NCI_MT_DATA_PKT 0x00 1716a2968aaSIlan Elias #define NCI_MT_CMD_PKT 0x01 1726a2968aaSIlan Elias #define NCI_MT_RSP_PKT 0x02 1736a2968aaSIlan Elias #define NCI_MT_NTF_PKT 0x03 1746a2968aaSIlan Elias 1756a2968aaSIlan Elias #define nci_mt(hdr) (((hdr)[0]>>5)&0x07) 1766a2968aaSIlan Elias #define nci_mt_set(hdr, mt) ((hdr)[0] |= (__u8)(((mt)&0x07)<<5)) 1776a2968aaSIlan Elias 1786a2968aaSIlan Elias /* Packet Boundary Flag (PBF) */ 1796a2968aaSIlan Elias #define NCI_PBF_LAST 0x00 1806a2968aaSIlan Elias #define NCI_PBF_CONT 0x01 1816a2968aaSIlan Elias 1826a2968aaSIlan Elias #define nci_pbf(hdr) (__u8)(((hdr)[0]>>4)&0x01) 1836a2968aaSIlan Elias #define nci_pbf_set(hdr, pbf) ((hdr)[0] |= (__u8)(((pbf)&0x01)<<4)) 1846a2968aaSIlan Elias 1856a2968aaSIlan Elias /* Control Opcode manipulation */ 1866a2968aaSIlan Elias #define nci_opcode_pack(gid, oid) (__u16)((((__u16)((gid)&0x0f))<<8)|\ 1876a2968aaSIlan Elias ((__u16)((oid)&0x3f))) 1886a2968aaSIlan Elias #define nci_opcode(hdr) nci_opcode_pack(hdr[0], hdr[1]) 1896a2968aaSIlan Elias #define nci_opcode_gid(op) (__u8)(((op)&0x0f00)>>8) 1906a2968aaSIlan Elias #define nci_opcode_oid(op) (__u8)((op)&0x003f) 1916a2968aaSIlan Elias 1926a2968aaSIlan Elias /* Payload Length */ 1936a2968aaSIlan Elias #define nci_plen(hdr) (__u8)((hdr)[2]) 1946a2968aaSIlan Elias 1956a2968aaSIlan Elias /* Connection ID */ 1966a2968aaSIlan Elias #define nci_conn_id(hdr) (__u8)(((hdr)[0])&0x0f) 1976a2968aaSIlan Elias 1986a2968aaSIlan Elias /* GID values */ 1996a2968aaSIlan Elias #define NCI_GID_CORE 0x0 2006a2968aaSIlan Elias #define NCI_GID_RF_MGMT 0x1 2016a2968aaSIlan Elias #define NCI_GID_NFCEE_MGMT 0x2 2026a2968aaSIlan Elias #define NCI_GID_PROPRIETARY 0xf 2036a2968aaSIlan Elias 204fa544fffSEric Lapuyade /* ----- NCI over SPI head/crc(tail) room needed for outgoing frames ----- */ 205fa544fffSEric Lapuyade #define NCI_SPI_HDR_LEN 4 206fa544fffSEric Lapuyade #define NCI_SPI_CRC_LEN 2 207fa544fffSEric Lapuyade 2086a2968aaSIlan Elias /* ---- NCI Packet structures ---- */ 2096a2968aaSIlan Elias #define NCI_CTRL_HDR_SIZE 3 2106a2968aaSIlan Elias #define NCI_DATA_HDR_SIZE 3 2116a2968aaSIlan Elias 2126a2968aaSIlan Elias struct nci_ctrl_hdr { 2136a2968aaSIlan Elias __u8 gid; /* MT & PBF & GID */ 2146a2968aaSIlan Elias __u8 oid; 2156a2968aaSIlan Elias __u8 plen; 2166a2968aaSIlan Elias } __packed; 2176a2968aaSIlan Elias 2186a2968aaSIlan Elias struct nci_data_hdr { 2196a2968aaSIlan Elias __u8 conn_id; /* MT & PBF & ConnID */ 2206a2968aaSIlan Elias __u8 rfu; 2216a2968aaSIlan Elias __u8 plen; 2226a2968aaSIlan Elias } __packed; 2236a2968aaSIlan Elias 2246a2968aaSIlan Elias /* ------------------------ */ 2256a2968aaSIlan Elias /* ----- NCI Commands ---- */ 2266a2968aaSIlan Elias /* ------------------------ */ 2276a2968aaSIlan Elias #define NCI_OP_CORE_RESET_CMD nci_opcode_pack(NCI_GID_CORE, 0x00) 228e8c0dacdSIlan Elias struct nci_core_reset_cmd { 229e8c0dacdSIlan Elias __u8 reset_type; 230e8c0dacdSIlan Elias } __packed; 2316a2968aaSIlan Elias 2326a2968aaSIlan Elias #define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01) 2336a2968aaSIlan Elias 2347e035230SIlan Elias #define NCI_OP_CORE_SET_CONFIG_CMD nci_opcode_pack(NCI_GID_CORE, 0x02) 2357e035230SIlan Elias struct set_config_param { 2367e035230SIlan Elias __u8 id; 2377e035230SIlan Elias __u8 len; 2387e035230SIlan Elias __u8 val[NCI_MAX_PARAM_LEN]; 2397e035230SIlan Elias } __packed; 2407e035230SIlan Elias 2417e035230SIlan Elias struct nci_core_set_config_cmd { 2427e035230SIlan Elias __u8 num_params; 2437e035230SIlan Elias struct set_config_param param; /* support 1 param per cmd is enough */ 2447e035230SIlan Elias } __packed; 2457e035230SIlan Elias 2466a2968aaSIlan Elias #define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 2476a2968aaSIlan Elias struct disc_map_config { 2486a2968aaSIlan Elias __u8 rf_protocol; 2496a2968aaSIlan Elias __u8 mode; 250637d85a7SIlan Elias __u8 rf_interface; 2516a2968aaSIlan Elias } __packed; 2526a2968aaSIlan Elias 2536a2968aaSIlan Elias struct nci_rf_disc_map_cmd { 2546a2968aaSIlan Elias __u8 num_mapping_configs; 2556a2968aaSIlan Elias struct disc_map_config mapping_configs 2566a2968aaSIlan Elias [NCI_MAX_NUM_MAPPING_CONFIGS]; 2576a2968aaSIlan Elias } __packed; 2586a2968aaSIlan Elias 2596a2968aaSIlan Elias #define NCI_OP_RF_DISCOVER_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 2606a2968aaSIlan Elias struct disc_config { 261637d85a7SIlan Elias __u8 rf_tech_and_mode; 2626a2968aaSIlan Elias __u8 frequency; 2636a2968aaSIlan Elias } __packed; 2646a2968aaSIlan Elias 2656a2968aaSIlan Elias struct nci_rf_disc_cmd { 2666a2968aaSIlan Elias __u8 num_disc_configs; 2676a2968aaSIlan Elias struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS]; 2686a2968aaSIlan Elias } __packed; 2696a2968aaSIlan Elias 270019c4fbaSIlan Elias #define NCI_OP_RF_DISCOVER_SELECT_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x04) 271019c4fbaSIlan Elias struct nci_rf_discover_select_cmd { 272019c4fbaSIlan Elias __u8 rf_discovery_id; 273019c4fbaSIlan Elias __u8 rf_protocol; 274019c4fbaSIlan Elias __u8 rf_interface; 275019c4fbaSIlan Elias } __packed; 276019c4fbaSIlan Elias 2776a2968aaSIlan Elias #define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 2786a2968aaSIlan Elias struct nci_rf_deactivate_cmd { 2796a2968aaSIlan Elias __u8 type; 2806a2968aaSIlan Elias } __packed; 2816a2968aaSIlan Elias 282*8277f693SChristophe Ricard #define NCI_OP_NFCEE_DISCOVER_CMD nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x00) 283*8277f693SChristophe Ricard struct nci_nfcee_discover_cmd { 284*8277f693SChristophe Ricard __u8 discovery_action; 285*8277f693SChristophe Ricard } __packed; 286*8277f693SChristophe Ricard 2876a2968aaSIlan Elias /* ----------------------- */ 2886a2968aaSIlan Elias /* ---- NCI Responses ---- */ 2896a2968aaSIlan Elias /* ----------------------- */ 2906a2968aaSIlan Elias #define NCI_OP_CORE_RESET_RSP nci_opcode_pack(NCI_GID_CORE, 0x00) 2916a2968aaSIlan Elias struct nci_core_reset_rsp { 2926a2968aaSIlan Elias __u8 status; 2936a2968aaSIlan Elias __u8 nci_ver; 294e8c0dacdSIlan Elias __u8 config_status; 2956a2968aaSIlan Elias } __packed; 2966a2968aaSIlan Elias 2976a2968aaSIlan Elias #define NCI_OP_CORE_INIT_RSP nci_opcode_pack(NCI_GID_CORE, 0x01) 2986a2968aaSIlan Elias struct nci_core_init_rsp_1 { 2996a2968aaSIlan Elias __u8 status; 3006a2968aaSIlan Elias __le32 nfcc_features; 3016a2968aaSIlan Elias __u8 num_supported_rf_interfaces; 3026a2968aaSIlan Elias __u8 supported_rf_interfaces[0]; /* variable size array */ 3036a2968aaSIlan Elias /* continuted in nci_core_init_rsp_2 */ 3046a2968aaSIlan Elias } __packed; 3056a2968aaSIlan Elias 3066a2968aaSIlan Elias struct nci_core_init_rsp_2 { 3076a2968aaSIlan Elias __u8 max_logical_connections; 3086a2968aaSIlan Elias __le16 max_routing_table_size; 309e8c0dacdSIlan Elias __u8 max_ctrl_pkt_payload_len; 310e8c0dacdSIlan Elias __le16 max_size_for_large_params; 311e8c0dacdSIlan Elias __u8 manufact_id; 312e8c0dacdSIlan Elias __le32 manufact_specific_info; 3136a2968aaSIlan Elias } __packed; 3146a2968aaSIlan Elias 3157e035230SIlan Elias #define NCI_OP_CORE_SET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x02) 3167e035230SIlan Elias struct nci_core_set_config_rsp { 3177e035230SIlan Elias __u8 status; 3187e035230SIlan Elias __u8 num_params; 3197e035230SIlan Elias __u8 params_id[0]; /* variable size array */ 3207e035230SIlan Elias } __packed; 3217e035230SIlan Elias 3226a2968aaSIlan Elias #define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 3236a2968aaSIlan Elias 3246a2968aaSIlan Elias #define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 3256a2968aaSIlan Elias 326019c4fbaSIlan Elias #define NCI_OP_RF_DISCOVER_SELECT_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x04) 327019c4fbaSIlan Elias 3286a2968aaSIlan Elias #define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 3296a2968aaSIlan Elias 330*8277f693SChristophe Ricard #define NCI_OP_NFCEE_DISCOVER_RSP nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x00) 331*8277f693SChristophe Ricard struct nci_nfcee_discover_rsp { 332*8277f693SChristophe Ricard __u8 status; 333*8277f693SChristophe Ricard __u8 num_nfcee; 334*8277f693SChristophe Ricard } __packed; 335*8277f693SChristophe Ricard 3366a2968aaSIlan Elias /* --------------------------- */ 3376a2968aaSIlan Elias /* ---- NCI Notifications ---- */ 3386a2968aaSIlan Elias /* --------------------------- */ 339637d85a7SIlan Elias #define NCI_OP_CORE_CONN_CREDITS_NTF nci_opcode_pack(NCI_GID_CORE, 0x06) 3406a2968aaSIlan Elias struct conn_credit_entry { 3416a2968aaSIlan Elias __u8 conn_id; 3426a2968aaSIlan Elias __u8 credits; 3436a2968aaSIlan Elias } __packed; 3446a2968aaSIlan Elias 3456a2968aaSIlan Elias struct nci_core_conn_credit_ntf { 3466a2968aaSIlan Elias __u8 num_entries; 3476a2968aaSIlan Elias struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 3486a2968aaSIlan Elias } __packed; 3496a2968aaSIlan Elias 350019c4fbaSIlan Elias #define NCI_OP_CORE_GENERIC_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x07) 351019c4fbaSIlan Elias 352004161cbSIlan Elias #define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 353004161cbSIlan Elias struct nci_core_intf_error_ntf { 354004161cbSIlan Elias __u8 status; 355004161cbSIlan Elias __u8 conn_id; 356004161cbSIlan Elias } __packed; 357004161cbSIlan Elias 358019c4fbaSIlan Elias #define NCI_OP_RF_DISCOVER_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 3596a2968aaSIlan Elias struct rf_tech_specific_params_nfca_poll { 3606a2968aaSIlan Elias __u16 sens_res; 3616a2968aaSIlan Elias __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ 362a99903ecSJulien Lefrique __u8 nfcid1[NFC_NFCID1_MAXSIZE]; 3636a2968aaSIlan Elias __u8 sel_res_len; /* 0 or 1 Bytes */ 3646a2968aaSIlan Elias __u8 sel_res; 3656a2968aaSIlan Elias } __packed; 3666a2968aaSIlan Elias 367d5a2ca60SIlan Elias struct rf_tech_specific_params_nfcb_poll { 368d5a2ca60SIlan Elias __u8 sensb_res_len; 369a99903ecSJulien Lefrique __u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; /* 11 or 12 Bytes */ 370d5a2ca60SIlan Elias } __packed; 371d5a2ca60SIlan Elias 372d5a2ca60SIlan Elias struct rf_tech_specific_params_nfcf_poll { 373d5a2ca60SIlan Elias __u8 bit_rate; 374d5a2ca60SIlan Elias __u8 sensf_res_len; 375a99903ecSJulien Lefrique __u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; /* 16 or 18 Bytes */ 376d5a2ca60SIlan Elias } __packed; 377d5a2ca60SIlan Elias 378cfdbeeafSVincent Cuissard struct rf_tech_specific_params_nfcv_poll { 379cfdbeeafSVincent Cuissard __u8 res_flags; 380cfdbeeafSVincent Cuissard __u8 dsfid; 381a99903ecSJulien Lefrique __u8 uid[NFC_ISO15693_UID_MAXSIZE]; /* 8 Bytes */ 382a99903ecSJulien Lefrique } __packed; 383a99903ecSJulien Lefrique 384a99903ecSJulien Lefrique struct rf_tech_specific_params_nfcf_listen { 385a99903ecSJulien Lefrique __u8 local_nfcid2_len; 386a99903ecSJulien Lefrique __u8 local_nfcid2[NFC_NFCID2_MAXSIZE]; /* 0 or 8 Bytes */ 387cfdbeeafSVincent Cuissard } __packed; 388cfdbeeafSVincent Cuissard 389019c4fbaSIlan Elias struct nci_rf_discover_ntf { 390019c4fbaSIlan Elias __u8 rf_discovery_id; 391019c4fbaSIlan Elias __u8 rf_protocol; 392019c4fbaSIlan Elias __u8 rf_tech_and_mode; 393019c4fbaSIlan Elias __u8 rf_tech_specific_params_len; 394019c4fbaSIlan Elias 395019c4fbaSIlan Elias union { 396019c4fbaSIlan Elias struct rf_tech_specific_params_nfca_poll nfca_poll; 397019c4fbaSIlan Elias struct rf_tech_specific_params_nfcb_poll nfcb_poll; 398019c4fbaSIlan Elias struct rf_tech_specific_params_nfcf_poll nfcf_poll; 399cfdbeeafSVincent Cuissard struct rf_tech_specific_params_nfcv_poll nfcv_poll; 400019c4fbaSIlan Elias } rf_tech_specific_params; 401019c4fbaSIlan Elias 402019c4fbaSIlan Elias __u8 ntf_type; 403019c4fbaSIlan Elias } __packed; 404019c4fbaSIlan Elias 405019c4fbaSIlan Elias #define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 4066a2968aaSIlan Elias struct activation_params_nfca_poll_iso_dep { 4076a2968aaSIlan Elias __u8 rats_res_len; 4086a2968aaSIlan Elias __u8 rats_res[20]; 4096a2968aaSIlan Elias }; 4106a2968aaSIlan Elias 411d5a2ca60SIlan Elias struct activation_params_nfcb_poll_iso_dep { 412d5a2ca60SIlan Elias __u8 attrib_res_len; 413d5a2ca60SIlan Elias __u8 attrib_res[50]; 414d5a2ca60SIlan Elias }; 415d5a2ca60SIlan Elias 416ac206838SIlan Elias struct activation_params_poll_nfc_dep { 417ac206838SIlan Elias __u8 atr_res_len; 418a99903ecSJulien Lefrique __u8 atr_res[NFC_ATR_RES_MAXSIZE - 2]; /* ATR_RES from byte 3 */ 419a99903ecSJulien Lefrique }; 420a99903ecSJulien Lefrique 421a99903ecSJulien Lefrique struct activation_params_listen_nfc_dep { 422a99903ecSJulien Lefrique __u8 atr_req_len; 423a99903ecSJulien Lefrique __u8 atr_req[NFC_ATR_REQ_MAXSIZE - 2]; /* ATR_REQ from byte 3 */ 424ac206838SIlan Elias }; 425ac206838SIlan Elias 426e8c0dacdSIlan Elias struct nci_rf_intf_activated_ntf { 427e8c0dacdSIlan Elias __u8 rf_discovery_id; 428637d85a7SIlan Elias __u8 rf_interface; 4296a2968aaSIlan Elias __u8 rf_protocol; 430e8c0dacdSIlan Elias __u8 activation_rf_tech_and_mode; 431637d85a7SIlan Elias __u8 max_data_pkt_payload_size; 432637d85a7SIlan Elias __u8 initial_num_credits; 4336a2968aaSIlan Elias __u8 rf_tech_specific_params_len; 4346a2968aaSIlan Elias 4356a2968aaSIlan Elias union { 4366a2968aaSIlan Elias struct rf_tech_specific_params_nfca_poll nfca_poll; 437d5a2ca60SIlan Elias struct rf_tech_specific_params_nfcb_poll nfcb_poll; 438d5a2ca60SIlan Elias struct rf_tech_specific_params_nfcf_poll nfcf_poll; 439cfdbeeafSVincent Cuissard struct rf_tech_specific_params_nfcv_poll nfcv_poll; 440a99903ecSJulien Lefrique struct rf_tech_specific_params_nfcf_listen nfcf_listen; 4416a2968aaSIlan Elias } rf_tech_specific_params; 4426a2968aaSIlan Elias 443e8c0dacdSIlan Elias __u8 data_exch_rf_tech_and_mode; 444e8c0dacdSIlan Elias __u8 data_exch_tx_bit_rate; 445e8c0dacdSIlan Elias __u8 data_exch_rx_bit_rate; 4466a2968aaSIlan Elias __u8 activation_params_len; 4476a2968aaSIlan Elias 4486a2968aaSIlan Elias union { 4496a2968aaSIlan Elias struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; 450d5a2ca60SIlan Elias struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; 451ac206838SIlan Elias struct activation_params_poll_nfc_dep poll_nfc_dep; 452a99903ecSJulien Lefrique struct activation_params_listen_nfc_dep listen_nfc_dep; 4536a2968aaSIlan Elias } activation_params; 4546a2968aaSIlan Elias 4556a2968aaSIlan Elias } __packed; 4566a2968aaSIlan Elias 4576a2968aaSIlan Elias #define NCI_OP_RF_DEACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 458e8c0dacdSIlan Elias struct nci_rf_deactivate_ntf { 459e8c0dacdSIlan Elias __u8 type; 460e8c0dacdSIlan Elias __u8 reason; 461e8c0dacdSIlan Elias } __packed; 4626a2968aaSIlan Elias 463*8277f693SChristophe Ricard #define NCI_OP_NFCEE_DISCOVER_NTF nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x00) 464*8277f693SChristophe Ricard struct nci_nfcee_supported_protocol { 465*8277f693SChristophe Ricard __u8 num_protocol; 466*8277f693SChristophe Ricard __u8 supported_protocol[0]; 467*8277f693SChristophe Ricard } __packed; 468*8277f693SChristophe Ricard 469*8277f693SChristophe Ricard struct nci_nfcee_information_tlv { 470*8277f693SChristophe Ricard __u8 num_tlv; 471*8277f693SChristophe Ricard __u8 information_tlv[0]; 472*8277f693SChristophe Ricard } __packed; 473*8277f693SChristophe Ricard 474*8277f693SChristophe Ricard struct nci_nfcee_discover_ntf { 475*8277f693SChristophe Ricard __u8 nfcee_id; 476*8277f693SChristophe Ricard __u8 nfcee_status; 477*8277f693SChristophe Ricard struct nci_nfcee_supported_protocol supported_protocols; 478*8277f693SChristophe Ricard struct nci_nfcee_information_tlv information_tlv; 479*8277f693SChristophe Ricard } __packed; 480*8277f693SChristophe Ricard 4816a2968aaSIlan Elias #endif /* __NCI_H */ 482