aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/nfc
diff options
context:
space:
mode:
authorIlan Elias <ilane@ti.com>2012-01-18 06:16:14 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-01-24 14:32:29 -0500
commit019c4fbaa790e2b3f11dab0c8b7d9896d77db3e5 (patch)
tree593fc051bc96a40e48406f6cba883b1f95822422 /include/net/nfc
parent25a1d9dc850b1bdcc4760eb625f0a67057f54d26 (diff)
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>
Diffstat (limited to 'include/net/nfc')
-rw-r--r--include/net/nfc/nci.h34
-rw-r--r--include/net/nfc/nci_core.h9
2 files changed, 41 insertions, 2 deletions
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 34f5ed29c3c1..276094b91d7c 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -116,6 +116,11 @@
116#define NCI_DISC_MAP_MODE_POLL 0x01 116#define NCI_DISC_MAP_MODE_POLL 0x01
117#define NCI_DISC_MAP_MODE_LISTEN 0x02 117#define NCI_DISC_MAP_MODE_LISTEN 0x02
118 118
119/* NCI Discover Notification Type */
120#define NCI_DISCOVER_NTF_TYPE_LAST 0x00
121#define NCI_DISCOVER_NTF_TYPE_LAST_NFCC 0x01
122#define NCI_DISCOVER_NTF_TYPE_MORE 0x02
123
119/* NCI Deactivation Type */ 124/* NCI Deactivation Type */
120#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 125#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
121#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 126#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
@@ -207,6 +212,13 @@ struct nci_rf_disc_cmd {
207 struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS]; 212 struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS];
208} __packed; 213} __packed;
209 214
215#define NCI_OP_RF_DISCOVER_SELECT_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
216struct nci_rf_discover_select_cmd {
217 __u8 rf_discovery_id;
218 __u8 rf_protocol;
219 __u8 rf_interface;
220} __packed;
221
210#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 222#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
211struct nci_rf_deactivate_cmd { 223struct nci_rf_deactivate_cmd {
212 __u8 type; 224 __u8 type;
@@ -244,6 +256,8 @@ struct nci_core_init_rsp_2 {
244 256
245#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 257#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
246 258
259#define NCI_OP_RF_DISCOVER_SELECT_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
260
247#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 261#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
248 262
249/* --------------------------- */ 263/* --------------------------- */
@@ -260,13 +274,15 @@ struct nci_core_conn_credit_ntf {
260 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 274 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
261} __packed; 275} __packed;
262 276
277#define NCI_OP_CORE_GENERIC_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x07)
278
263#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 279#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08)
264struct nci_core_intf_error_ntf { 280struct nci_core_intf_error_ntf {
265 __u8 status; 281 __u8 status;
266 __u8 conn_id; 282 __u8 conn_id;
267} __packed; 283} __packed;
268 284
269#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 285#define NCI_OP_RF_DISCOVER_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
270struct rf_tech_specific_params_nfca_poll { 286struct rf_tech_specific_params_nfca_poll {
271 __u16 sens_res; 287 __u16 sens_res;
272 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ 288 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
@@ -286,6 +302,22 @@ struct rf_tech_specific_params_nfcf_poll {
286 __u8 sensf_res[18]; /* 16 or 18 Bytes */ 302 __u8 sensf_res[18]; /* 16 or 18 Bytes */
287} __packed; 303} __packed;
288 304
305struct nci_rf_discover_ntf {
306 __u8 rf_discovery_id;
307 __u8 rf_protocol;
308 __u8 rf_tech_and_mode;
309 __u8 rf_tech_specific_params_len;
310
311 union {
312 struct rf_tech_specific_params_nfca_poll nfca_poll;
313 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
314 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
315 } rf_tech_specific_params;
316
317 __u8 ntf_type;
318} __packed;
319
320#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
289struct activation_params_nfca_poll_iso_dep { 321struct activation_params_nfca_poll_iso_dep {
290 __u8 rats_res_len; 322 __u8 rats_res_len;
291 __u8 rats_res[20]; 323 __u8 rats_res[20];
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index b9c3f8de13dd..86fee8b5c65c 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -46,6 +46,8 @@ enum nci_flag {
46enum nci_state { 46enum nci_state {
47 NCI_IDLE, 47 NCI_IDLE,
48 NCI_DISCOVERY, 48 NCI_DISCOVERY,
49 NCI_W4_ALL_DISCOVERIES,
50 NCI_W4_HOST_SELECT,
49 NCI_POLL_ACTIVE, 51 NCI_POLL_ACTIVE,
50}; 52};
51 53
@@ -53,6 +55,7 @@ enum nci_state {
53#define NCI_RESET_TIMEOUT 5000 55#define NCI_RESET_TIMEOUT 5000
54#define NCI_INIT_TIMEOUT 5000 56#define NCI_INIT_TIMEOUT 5000
55#define NCI_RF_DISC_TIMEOUT 5000 57#define NCI_RF_DISC_TIMEOUT 5000
58#define NCI_RF_DISC_SELECT_TIMEOUT 5000
56#define NCI_RF_DEACTIVATE_TIMEOUT 30000 59#define NCI_RF_DEACTIVATE_TIMEOUT 30000
57#define NCI_CMD_TIMEOUT 5000 60#define NCI_CMD_TIMEOUT 5000
58#define NCI_DATA_TIMEOUT 700 61#define NCI_DATA_TIMEOUT 700
@@ -66,6 +69,7 @@ struct nci_ops {
66}; 69};
67 70
68#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 71#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
72#define NCI_MAX_DISCOVERED_TARGETS 10
69 73
70/* NCI Core structures */ 74/* NCI Core structures */
71struct nci_dev { 75struct nci_dev {
@@ -105,9 +109,11 @@ struct nci_dev {
105 void *driver_data; 109 void *driver_data;
106 110
107 __u32 poll_prots; 111 __u32 poll_prots;
108 __u32 target_available_prots;
109 __u32 target_active_prot; 112 __u32 target_active_prot;
110 113
114 struct nfc_target targets[NCI_MAX_DISCOVERED_TARGETS];
115 int n_targets;
116
111 /* received during NCI_OP_CORE_RESET_RSP */ 117 /* received during NCI_OP_CORE_RESET_RSP */
112 __u8 nci_ver; 118 __u8 nci_ver;
113 119
@@ -178,6 +184,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
178int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb); 184int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
179void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, 185void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
180 int err); 186 int err);
187void nci_clear_target_list(struct nci_dev *ndev);
181 188
182/* ----- NCI requests ----- */ 189/* ----- NCI requests ----- */
183#define NCI_REQ_DONE 0 190#define NCI_REQ_DONE 0