digital.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #ifndef __DIGITAL_H
  16. #define __DIGITAL_H
  17. #include <net/nfc/nfc.h>
  18. #include <net/nfc/digital.h>
  19. #define PR_DBG(fmt, ...) pr_debug("%s: " fmt "\n", __func__, ##__VA_ARGS__)
  20. #define PR_ERR(fmt, ...) pr_err("%s: " fmt "\n", __func__, ##__VA_ARGS__)
  21. #define PROTOCOL_ERR(req) pr_err("%s:%d: NFC Digital Protocol error: %s\n", \
  22. __func__, __LINE__, req)
  23. #define DIGITAL_CMD_IN_SEND 0
  24. #define DIGITAL_CMD_TG_SEND 1
  25. #define DIGITAL_CMD_TG_LISTEN 2
  26. #define DIGITAL_CMD_TG_LISTEN_MDAA 3
  27. #define DIGITAL_MAX_HEADER_LEN 7
  28. #define DIGITAL_CRC_LEN 2
  29. struct sk_buff *digital_skb_alloc(struct nfc_digital_dev *ddev,
  30. unsigned int len);
  31. int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type,
  32. struct sk_buff *skb, u16 timeout,
  33. nfc_digital_cmd_complete_t cmd_cb, void *cb_context);
  34. int digital_in_configure_hw(struct nfc_digital_dev *ddev, int type, int param);
  35. static inline int digital_in_send_cmd(struct nfc_digital_dev *ddev,
  36. struct sk_buff *skb, u16 timeout,
  37. nfc_digital_cmd_complete_t cmd_cb,
  38. void *cb_context)
  39. {
  40. return digital_send_cmd(ddev, DIGITAL_CMD_IN_SEND, skb, timeout, cmd_cb,
  41. cb_context);
  42. }
  43. void digital_poll_next_tech(struct nfc_digital_dev *ddev);
  44. int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech);
  45. #endif /* __DIGITAL_H */