]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/nfc/st-nci/st-nci_se.h
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[karo-tx-linux.git] / drivers / nfc / st-nci / st-nci_se.h
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 /*
22  * ref ISO7816-3 chap 8.1. the initial character TS is followed by a
23  * sequence of at most 32 characters.
24  */
25 #define ST_NCI_ESE_MAX_LENGTH   33
26 #define ST_NCI_HCI_HOST_ID_ESE  0xc0
27
28 struct st_nci_se_info {
29         u8 atr[ST_NCI_ESE_MAX_LENGTH];
30         struct completion req_completion;
31
32         struct timer_list bwi_timer;
33         int wt_timeout; /* in msecs */
34         bool bwi_active;
35
36         struct timer_list se_active_timer;
37         bool se_active;
38
39         bool xch_error;
40
41         se_io_cb_t cb;
42         void *cb_context;
43 };
44
45 int st_nci_se_init(struct nci_dev *ndev);
46 void st_nci_se_deinit(struct nci_dev *ndev);
47
48 int st_nci_discover_se(struct nci_dev *ndev);
49 int st_nci_enable_se(struct nci_dev *ndev, u32 se_idx);
50 int st_nci_disable_se(struct nci_dev *ndev, u32 se_idx);
51 int st_nci_se_io(struct nci_dev *ndev, u32 se_idx,
52                 u8 *apdu, size_t apdu_length,
53                 se_io_cb_t cb, void *cb_context);
54 int st_nci_hci_load_session(struct nci_dev *ndev);
55 void st_nci_hci_event_received(struct nci_dev *ndev, u8 pipe,
56                         u8 event, struct sk_buff *skb);
57 void st_nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd,
58                         struct sk_buff *skb);
59
60
61 #endif /* __LOCAL_ST_NCI_SE_H_ */