blob: bdf78ffd5bb749a22e980838b03cb6c8ecc9290b [file] [log] [blame]
Christophe Ricard35630df2014-05-25 22:35:38 +02001/*
2 * NCI based Driver for STMicroelectronics NFC Chip
3 *
Christophe Ricarded06aeef2015-06-09 22:26:05 +02004 * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved.
Christophe Ricard35630df2014-05-25 22:35:38 +02005 *
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
19#ifndef __LOCAL_NDLC_H_
20#define __LOCAL_NDLC_H_
21
22#include <linux/skbuff.h>
23#include <net/nfc/nfc.h>
24
Christophe Ricard3648dc62015-10-25 22:54:39 +010025struct st_nci_se_status;
26
Christophe Ricard35630df2014-05-25 22:35:38 +020027/* Low Level Transport description */
28struct llt_ndlc {
29 struct nci_dev *ndev;
30 struct nfc_phy_ops *ops;
31 void *phy_id;
32
33 struct timer_list t1_timer;
34 bool t1_active;
35
36 struct timer_list t2_timer;
37 bool t2_active;
38
39 struct sk_buff_head rcv_q;
40 struct sk_buff_head send_q;
41 struct sk_buff_head ack_pending_q;
42
43 struct work_struct sm_work;
44
45 struct device *dev;
46
Christophe Ricard4294e322014-09-13 10:28:47 +020047 /*
Christophe Ricarded06aeef2015-06-09 22:26:05 +020048 * < 0 if hardware error occurred
Christophe Ricard4294e322014-09-13 10:28:47 +020049 * and prevents normal operation.
50 */
Christophe Ricard35630df2014-05-25 22:35:38 +020051 int hard_fault;
Christophe Ricard183fe2d2015-06-06 13:16:50 +020052 int powered;
Christophe Ricard35630df2014-05-25 22:35:38 +020053};
54
55int ndlc_open(struct llt_ndlc *ndlc);
56void ndlc_close(struct llt_ndlc *ndlc);
57int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb);
58void ndlc_recv(struct llt_ndlc *ndlc, struct sk_buff *skb);
59int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev,
Christophe Ricard3648dc62015-10-25 22:54:39 +010060 int phy_headroom, int phy_tailroom, struct llt_ndlc **ndlc_id,
61 struct st_nci_se_status *se_status);
Christophe Ricard35630df2014-05-25 22:35:38 +020062void ndlc_remove(struct llt_ndlc *ndlc);
63#endif /* __LOCAL_NDLC_H__ */