From 8c0695e4998dd268ff2a05951961247b7e015651 Mon Sep 17 00:00:00 2001 From: Thierry Escande Date: Thu, 19 Sep 2013 17:55:28 +0200 Subject: 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 Signed-off-by: Samuel Ortiz --- net/nfc/digital.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'net/nfc/digital.h') 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 @@ #include #include +#include #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; -- cgit