diff options
author | Julien Lefrique <lefrique@marvell.com> | 2014-10-21 10:52:46 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-11-28 08:07:51 -0500 |
commit | a99903ec4566eeeaaaf611499cae00abbe844938 (patch) | |
tree | 67fa8332a70691e99011ca0289e25ec227ce3fb7 /include/net/nfc | |
parent | 90d78c13965859d87622b37a221ebf29522585a8 (diff) |
NFC: NCI: Handle Target mode activation
Changes:
* Extract the Listen mode activation parameters from RF_INTF_ACTIVATED_NTF.
* Store the General Bytes of ATR_REQ.
* Signal that Target mode is activated in case of an activation in NFC-DEP.
* Update the NCI state accordingly.
* Use the various constants defined in nfc.h.
* Fix the ATR_REQ and ATR_RES maximum size. As per NCI 1.0 and NCI 1.1, the
Activation Parameters for both Poll and Listen mode contain all the bytes of
ATR_REQ/ATR_RES starting and including Byte 3 as defined in [DIGITAL].
In [DIGITAL], the maximum size of ATR_REQ/ATR_RES is 64 bytes and they are
numbered starting from Byte 1.
Signed-off-by: Julien Lefrique <lefrique@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/net/nfc')
-rw-r--r-- | include/net/nfc/nci.h | 26 | ||||
-rw-r--r-- | include/net/nfc/nci_core.h | 3 | ||||
-rw-r--r-- | include/net/nfc/nfc.h | 2 |
3 files changed, 26 insertions, 5 deletions
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h index 36cf65386b86..fffadc706e06 100644 --- a/include/net/nfc/nci.h +++ b/include/net/nfc/nci.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #ifndef __NCI_H | 28 | #ifndef __NCI_H |
29 | #define __NCI_H | 29 | #define __NCI_H |
30 | 30 | ||
31 | #include <net/nfc/nfc.h> | ||
32 | |||
31 | /* NCI constants */ | 33 | /* NCI constants */ |
32 | #define NCI_MAX_NUM_MAPPING_CONFIGS 10 | 34 | #define NCI_MAX_NUM_MAPPING_CONFIGS 10 |
33 | #define NCI_MAX_NUM_RF_CONFIGS 10 | 35 | #define NCI_MAX_NUM_RF_CONFIGS 10 |
@@ -73,6 +75,8 @@ | |||
73 | #define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 | 75 | #define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 |
74 | #define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 | 76 | #define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 |
75 | 77 | ||
78 | #define NCI_RF_TECH_MODE_LISTEN_MASK 0x80 | ||
79 | |||
76 | /* NCI RF Technologies */ | 80 | /* NCI RF Technologies */ |
77 | #define NCI_NFC_RF_TECHNOLOGY_A 0x00 | 81 | #define NCI_NFC_RF_TECHNOLOGY_A 0x00 |
78 | #define NCI_NFC_RF_TECHNOLOGY_B 0x01 | 82 | #define NCI_NFC_RF_TECHNOLOGY_B 0x01 |
@@ -324,26 +328,31 @@ struct nci_core_intf_error_ntf { | |||
324 | struct rf_tech_specific_params_nfca_poll { | 328 | struct rf_tech_specific_params_nfca_poll { |
325 | __u16 sens_res; | 329 | __u16 sens_res; |
326 | __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ | 330 | __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ |
327 | __u8 nfcid1[10]; | 331 | __u8 nfcid1[NFC_NFCID1_MAXSIZE]; |
328 | __u8 sel_res_len; /* 0 or 1 Bytes */ | 332 | __u8 sel_res_len; /* 0 or 1 Bytes */ |
329 | __u8 sel_res; | 333 | __u8 sel_res; |
330 | } __packed; | 334 | } __packed; |
331 | 335 | ||
332 | struct rf_tech_specific_params_nfcb_poll { | 336 | struct rf_tech_specific_params_nfcb_poll { |
333 | __u8 sensb_res_len; | 337 | __u8 sensb_res_len; |
334 | __u8 sensb_res[12]; /* 11 or 12 Bytes */ | 338 | __u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; /* 11 or 12 Bytes */ |
335 | } __packed; | 339 | } __packed; |
336 | 340 | ||
337 | struct rf_tech_specific_params_nfcf_poll { | 341 | struct rf_tech_specific_params_nfcf_poll { |
338 | __u8 bit_rate; | 342 | __u8 bit_rate; |
339 | __u8 sensf_res_len; | 343 | __u8 sensf_res_len; |
340 | __u8 sensf_res[18]; /* 16 or 18 Bytes */ | 344 | __u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; /* 16 or 18 Bytes */ |
341 | } __packed; | 345 | } __packed; |
342 | 346 | ||
343 | struct rf_tech_specific_params_nfcv_poll { | 347 | struct rf_tech_specific_params_nfcv_poll { |
344 | __u8 res_flags; | 348 | __u8 res_flags; |
345 | __u8 dsfid; | 349 | __u8 dsfid; |
346 | __u8 uid[8]; /* 8 Bytes */ | 350 | __u8 uid[NFC_ISO15693_UID_MAXSIZE]; /* 8 Bytes */ |
351 | } __packed; | ||
352 | |||
353 | struct rf_tech_specific_params_nfcf_listen { | ||
354 | __u8 local_nfcid2_len; | ||
355 | __u8 local_nfcid2[NFC_NFCID2_MAXSIZE]; /* 0 or 8 Bytes */ | ||
347 | } __packed; | 356 | } __packed; |
348 | 357 | ||
349 | struct nci_rf_discover_ntf { | 358 | struct nci_rf_discover_ntf { |
@@ -375,7 +384,12 @@ struct activation_params_nfcb_poll_iso_dep { | |||
375 | 384 | ||
376 | struct activation_params_poll_nfc_dep { | 385 | struct activation_params_poll_nfc_dep { |
377 | __u8 atr_res_len; | 386 | __u8 atr_res_len; |
378 | __u8 atr_res[63]; | 387 | __u8 atr_res[NFC_ATR_RES_MAXSIZE - 2]; /* ATR_RES from byte 3 */ |
388 | }; | ||
389 | |||
390 | struct activation_params_listen_nfc_dep { | ||
391 | __u8 atr_req_len; | ||
392 | __u8 atr_req[NFC_ATR_REQ_MAXSIZE - 2]; /* ATR_REQ from byte 3 */ | ||
379 | }; | 393 | }; |
380 | 394 | ||
381 | struct nci_rf_intf_activated_ntf { | 395 | struct nci_rf_intf_activated_ntf { |
@@ -392,6 +406,7 @@ struct nci_rf_intf_activated_ntf { | |||
392 | struct rf_tech_specific_params_nfcb_poll nfcb_poll; | 406 | struct rf_tech_specific_params_nfcb_poll nfcb_poll; |
393 | struct rf_tech_specific_params_nfcf_poll nfcf_poll; | 407 | struct rf_tech_specific_params_nfcf_poll nfcf_poll; |
394 | struct rf_tech_specific_params_nfcv_poll nfcv_poll; | 408 | struct rf_tech_specific_params_nfcv_poll nfcv_poll; |
409 | struct rf_tech_specific_params_nfcf_listen nfcf_listen; | ||
395 | } rf_tech_specific_params; | 410 | } rf_tech_specific_params; |
396 | 411 | ||
397 | __u8 data_exch_rf_tech_and_mode; | 412 | __u8 data_exch_rf_tech_and_mode; |
@@ -403,6 +418,7 @@ struct nci_rf_intf_activated_ntf { | |||
403 | struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; | 418 | struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; |
404 | struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; | 419 | struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; |
405 | struct activation_params_poll_nfc_dep poll_nfc_dep; | 420 | struct activation_params_poll_nfc_dep poll_nfc_dep; |
421 | struct activation_params_listen_nfc_dep listen_nfc_dep; | ||
406 | } activation_params; | 422 | } activation_params; |
407 | 423 | ||
408 | } __packed; | 424 | } __packed; |
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h index 75d10e625c49..cfea60748a39 100644 --- a/include/net/nfc/nci_core.h +++ b/include/net/nfc/nci_core.h | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (C) 2011 Texas Instruments, Inc. | 5 | * Copyright (C) 2011 Texas Instruments, Inc. |
6 | * Copyright (C) 2013 Intel Corporation. All rights reserved. | 6 | * Copyright (C) 2013 Intel Corporation. All rights reserved. |
7 | * Copyright (C) 2014 Marvell International Ltd. | ||
7 | * | 8 | * |
8 | * Written by Ilan Elias <ilane@ti.com> | 9 | * Written by Ilan Elias <ilane@ti.com> |
9 | * | 10 | * |
@@ -49,6 +50,8 @@ enum nci_state { | |||
49 | NCI_W4_ALL_DISCOVERIES, | 50 | NCI_W4_ALL_DISCOVERIES, |
50 | NCI_W4_HOST_SELECT, | 51 | NCI_W4_HOST_SELECT, |
51 | NCI_POLL_ACTIVE, | 52 | NCI_POLL_ACTIVE, |
53 | NCI_LISTEN_ACTIVE, | ||
54 | NCI_LISTEN_SLEEP, | ||
52 | }; | 55 | }; |
53 | 56 | ||
54 | /* NCI timeouts */ | 57 | /* NCI timeouts */ |
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 6c583e244de2..12adb817c27a 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2011 Instituto Nokia de Tecnologia | 2 | * Copyright (C) 2011 Instituto Nokia de Tecnologia |
3 | * Copyright (C) 2014 Marvell International Ltd. | ||
3 | * | 4 | * |
4 | * Authors: | 5 | * Authors: |
5 | * Lauro Ramos Venancio <lauro.venancio@openbossa.org> | 6 | * Lauro Ramos Venancio <lauro.venancio@openbossa.org> |
@@ -87,6 +88,7 @@ struct nfc_ops { | |||
87 | #define NFC_TARGET_IDX_ANY -1 | 88 | #define NFC_TARGET_IDX_ANY -1 |
88 | #define NFC_MAX_GT_LEN 48 | 89 | #define NFC_MAX_GT_LEN 48 |
89 | #define NFC_ATR_RES_GT_OFFSET 15 | 90 | #define NFC_ATR_RES_GT_OFFSET 15 |
91 | #define NFC_ATR_REQ_GT_OFFSET 14 | ||
90 | 92 | ||
91 | /** | 93 | /** |
92 | * struct nfc_target - NFC target descriptiom | 94 | * struct nfc_target - NFC target descriptiom |