st-nci_se.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Secure Element Driver for STMicroelectronics NFC NCI Chip
  3. *
  4. * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __LOCAL_ST_NCI_SE_H_
  19. #define __LOCAL_ST_NCI_SE_H_
  20. /*
  21. * ref ISO7816-3 chap 8.1. the initial character TS is followed by a
  22. * sequence of at most 32 characters.
  23. */
  24. #define ST_NCI_ESE_MAX_LENGTH 33
  25. #define ST_NCI_HCI_HOST_ID_ESE 0xc0
  26. struct st_nci_se_info {
  27. u8 atr[ST_NCI_ESE_MAX_LENGTH];
  28. struct completion req_completion;
  29. struct timer_list bwi_timer;
  30. int wt_timeout; /* in msecs */
  31. bool bwi_active;
  32. struct timer_list se_active_timer;
  33. bool se_active;
  34. bool xch_error;
  35. se_io_cb_t cb;
  36. void *cb_context;
  37. };
  38. int st_nci_se_init(struct nci_dev *ndev);
  39. void st_nci_se_deinit(struct nci_dev *ndev);
  40. int st_nci_discover_se(struct nci_dev *ndev);
  41. int st_nci_enable_se(struct nci_dev *ndev, u32 se_idx);
  42. int st_nci_disable_se(struct nci_dev *ndev, u32 se_idx);
  43. int st_nci_se_io(struct nci_dev *ndev, u32 se_idx,
  44. u8 *apdu, size_t apdu_length,
  45. se_io_cb_t cb, void *cb_context);
  46. int st_nci_hci_load_session(struct nci_dev *ndev);
  47. void st_nci_hci_event_received(struct nci_dev *ndev, u8 pipe,
  48. u8 event, struct sk_buff *skb);
  49. void st_nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd,
  50. struct sk_buff *skb);
  51. #endif /* __LOCAL_ST_NCI_SE_H_ */