summaryrefslogtreecommitdiffstats
path: root/net/nfc/digital.h
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2013-09-19 17:55:28 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-25 02:02:25 +0200
commit8c0695e4998dd268ff2a05951961247b7e015651 (patch)
tree86087518d7435dbe788647ee04be2b460bab0ee8 /net/nfc/digital.h
parent2c66daecc4092e6049673c281b2e6f0d5e59a94c (diff)
downloadop-kernel-dev-8c0695e4998dd268ff2a05951961247b7e015651.zip
op-kernel-dev-8c0695e4998dd268ff2a05951961247b7e015651.tar.gz
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 fb5324b..85bc74c 100644
--- a/net/nfc/digital.h
+++ b/net/nfc/digital.h
@@ -20,6 +20,7 @@
#include <net/nfc/digital.h>
#include <linux/crc-ccitt.h>
+#include <linux/crc-itu-t.h>
#define PR_DBG(fmt, ...) pr_debug("%s: " fmt "\n", __func__, ##__VA_ARGS__)
#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,
void digital_poll_next_tech(struct nfc_digital_dev *ddev);
int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech);
+int digital_in_send_sensf_req(struct nfc_digital_dev *ddev, u8 rf_tech);
int digital_target_found(struct nfc_digital_dev *ddev,
struct nfc_target *target, u8 protocol);
@@ -74,6 +76,7 @@ typedef u16 (*crc_func_t)(u16, const u8 *, size_t);
#define CRC_A_INIT 0x6363
#define CRC_B_INIT 0xFFFF
+#define CRC_F_INIT 0x0000
void digital_skb_add_crc(struct sk_buff *skb, crc_func_t crc_func, u16 init,
u8 bitwise_inv, u8 msb_first);
@@ -88,6 +91,11 @@ static inline void digital_skb_add_crc_b(struct sk_buff *skb)
digital_skb_add_crc(skb, crc_ccitt, CRC_B_INIT, 1, 0);
}
+static inline void digital_skb_add_crc_f(struct sk_buff *skb)
+{
+ digital_skb_add_crc(skb, crc_itu_t, CRC_F_INIT, 0, 1);
+}
+
static inline void digital_skb_add_crc_none(struct sk_buff *skb)
{
return;
@@ -106,6 +114,11 @@ static inline int digital_skb_check_crc_b(struct sk_buff *skb)
return digital_skb_check_crc(skb, crc_ccitt, CRC_B_INIT, 1, 0);
}
+static inline int digital_skb_check_crc_f(struct sk_buff *skb)
+{
+ return digital_skb_check_crc(skb, crc_itu_t, CRC_F_INIT, 0, 1);
+}
+
static inline int digital_skb_check_crc_none(struct sk_buff *skb)
{
return 0;
OpenPOWER on IntegriCloud