1 /* 2 * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms and conditions of the GNU General Public License, 6 * version 2, as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 */ 16 17 #ifndef __ST21NFCA_SE_H 18 #define __ST21NFCA_SE_H 19 20 #include <linux/skbuff.h> 21 #include <linux/workqueue.h> 22 23 /* 24 * ref ISO7816-3 chap 8.1. the initial character TS is followed by a 25 * sequence of at most 32 characters. 26 */ 27 #define ST21NFCA_ESE_MAX_LENGTH 33 28 #define ST21NFCA_ESE_HOST_ID 0xc0 29 30 struct st21nfca_se_info { 31 u8 atr[ST21NFCA_ESE_MAX_LENGTH]; 32 struct completion req_completion; 33 34 struct timer_list bwi_timer; 35 int wt_timeout; /* in msecs */ 36 bool bwi_active; 37 38 struct timer_list se_active_timer; 39 bool se_active; 40 int expected_pipes; 41 int count_pipes; 42 43 bool xch_error; 44 45 se_io_cb_t cb; 46 void *cb_context; 47 }; 48 49 int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host, 50 u8 event, struct sk_buff *skb); 51 int st21nfca_apdu_reader_event_received(struct nfc_hci_dev *hdev, 52 u8 event, struct sk_buff *skb); 53 54 int st21nfca_hci_discover_se(struct nfc_hci_dev *hdev); 55 int st21nfca_hci_enable_se(struct nfc_hci_dev *hdev, u32 se_idx); 56 int st21nfca_hci_disable_se(struct nfc_hci_dev *hdev, u32 se_idx); 57 int st21nfca_hci_se_io(struct nfc_hci_dev *hdev, u32 se_idx, 58 u8 *apdu, size_t apdu_length, 59 se_io_cb_t cb, void *cb_context); 60 61 void st21nfca_se_init(struct nfc_hci_dev *hdev); 62 void st21nfca_se_deinit(struct nfc_hci_dev *hdev); 63 #endif /* __ST21NFCA_SE_H */ 64