aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/digital.h
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2013-09-19 11:55:30 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-24 20:02:28 -0400
commit1c7a4c24fbfd99442cc6e14dc80fcb00f118e8b8 (patch)
treed8115482922f1d4b5c7da4a6aa76faca7f77c032 /net/nfc/digital.h
parent7d0911c02fa2a448a28d7844d2a0c439ff8397b1 (diff)
NFC Digital: Add target NFC-DEP support
This adds support for NFC-DEP target mode for NFC-A and NFC-F technologies. If the driver provides it, the stack uses an automatic mode for technology detection and automatic anti-collision. Otherwise the stack tries to use non-automatic synchronization and listens for SENS_REQ and SENSF_REQ commands. The detection, activation, and data exchange procedures work exactly the same way as in initiator mode, as described in the previous commits, except that the digital stack waits for commands and sends responses back to the peer device. 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.h39
1 files changed, 35 insertions, 4 deletions
diff --git a/net/nfc/digital.h b/net/nfc/digital.h
index 5254a872522b..586075a3feed 100644
--- a/net/nfc/digital.h
+++ b/net/nfc/digital.h
@@ -56,8 +56,9 @@ struct sk_buff *digital_skb_alloc(struct nfc_digital_dev *ddev,
56 unsigned int len); 56 unsigned int len);
57 57
58int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type, 58int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type,
59 struct sk_buff *skb, u16 timeout, 59 struct sk_buff *skb, struct digital_tg_mdaa_params *params,
60 nfc_digital_cmd_complete_t cmd_cb, void *cb_context); 60 u16 timeout, nfc_digital_cmd_complete_t cmd_cb,
61 void *cb_context);
61 62
62int digital_in_configure_hw(struct nfc_digital_dev *ddev, int type, int param); 63int digital_in_configure_hw(struct nfc_digital_dev *ddev, int type, int param);
63static inline int digital_in_send_cmd(struct nfc_digital_dev *ddev, 64static inline int digital_in_send_cmd(struct nfc_digital_dev *ddev,
@@ -65,8 +66,8 @@ static inline int digital_in_send_cmd(struct nfc_digital_dev *ddev,
65 nfc_digital_cmd_complete_t cmd_cb, 66 nfc_digital_cmd_complete_t cmd_cb,
66 void *cb_context) 67 void *cb_context)
67{ 68{
68 return digital_send_cmd(ddev, DIGITAL_CMD_IN_SEND, skb, timeout, cmd_cb, 69 return digital_send_cmd(ddev, DIGITAL_CMD_IN_SEND, skb, NULL, timeout,
69 cb_context); 70 cmd_cb, cb_context);
70} 71}
71 72
72void digital_poll_next_tech(struct nfc_digital_dev *ddev); 73void digital_poll_next_tech(struct nfc_digital_dev *ddev);
@@ -86,6 +87,36 @@ int digital_in_send_dep_req(struct nfc_digital_dev *ddev,
86 struct nfc_target *target, struct sk_buff *skb, 87 struct nfc_target *target, struct sk_buff *skb,
87 struct digital_data_exch *data_exch); 88 struct digital_data_exch *data_exch);
88 89
90int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param);
91static inline int digital_tg_send_cmd(struct nfc_digital_dev *ddev,
92 struct sk_buff *skb, u16 timeout,
93 nfc_digital_cmd_complete_t cmd_cb, void *cb_context)
94{
95 return digital_send_cmd(ddev, DIGITAL_CMD_TG_SEND, skb, NULL, timeout,
96 cmd_cb, cb_context);
97}
98
99void digital_tg_recv_sens_req(struct nfc_digital_dev *ddev, void *arg,
100 struct sk_buff *resp);
101
102void digital_tg_recv_sensf_req(struct nfc_digital_dev *ddev, void *arg,
103 struct sk_buff *resp);
104
105static inline int digital_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
106 nfc_digital_cmd_complete_t cb, void *arg)
107{
108 return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN, NULL, NULL,
109 timeout, cb, arg);
110}
111
112void digital_tg_recv_atr_req(struct nfc_digital_dev *ddev, void *arg,
113 struct sk_buff *resp);
114
115int digital_tg_send_dep_res(struct nfc_digital_dev *ddev, struct sk_buff *skb);
116
117int digital_tg_listen_nfca(struct nfc_digital_dev *ddev, u8 rf_tech);
118int digital_tg_listen_nfcf(struct nfc_digital_dev *ddev, u8 rf_tech);
119
89typedef u16 (*crc_func_t)(u16, const u8 *, size_t); 120typedef u16 (*crc_func_t)(u16, const u8 *, size_t);
90 121
91#define CRC_A_INIT 0x6363 122#define CRC_A_INIT 0x6363