]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - net/nfc/digital.h
NFC Digital: Implement driver commands mechanism
[mirror_ubuntu-bionic-kernel.git] / net / nfc / digital.h
CommitLineData
4b10884e
TE
1/*
2 * NFC Digital Protocol stack
3 * Copyright (c) 2013, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#ifndef __DIGITAL_H
17#define __DIGITAL_H
18
19#include <net/nfc/nfc.h>
20#include <net/nfc/digital.h>
21
22#define PR_DBG(fmt, ...) pr_debug("%s: " fmt "\n", __func__, ##__VA_ARGS__)
23#define PR_ERR(fmt, ...) pr_err("%s: " fmt "\n", __func__, ##__VA_ARGS__)
24#define PROTOCOL_ERR(req) pr_err("%s:%d: NFC Digital Protocol error: %s\n", \
25 __func__, __LINE__, req)
26
59ee2361
TE
27#define DIGITAL_CMD_IN_SEND 0
28#define DIGITAL_CMD_TG_SEND 1
29#define DIGITAL_CMD_TG_LISTEN 2
30#define DIGITAL_CMD_TG_LISTEN_MDAA 3
31
32#define DIGITAL_MAX_HEADER_LEN 7
33#define DIGITAL_CRC_LEN 2
34
35struct sk_buff *digital_skb_alloc(struct nfc_digital_dev *ddev,
36 unsigned int len);
37
38int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type,
39 struct sk_buff *skb, u16 timeout,
40 nfc_digital_cmd_complete_t cmd_cb, void *cb_context);
41
42int digital_in_configure_hw(struct nfc_digital_dev *ddev, int type, int param);
43static inline int digital_in_send_cmd(struct nfc_digital_dev *ddev,
44 struct sk_buff *skb, u16 timeout,
45 nfc_digital_cmd_complete_t cmd_cb,
46 void *cb_context)
47{
48 return digital_send_cmd(ddev, DIGITAL_CMD_IN_SEND, skb, timeout, cmd_cb,
49 cb_context);
50}
51
52void digital_poll_next_tech(struct nfc_digital_dev *ddev);
53
54int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech);
55
4b10884e 56#endif /* __DIGITAL_H */