aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/digital.h
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2013-09-19 11:55:28 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-24 20:02:25 -0400
commit8c0695e4998dd268ff2a05951961247b7e015651 (patch)
tree86087518d7435dbe788647ee04be2b460bab0ee8 /net/nfc/digital.h
parent2c66daecc4092e6049673c281b2e6f0d5e59a94c (diff)
NFC Digital: Add NFC-F technology support
This adds polling support for NFC-F technology at 212 kbits/s and 424 kbits/s. A user space application like neard can send type 3 tag commands through the NFC core. Process flow for NFC-F detection is as follow: 1 - The digital stack sends the SENSF_REQ command to the NFC device. 2 - A peer device replies with a SENSF_RES response. 3 - The digital stack notifies the NFC core of the presence of a target in the operation field and passes the target NFCID2. This also adds support for CRC calculation of type CRC-F. The CRC calculation is handled by the digital stack if the NFC device doesn't support it. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/digital.h')
-rw-r--r--net/nfc/digital.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/nfc/digital.h b/net/nfc/digital.h
index fb5324b792de..85bc74c988f8 100644
--- a/net/nfc/digital.h
+++ b/net/nfc/digital.h
@@ -20,6 +20,7 @@
20#include <net/nfc/digital.h> 20#include <net/nfc/digital.h>
21 21
22#include <linux/crc-ccitt.h> 22#include <linux/crc-ccitt.h>
23#include <linux/crc-itu-t.h>
23 24
24#define PR_DBG(fmt, ...) pr_debug("%s: " fmt "\n", __func__, ##__VA_ARGS__) 25#define PR_DBG(fmt, ...) pr_debug("%s: " fmt "\n", __func__, ##__VA_ARGS__)
25#define PR_ERR(fmt, ...) pr_err("%s: " fmt "\n", __func__, ##__VA_ARGS__) 26#define PR_ERR(fmt, ...) pr_err("%s: " fmt "\n", __func__, ##__VA_ARGS__)
@@ -64,6 +65,7 @@ static inline int digital_in_send_cmd(struct nfc_digital_dev *ddev,
64void digital_poll_next_tech(struct nfc_digital_dev *ddev); 65void digital_poll_next_tech(struct nfc_digital_dev *ddev);
65 66
66int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech); 67int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech);
68int digital_in_send_sensf_req(struct nfc_digital_dev *ddev, u8 rf_tech);
67 69
68int digital_target_found(struct nfc_digital_dev *ddev, 70int digital_target_found(struct nfc_digital_dev *ddev,
69 struct nfc_target *target, u8 protocol); 71 struct nfc_target *target, u8 protocol);
@@ -74,6 +76,7 @@ typedef u16 (*crc_func_t)(u16, const u8 *, size_t);
74 76
75#define CRC_A_INIT 0x6363 77#define CRC_A_INIT 0x6363
76#define CRC_B_INIT 0xFFFF 78#define CRC_B_INIT 0xFFFF
79#define CRC_F_INIT 0x0000
77 80
78void digital_skb_add_crc(struct sk_buff *skb, crc_func_t crc_func, u16 init, 81void digital_skb_add_crc(struct sk_buff *skb, crc_func_t crc_func, u16 init,
79 u8 bitwise_inv, u8 msb_first); 82 u8 bitwise_inv, u8 msb_first);
@@ -88,6 +91,11 @@ static inline void digital_skb_add_crc_b(struct sk_buff *skb)
88 digital_skb_add_crc(skb, crc_ccitt, CRC_B_INIT, 1, 0); 91 digital_skb_add_crc(skb, crc_ccitt, CRC_B_INIT, 1, 0);
89} 92}
90 93
94static inline void digital_skb_add_crc_f(struct sk_buff *skb)
95{
96 digital_skb_add_crc(skb, crc_itu_t, CRC_F_INIT, 0, 1);
97}
98
91static inline void digital_skb_add_crc_none(struct sk_buff *skb) 99static inline void digital_skb_add_crc_none(struct sk_buff *skb)
92{ 100{
93 return; 101 return;
@@ -106,6 +114,11 @@ static inline int digital_skb_check_crc_b(struct sk_buff *skb)
106 return digital_skb_check_crc(skb, crc_ccitt, CRC_B_INIT, 1, 0); 114 return digital_skb_check_crc(skb, crc_ccitt, CRC_B_INIT, 1, 0);
107} 115}
108 116
117static inline int digital_skb_check_crc_f(struct sk_buff *skb)
118{
119 return digital_skb_check_crc(skb, crc_itu_t, CRC_F_INIT, 0, 1);
120}
121
109static inline int digital_skb_check_crc_none(struct sk_buff *skb) 122static inline int digital_skb_check_crc_none(struct sk_buff *skb)
110{ 123{
111 return 0; 124 return 0;