Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  The NFC Controller Interface is the communication protocol between an
0004  *  NFC Controller (NFCC) and a Device Host (DH).
0005  *
0006  *  Copyright (C) 2014 Marvell International Ltd.
0007  *  Copyright (C) 2011 Texas Instruments, Inc.
0008  *
0009  *  Written by Ilan Elias <ilane@ti.com>
0010  *
0011  *  Acknowledgements:
0012  *  This file is based on hci.h, which was written
0013  *  by Maxim Krasnyansky.
0014  */
0015 
0016 #ifndef __NCI_H
0017 #define __NCI_H
0018 
0019 #include <net/nfc/nfc.h>
0020 
0021 /* NCI constants */
0022 #define NCI_MAX_NUM_MAPPING_CONFIGS             10
0023 #define NCI_MAX_NUM_RF_CONFIGS                  10
0024 #define NCI_MAX_NUM_CONN                    10
0025 #define NCI_MAX_PARAM_LEN                   251
0026 #define NCI_MAX_PAYLOAD_SIZE                    255
0027 #define NCI_MAX_PACKET_SIZE                 258
0028 #define NCI_MAX_LARGE_PARAMS_NCI_v2             15
0029 #define NCI_VER_2_MASK                      0x20
0030 
0031 /* NCI Status Codes */
0032 #define NCI_STATUS_OK                       0x00
0033 #define NCI_STATUS_REJECTED                 0x01
0034 #define NCI_STATUS_RF_FRAME_CORRUPTED               0x02
0035 #define NCI_STATUS_FAILED                   0x03
0036 #define NCI_STATUS_NOT_INITIALIZED              0x04
0037 #define NCI_STATUS_SYNTAX_ERROR                 0x05
0038 #define NCI_STATUS_SEMANTIC_ERROR               0x06
0039 #define NCI_STATUS_UNKNOWN_GID                  0x07
0040 #define NCI_STATUS_UNKNOWN_OID                  0x08
0041 #define NCI_STATUS_INVALID_PARAM                0x09
0042 #define NCI_STATUS_MESSAGE_SIZE_EXCEEDED            0x0a
0043 /* Discovery Specific Status Codes */
0044 #define NCI_STATUS_DISCOVERY_ALREADY_STARTED            0xa0
0045 #define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED       0xa1
0046 #define NCI_STATUS_DISCOVERY_TEAR_DOWN              0xa2
0047 /* RF Interface Specific Status Codes */
0048 #define NCI_STATUS_RF_TRANSMISSION_ERROR            0xb0
0049 #define NCI_STATUS_RF_PROTOCOL_ERROR                0xb1
0050 #define NCI_STATUS_RF_TIMEOUT_ERROR             0xb2
0051 /* NFCEE Interface Specific Status Codes */
0052 #define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED        0xc0
0053 #define NCI_STATUS_NFCEE_TRANSMISSION_ERROR         0xc1
0054 #define NCI_STATUS_NFCEE_PROTOCOL_ERROR             0xc2
0055 #define NCI_STATUS_NFCEE_TIMEOUT_ERROR              0xc3
0056 
0057 /* NFCEE Interface/Protocols */
0058 #define NCI_NFCEE_INTERFACE_APDU           0x00
0059 #define NCI_NFCEE_INTERFACE_HCI_ACCESS     0x01
0060 #define NCI_NFCEE_INTERFACE_TYPE3_CMD_SET  0x02
0061 #define NCI_NFCEE_INTERFACE_TRANSPARENT        0x03
0062 
0063 /* Destination type */
0064 #define NCI_DESTINATION_NFCC_LOOPBACK      0x01
0065 #define NCI_DESTINATION_REMOTE_NFC_ENDPOINT    0x02
0066 #define NCI_DESTINATION_NFCEE              0x03
0067 
0068 /* Destination-specific parameters type */
0069 #define NCI_DESTINATION_SPECIFIC_PARAM_RF_TYPE     0x00
0070 #define NCI_DESTINATION_SPECIFIC_PARAM_NFCEE_TYPE  0x01
0071 
0072 /* NFCEE Discovery Action */
0073 #define NCI_NFCEE_DISCOVERY_ACTION_DISABLE          0x00
0074 #define NCI_NFCEE_DISCOVERY_ACTION_ENABLE           0x01
0075 
0076 /* NCI RF Technology and Mode */
0077 #define NCI_NFC_A_PASSIVE_POLL_MODE             0x00
0078 #define NCI_NFC_B_PASSIVE_POLL_MODE             0x01
0079 #define NCI_NFC_F_PASSIVE_POLL_MODE             0x02
0080 #define NCI_NFC_A_ACTIVE_POLL_MODE              0x03
0081 #define NCI_NFC_F_ACTIVE_POLL_MODE              0x05
0082 #define NCI_NFC_V_PASSIVE_POLL_MODE             0x06
0083 #define NCI_NFC_A_PASSIVE_LISTEN_MODE               0x80
0084 #define NCI_NFC_B_PASSIVE_LISTEN_MODE               0x81
0085 #define NCI_NFC_F_PASSIVE_LISTEN_MODE               0x82
0086 #define NCI_NFC_A_ACTIVE_LISTEN_MODE                0x83
0087 #define NCI_NFC_F_ACTIVE_LISTEN_MODE                0x85
0088 
0089 #define NCI_RF_TECH_MODE_LISTEN_MASK                0x80
0090 
0091 /* NCI RF Technologies */
0092 #define NCI_NFC_RF_TECHNOLOGY_A                 0x00
0093 #define NCI_NFC_RF_TECHNOLOGY_B                 0x01
0094 #define NCI_NFC_RF_TECHNOLOGY_F                 0x02
0095 #define NCI_NFC_RF_TECHNOLOGY_V                 0x03
0096 
0097 /* NCI Bit Rates */
0098 #define NCI_NFC_BIT_RATE_106                    0x00
0099 #define NCI_NFC_BIT_RATE_212                    0x01
0100 #define NCI_NFC_BIT_RATE_424                    0x02
0101 #define NCI_NFC_BIT_RATE_848                    0x03
0102 #define NCI_NFC_BIT_RATE_1695                   0x04
0103 #define NCI_NFC_BIT_RATE_3390                   0x05
0104 #define NCI_NFC_BIT_RATE_6780                   0x06
0105 #define NCI_NFC_BIT_RATE_26                 0x20
0106 
0107 /* NCI RF Protocols */
0108 #define NCI_RF_PROTOCOL_UNKNOWN                 0x00
0109 #define NCI_RF_PROTOCOL_T1T                 0x01
0110 #define NCI_RF_PROTOCOL_T2T                 0x02
0111 #define NCI_RF_PROTOCOL_T3T                 0x03
0112 #define NCI_RF_PROTOCOL_ISO_DEP                 0x04
0113 #define NCI_RF_PROTOCOL_NFC_DEP                 0x05
0114 #define NCI_RF_PROTOCOL_T5T                 0x06
0115 
0116 /* NCI RF Interfaces */
0117 #define NCI_RF_INTERFACE_NFCEE_DIRECT               0x00
0118 #define NCI_RF_INTERFACE_FRAME                  0x01
0119 #define NCI_RF_INTERFACE_ISO_DEP                0x02
0120 #define NCI_RF_INTERFACE_NFC_DEP                0x03
0121 
0122 /* NCI Configuration Parameter Tags */
0123 #define NCI_PN_ATR_REQ_GEN_BYTES                0x29
0124 #define NCI_LN_ATR_RES_GEN_BYTES                0x61
0125 #define NCI_LA_SEL_INFO                     0x32
0126 #define NCI_LF_PROTOCOL_TYPE                    0x50
0127 #define NCI_LF_CON_BITR_F                   0x54
0128 
0129 /* NCI Configuration Parameters masks */
0130 #define NCI_LA_SEL_INFO_ISO_DEP_MASK                0x20
0131 #define NCI_LA_SEL_INFO_NFC_DEP_MASK                0x40
0132 #define NCI_LF_PROTOCOL_TYPE_NFC_DEP_MASK           0x02
0133 #define NCI_LF_CON_BITR_F_212                   0x02
0134 #define NCI_LF_CON_BITR_F_424                   0x04
0135 
0136 /* NCI 2.x Feature Enable Bit */
0137 #define NCI_FEATURE_DISABLE                 0x00
0138 
0139 /* NCI Reset types */
0140 #define NCI_RESET_TYPE_KEEP_CONFIG              0x00
0141 #define NCI_RESET_TYPE_RESET_CONFIG             0x01
0142 
0143 /* NCI Static RF connection ID */
0144 #define NCI_STATIC_RF_CONN_ID                   0x00
0145 
0146 /* NCI Data Flow Control */
0147 #define NCI_DATA_FLOW_CONTROL_NOT_USED              0xff
0148 
0149 /* NCI RF_DISCOVER_MAP_CMD modes */
0150 #define NCI_DISC_MAP_MODE_POLL                  0x01
0151 #define NCI_DISC_MAP_MODE_LISTEN                0x02
0152 
0153 /* NCI Discover Notification Type */
0154 #define NCI_DISCOVER_NTF_TYPE_LAST              0x00
0155 #define NCI_DISCOVER_NTF_TYPE_LAST_NFCC             0x01
0156 #define NCI_DISCOVER_NTF_TYPE_MORE              0x02
0157 
0158 /* NCI Deactivation Type */
0159 #define NCI_DEACTIVATE_TYPE_IDLE_MODE               0x00
0160 #define NCI_DEACTIVATE_TYPE_SLEEP_MODE              0x01
0161 #define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE           0x02
0162 #define NCI_DEACTIVATE_TYPE_DISCOVERY               0x03
0163 
0164 /* Message Type (MT) */
0165 #define NCI_MT_DATA_PKT                     0x00
0166 #define NCI_MT_CMD_PKT                      0x01
0167 #define NCI_MT_RSP_PKT                      0x02
0168 #define NCI_MT_NTF_PKT                      0x03
0169 
0170 #define nci_mt(hdr)         (((hdr)[0]>>5)&0x07)
0171 #define nci_mt_set(hdr, mt)     ((hdr)[0] |= (__u8)(((mt)&0x07)<<5))
0172 
0173 /* Packet Boundary Flag (PBF) */
0174 #define NCI_PBF_LAST                        0x00
0175 #define NCI_PBF_CONT                        0x01
0176 
0177 #define nci_pbf(hdr)            (__u8)(((hdr)[0]>>4)&0x01)
0178 #define nci_pbf_set(hdr, pbf)       ((hdr)[0] |= (__u8)(((pbf)&0x01)<<4))
0179 
0180 /* Control Opcode manipulation */
0181 #define nci_opcode_pack(gid, oid)   (__u16)((((__u16)((gid)&0x0f))<<8)|\
0182                     ((__u16)((oid)&0x3f)))
0183 #define nci_opcode(hdr)         nci_opcode_pack(hdr[0], hdr[1])
0184 #define nci_opcode_gid(op)      (__u8)(((op)&0x0f00)>>8)
0185 #define nci_opcode_oid(op)      (__u8)((op)&0x003f)
0186 
0187 /* Payload Length */
0188 #define nci_plen(hdr)           (__u8)((hdr)[2])
0189 
0190 /* Connection ID */
0191 #define nci_conn_id(hdr)        (__u8)(((hdr)[0])&0x0f)
0192 
0193 /* GID values */
0194 #define NCI_GID_CORE                        0x0
0195 #define NCI_GID_RF_MGMT                     0x1
0196 #define NCI_GID_NFCEE_MGMT                  0x2
0197 #define NCI_GID_PROPRIETARY                 0xf
0198 
0199 /* ----- NCI over SPI head/crc(tail) room needed for outgoing frames ----- */
0200 #define NCI_SPI_HDR_LEN                     4
0201 #define NCI_SPI_CRC_LEN                     2
0202 
0203 /* ---- NCI Packet structures ---- */
0204 #define NCI_CTRL_HDR_SIZE                   3
0205 #define NCI_DATA_HDR_SIZE                   3
0206 
0207 struct nci_ctrl_hdr {
0208     __u8    gid;        /* MT & PBF & GID */
0209     __u8    oid;
0210     __u8    plen;
0211 } __packed;
0212 
0213 struct nci_data_hdr {
0214     __u8    conn_id;    /* MT & PBF & ConnID */
0215     __u8    rfu;
0216     __u8    plen;
0217 } __packed;
0218 
0219 /* ------------------------ */
0220 /* -----  NCI Commands ---- */
0221 /* ------------------------ */
0222 #define NCI_OP_CORE_RESET_CMD       nci_opcode_pack(NCI_GID_CORE, 0x00)
0223 struct nci_core_reset_cmd {
0224     __u8    reset_type;
0225 } __packed;
0226 
0227 #define NCI_OP_CORE_INIT_CMD        nci_opcode_pack(NCI_GID_CORE, 0x01)
0228 /* To support NCI 2.x */
0229 struct nci_core_init_v2_cmd {
0230     u8  feature1;
0231     u8  feature2;
0232 };
0233 
0234 #define NCI_OP_CORE_SET_CONFIG_CMD  nci_opcode_pack(NCI_GID_CORE, 0x02)
0235 struct set_config_param {
0236     __u8    id;
0237     __u8    len;
0238     __u8    val[NCI_MAX_PARAM_LEN];
0239 } __packed;
0240 
0241 struct nci_core_set_config_cmd {
0242     __u8    num_params;
0243     struct  set_config_param param; /* support 1 param per cmd is enough */
0244 } __packed;
0245 
0246 #define NCI_OP_CORE_CONN_CREATE_CMD nci_opcode_pack(NCI_GID_CORE, 0x04)
0247 #define DEST_SPEC_PARAMS_ID_INDEX   0
0248 #define DEST_SPEC_PARAMS_PROTOCOL_INDEX 1
0249 struct dest_spec_params {
0250     __u8    id;
0251     __u8    protocol;
0252 } __packed;
0253 
0254 struct core_conn_create_dest_spec_params {
0255     __u8    type;
0256     __u8    length;
0257     __u8    value[];
0258 } __packed;
0259 
0260 struct nci_core_conn_create_cmd {
0261     __u8    destination_type;
0262     __u8    number_destination_params;
0263     struct core_conn_create_dest_spec_params params[];
0264 } __packed;
0265 
0266 #define NCI_OP_CORE_CONN_CLOSE_CMD  nci_opcode_pack(NCI_GID_CORE, 0x05)
0267 
0268 #define NCI_OP_RF_DISCOVER_MAP_CMD  nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
0269 struct disc_map_config {
0270     __u8    rf_protocol;
0271     __u8    mode;
0272     __u8    rf_interface;
0273 } __packed;
0274 
0275 struct nci_rf_disc_map_cmd {
0276     __u8                num_mapping_configs;
0277     struct disc_map_config      mapping_configs
0278                     [NCI_MAX_NUM_MAPPING_CONFIGS];
0279 } __packed;
0280 
0281 #define NCI_OP_RF_DISCOVER_CMD      nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
0282 struct disc_config {
0283     __u8    rf_tech_and_mode;
0284     __u8    frequency;
0285 } __packed;
0286 
0287 struct nci_rf_disc_cmd {
0288     __u8                num_disc_configs;
0289     struct disc_config      disc_configs[NCI_MAX_NUM_RF_CONFIGS];
0290 } __packed;
0291 
0292 #define NCI_OP_RF_DISCOVER_SELECT_CMD   nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
0293 struct nci_rf_discover_select_cmd {
0294     __u8    rf_discovery_id;
0295     __u8    rf_protocol;
0296     __u8    rf_interface;
0297 } __packed;
0298 
0299 #define NCI_OP_RF_DEACTIVATE_CMD    nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
0300 struct nci_rf_deactivate_cmd {
0301     __u8    type;
0302 } __packed;
0303 
0304 #define NCI_OP_NFCEE_DISCOVER_CMD nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x00)
0305 struct nci_nfcee_discover_cmd {
0306     __u8    discovery_action;
0307 } __packed;
0308 
0309 #define NCI_OP_NFCEE_MODE_SET_CMD nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x01)
0310 #define NCI_NFCEE_DISABLE   0x00
0311 #define NCI_NFCEE_ENABLE    0x01
0312 struct nci_nfcee_mode_set_cmd {
0313     __u8    nfcee_id;
0314     __u8    nfcee_mode;
0315 } __packed;
0316 
0317 #define NCI_OP_CORE_GET_CONFIG_CMD  nci_opcode_pack(NCI_GID_CORE, 0x03)
0318 
0319 /* ----------------------- */
0320 /* ---- NCI Responses ---- */
0321 /* ----------------------- */
0322 #define NCI_OP_CORE_RESET_RSP       nci_opcode_pack(NCI_GID_CORE, 0x00)
0323 struct nci_core_reset_rsp {
0324     __u8    status;
0325     __u8    nci_ver;
0326     __u8    config_status;
0327 } __packed;
0328 
0329 #define NCI_OP_CORE_INIT_RSP        nci_opcode_pack(NCI_GID_CORE, 0x01)
0330 struct nci_core_init_rsp_1 {
0331     __u8    status;
0332     __le32  nfcc_features;
0333     __u8    num_supported_rf_interfaces;
0334     __u8    supported_rf_interfaces[];  /* variable size array */
0335     /* continuted in nci_core_init_rsp_2 */
0336 } __packed;
0337 
0338 struct nci_core_init_rsp_2 {
0339     __u8    max_logical_connections;
0340     __le16  max_routing_table_size;
0341     __u8    max_ctrl_pkt_payload_len;
0342     __le16  max_size_for_large_params;
0343     __u8    manufact_id;
0344     __le32  manufact_specific_info;
0345 } __packed;
0346 
0347 /* To support NCI ver 2.x */
0348 struct nci_core_init_rsp_nci_ver2 {
0349     u8  status;
0350     __le32  nfcc_features;
0351     u8  max_logical_connections;
0352     __le16  max_routing_table_size;
0353     u8  max_ctrl_pkt_payload_len;
0354     u8  max_data_pkt_hci_payload_len;
0355     u8  number_of_hci_credit;
0356     __le16  max_nfc_v_frame_size;
0357     u8  num_supported_rf_interfaces;
0358     u8  supported_rf_interfaces[];
0359 } __packed;
0360 
0361 #define NCI_OP_CORE_SET_CONFIG_RSP  nci_opcode_pack(NCI_GID_CORE, 0x02)
0362 struct nci_core_set_config_rsp {
0363     __u8    status;
0364     __u8    num_params;
0365     __u8    params_id[];    /* variable size array */
0366 } __packed;
0367 
0368 #define NCI_OP_CORE_CONN_CREATE_RSP nci_opcode_pack(NCI_GID_CORE, 0x04)
0369 struct nci_core_conn_create_rsp {
0370     __u8    status;
0371     __u8    max_ctrl_pkt_payload_len;
0372     __u8    credits_cnt;
0373     __u8    conn_id;
0374 } __packed;
0375 
0376 #define NCI_OP_CORE_CONN_CLOSE_RSP  nci_opcode_pack(NCI_GID_CORE, 0x05)
0377 
0378 #define NCI_OP_RF_DISCOVER_MAP_RSP  nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
0379 
0380 #define NCI_OP_RF_DISCOVER_RSP      nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
0381 
0382 #define NCI_OP_RF_DISCOVER_SELECT_RSP   nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
0383 
0384 #define NCI_OP_RF_DEACTIVATE_RSP    nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
0385 
0386 #define NCI_OP_NFCEE_DISCOVER_RSP nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x00)
0387 struct nci_nfcee_discover_rsp {
0388     __u8    status;
0389     __u8    num_nfcee;
0390 } __packed;
0391 
0392 #define NCI_OP_NFCEE_MODE_SET_RSP nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x01)
0393 
0394 #define NCI_OP_CORE_GET_CONFIG_RSP  nci_opcode_pack(NCI_GID_CORE, 0x03)
0395 
0396 /* --------------------------- */
0397 /* ---- NCI Notifications ---- */
0398 /* --------------------------- */
0399 #define NCI_OP_CORE_RESET_NTF       nci_opcode_pack(NCI_GID_CORE, 0x00)
0400 struct nci_core_reset_ntf {
0401     u8  reset_trigger;
0402     u8  config_status;
0403     u8  nci_ver;
0404     u8  manufact_id;
0405     u8  manufacturer_specific_len;
0406     __le32  manufact_specific_info;
0407 } __packed;
0408 
0409 #define NCI_OP_CORE_CONN_CREDITS_NTF    nci_opcode_pack(NCI_GID_CORE, 0x06)
0410 struct conn_credit_entry {
0411     __u8    conn_id;
0412     __u8    credits;
0413 } __packed;
0414 
0415 struct nci_core_conn_credit_ntf {
0416     __u8                num_entries;
0417     struct conn_credit_entry    conn_entries[NCI_MAX_NUM_CONN];
0418 } __packed;
0419 
0420 #define NCI_OP_CORE_GENERIC_ERROR_NTF   nci_opcode_pack(NCI_GID_CORE, 0x07)
0421 
0422 #define NCI_OP_CORE_INTF_ERROR_NTF  nci_opcode_pack(NCI_GID_CORE, 0x08)
0423 struct nci_core_intf_error_ntf {
0424     __u8    status;
0425     __u8    conn_id;
0426 } __packed;
0427 
0428 #define NCI_OP_RF_DISCOVER_NTF      nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
0429 struct rf_tech_specific_params_nfca_poll {
0430     __u16   sens_res;
0431     __u8    nfcid1_len; /* 0, 4, 7, or 10 Bytes */
0432     __u8    nfcid1[NFC_NFCID1_MAXSIZE];
0433     __u8    sel_res_len;    /* 0 or 1 Bytes */
0434     __u8    sel_res;
0435 } __packed;
0436 
0437 struct rf_tech_specific_params_nfcb_poll {
0438     __u8    sensb_res_len;
0439     __u8    sensb_res[NFC_SENSB_RES_MAXSIZE];   /* 11 or 12 Bytes */
0440 } __packed;
0441 
0442 struct rf_tech_specific_params_nfcf_poll {
0443     __u8    bit_rate;
0444     __u8    sensf_res_len;
0445     __u8    sensf_res[NFC_SENSF_RES_MAXSIZE];   /* 16 or 18 Bytes */
0446 } __packed;
0447 
0448 struct rf_tech_specific_params_nfcv_poll {
0449     __u8    res_flags;
0450     __u8    dsfid;
0451     __u8    uid[NFC_ISO15693_UID_MAXSIZE];  /* 8 Bytes */
0452 } __packed;
0453 
0454 struct rf_tech_specific_params_nfcf_listen {
0455     __u8    local_nfcid2_len;
0456     __u8    local_nfcid2[NFC_NFCID2_MAXSIZE];   /* 0 or 8 Bytes */
0457 } __packed;
0458 
0459 struct nci_rf_discover_ntf {
0460     __u8    rf_discovery_id;
0461     __u8    rf_protocol;
0462     __u8    rf_tech_and_mode;
0463     __u8    rf_tech_specific_params_len;
0464 
0465     union {
0466         struct rf_tech_specific_params_nfca_poll nfca_poll;
0467         struct rf_tech_specific_params_nfcb_poll nfcb_poll;
0468         struct rf_tech_specific_params_nfcf_poll nfcf_poll;
0469         struct rf_tech_specific_params_nfcv_poll nfcv_poll;
0470     } rf_tech_specific_params;
0471 
0472     __u8    ntf_type;
0473 } __packed;
0474 
0475 #define NCI_OP_RF_INTF_ACTIVATED_NTF    nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
0476 struct activation_params_nfca_poll_iso_dep {
0477     __u8    rats_res_len;
0478     __u8    rats_res[20];
0479 };
0480 
0481 struct activation_params_nfcb_poll_iso_dep {
0482     __u8    attrib_res_len;
0483     __u8    attrib_res[50];
0484 };
0485 
0486 struct activation_params_poll_nfc_dep {
0487     __u8    atr_res_len;
0488     __u8    atr_res[NFC_ATR_RES_MAXSIZE - 2]; /* ATR_RES from byte 3 */
0489 };
0490 
0491 struct activation_params_listen_nfc_dep {
0492     __u8    atr_req_len;
0493     __u8    atr_req[NFC_ATR_REQ_MAXSIZE - 2]; /* ATR_REQ from byte 3 */
0494 };
0495 
0496 struct nci_rf_intf_activated_ntf {
0497     __u8    rf_discovery_id;
0498     __u8    rf_interface;
0499     __u8    rf_protocol;
0500     __u8    activation_rf_tech_and_mode;
0501     __u8    max_data_pkt_payload_size;
0502     __u8    initial_num_credits;
0503     __u8    rf_tech_specific_params_len;
0504 
0505     union {
0506         struct rf_tech_specific_params_nfca_poll nfca_poll;
0507         struct rf_tech_specific_params_nfcb_poll nfcb_poll;
0508         struct rf_tech_specific_params_nfcf_poll nfcf_poll;
0509         struct rf_tech_specific_params_nfcv_poll nfcv_poll;
0510         struct rf_tech_specific_params_nfcf_listen nfcf_listen;
0511     } rf_tech_specific_params;
0512 
0513     __u8    data_exch_rf_tech_and_mode;
0514     __u8    data_exch_tx_bit_rate;
0515     __u8    data_exch_rx_bit_rate;
0516     __u8    activation_params_len;
0517 
0518     union {
0519         struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
0520         struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep;
0521         struct activation_params_poll_nfc_dep poll_nfc_dep;
0522         struct activation_params_listen_nfc_dep listen_nfc_dep;
0523     } activation_params;
0524 
0525 } __packed;
0526 
0527 #define NCI_OP_RF_DEACTIVATE_NTF    nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
0528 struct nci_rf_deactivate_ntf {
0529     __u8    type;
0530     __u8    reason;
0531 } __packed;
0532 
0533 #define NCI_OP_RF_NFCEE_ACTION_NTF  nci_opcode_pack(NCI_GID_RF_MGMT, 0x09)
0534 struct nci_rf_nfcee_action_ntf {
0535     __u8 nfcee_id;
0536     __u8 trigger;
0537     __u8 supported_data_length;
0538     __u8 supported_data[];
0539 } __packed;
0540 
0541 #define NCI_OP_NFCEE_DISCOVER_NTF nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x00)
0542 struct nci_nfcee_supported_protocol {
0543     __u8    num_protocol;
0544     __u8    supported_protocol[];
0545 } __packed;
0546 
0547 struct nci_nfcee_information_tlv {
0548     __u8    num_tlv;
0549     __u8    information_tlv[];
0550 } __packed;
0551 
0552 struct nci_nfcee_discover_ntf {
0553     __u8    nfcee_id;
0554     __u8    nfcee_status;
0555     struct nci_nfcee_supported_protocol supported_protocols;
0556     struct nci_nfcee_information_tlv    information_tlv;
0557 } __packed;
0558 
0559 #define NCI_OP_CORE_RESET_NTF       nci_opcode_pack(NCI_GID_CORE, 0x00)
0560 
0561 #endif /* __NCI_H */