NFC: Add NCI multiple targets support
Add the ability to select between multiple targets in NCI. If only one target is found, it will be auto-activated. If more than one target is found, then DISCOVER_NTF will be generated for each target, and the host should select one by calling DISCOVER_SELECT_CMD. Then, the target will be activated. If the activation fails, GENERIC_ERROR_NTF is generated. Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
25a1d9dc85
commit
019c4fbaa7
+33
-1
@@ -116,6 +116,11 @@
|
||||
#define NCI_DISC_MAP_MODE_POLL 0x01
|
||||
#define NCI_DISC_MAP_MODE_LISTEN 0x02
|
||||
|
||||
/* NCI Discover Notification Type */
|
||||
#define NCI_DISCOVER_NTF_TYPE_LAST 0x00
|
||||
#define NCI_DISCOVER_NTF_TYPE_LAST_NFCC 0x01
|
||||
#define NCI_DISCOVER_NTF_TYPE_MORE 0x02
|
||||
|
||||
/* NCI Deactivation Type */
|
||||
#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
|
||||
#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
|
||||
@@ -207,6 +212,13 @@ struct nci_rf_disc_cmd {
|
||||
struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS];
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_DISCOVER_SELECT_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
|
||||
struct nci_rf_discover_select_cmd {
|
||||
__u8 rf_discovery_id;
|
||||
__u8 rf_protocol;
|
||||
__u8 rf_interface;
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
|
||||
struct nci_rf_deactivate_cmd {
|
||||
__u8 type;
|
||||
@@ -244,6 +256,8 @@ struct nci_core_init_rsp_2 {
|
||||
|
||||
#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
|
||||
|
||||
#define NCI_OP_RF_DISCOVER_SELECT_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
|
||||
|
||||
#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
|
||||
|
||||
/* --------------------------- */
|
||||
@@ -260,13 +274,15 @@ struct nci_core_conn_credit_ntf {
|
||||
struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_CORE_GENERIC_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x07)
|
||||
|
||||
#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08)
|
||||
struct nci_core_intf_error_ntf {
|
||||
__u8 status;
|
||||
__u8 conn_id;
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
|
||||
#define NCI_OP_RF_DISCOVER_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
|
||||
struct rf_tech_specific_params_nfca_poll {
|
||||
__u16 sens_res;
|
||||
__u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
|
||||
@@ -286,6 +302,22 @@ struct rf_tech_specific_params_nfcf_poll {
|
||||
__u8 sensf_res[18]; /* 16 or 18 Bytes */
|
||||
} __packed;
|
||||
|
||||
struct nci_rf_discover_ntf {
|
||||
__u8 rf_discovery_id;
|
||||
__u8 rf_protocol;
|
||||
__u8 rf_tech_and_mode;
|
||||
__u8 rf_tech_specific_params_len;
|
||||
|
||||
union {
|
||||
struct rf_tech_specific_params_nfca_poll nfca_poll;
|
||||
struct rf_tech_specific_params_nfcb_poll nfcb_poll;
|
||||
struct rf_tech_specific_params_nfcf_poll nfcf_poll;
|
||||
} rf_tech_specific_params;
|
||||
|
||||
__u8 ntf_type;
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
|
||||
struct activation_params_nfca_poll_iso_dep {
|
||||
__u8 rats_res_len;
|
||||
__u8 rats_res[20];
|
||||
|
||||
@@ -46,6 +46,8 @@ enum nci_flag {
|
||||
enum nci_state {
|
||||
NCI_IDLE,
|
||||
NCI_DISCOVERY,
|
||||
NCI_W4_ALL_DISCOVERIES,
|
||||
NCI_W4_HOST_SELECT,
|
||||
NCI_POLL_ACTIVE,
|
||||
};
|
||||
|
||||
@@ -53,6 +55,7 @@ enum nci_state {
|
||||
#define NCI_RESET_TIMEOUT 5000
|
||||
#define NCI_INIT_TIMEOUT 5000
|
||||
#define NCI_RF_DISC_TIMEOUT 5000
|
||||
#define NCI_RF_DISC_SELECT_TIMEOUT 5000
|
||||
#define NCI_RF_DEACTIVATE_TIMEOUT 30000
|
||||
#define NCI_CMD_TIMEOUT 5000
|
||||
#define NCI_DATA_TIMEOUT 700
|
||||
@@ -66,6 +69,7 @@ struct nci_ops {
|
||||
};
|
||||
|
||||
#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
|
||||
#define NCI_MAX_DISCOVERED_TARGETS 10
|
||||
|
||||
/* NCI Core structures */
|
||||
struct nci_dev {
|
||||
@@ -105,9 +109,11 @@ struct nci_dev {
|
||||
void *driver_data;
|
||||
|
||||
__u32 poll_prots;
|
||||
__u32 target_available_prots;
|
||||
__u32 target_active_prot;
|
||||
|
||||
struct nfc_target targets[NCI_MAX_DISCOVERED_TARGETS];
|
||||
int n_targets;
|
||||
|
||||
/* received during NCI_OP_CORE_RESET_RSP */
|
||||
__u8 nci_ver;
|
||||
|
||||
@@ -178,6 +184,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
|
||||
int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
|
||||
void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
|
||||
int err);
|
||||
void nci_clear_target_list(struct nci_dev *ndev);
|
||||
|
||||
/* ----- NCI requests ----- */
|
||||
#define NCI_REQ_DONE 0
|
||||
|
||||
Reference in New Issue
Block a user