digital_technology.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #include "digital.h"
  16. #define DIGITAL_CMD_SENS_REQ 0x26
  17. #define DIGITAL_CMD_ALL_REQ 0x52
  18. #define DIGITAL_CMD_SEL_REQ_CL1 0x93
  19. #define DIGITAL_CMD_SEL_REQ_CL2 0x95
  20. #define DIGITAL_CMD_SEL_REQ_CL3 0x97
  21. #define DIGITAL_SDD_REQ_SEL_PAR 0x20
  22. #define DIGITAL_SDD_RES_CT 0x88
  23. #define DIGITAL_SDD_RES_LEN 5
  24. static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg,
  25. struct sk_buff *resp)
  26. {
  27. if (!IS_ERR(resp))
  28. dev_kfree_skb(resp);
  29. digital_poll_next_tech(ddev);
  30. }
  31. int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech)
  32. {
  33. struct sk_buff *skb;
  34. int rc;
  35. rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH,
  36. NFC_DIGITAL_RF_TECH_106A);
  37. if (rc)
  38. return rc;
  39. rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
  40. NFC_DIGITAL_FRAMING_NFCA_SHORT);
  41. if (rc)
  42. return rc;
  43. skb = digital_skb_alloc(ddev, 1);
  44. if (!skb)
  45. return -ENOMEM;
  46. *skb_put(skb, sizeof(u8)) = DIGITAL_CMD_SENS_REQ;
  47. rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sens_res, NULL);
  48. if (rc)
  49. kfree_skb(skb);
  50. return rc;
  51. }