xref: /linux/drivers/nfc/st-nci/ndlc.h (revision 6fdcba32711044c35c0e1b094cbd8f3f0b4472c9)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * NCI based Driver for STMicroelectronics NFC Chip
4  *
5  * Copyright (C) 2014-2015  STMicroelectronics SAS. All rights reserved.
6  */
7 
8 #ifndef __LOCAL_NDLC_H_
9 #define __LOCAL_NDLC_H_
10 
11 #include <linux/skbuff.h>
12 #include <net/nfc/nfc.h>
13 
14 struct st_nci_se_status;
15 
16 /* Low Level Transport description */
17 struct llt_ndlc {
18 	struct nci_dev *ndev;
19 	struct nfc_phy_ops *ops;
20 	void *phy_id;
21 
22 	struct timer_list t1_timer;
23 	bool t1_active;
24 
25 	struct timer_list t2_timer;
26 	bool t2_active;
27 
28 	struct sk_buff_head rcv_q;
29 	struct sk_buff_head send_q;
30 	struct sk_buff_head ack_pending_q;
31 
32 	struct work_struct sm_work;
33 
34 	struct device *dev;
35 
36 	/*
37 	 * < 0 if hardware error occurred
38 	 * and prevents normal operation.
39 	 */
40 	int hard_fault;
41 	int powered;
42 };
43 
44 int ndlc_open(struct llt_ndlc *ndlc);
45 void ndlc_close(struct llt_ndlc *ndlc);
46 int ndlc_send(struct llt_ndlc *ndlc, struct sk_buff *skb);
47 void ndlc_recv(struct llt_ndlc *ndlc, struct sk_buff *skb);
48 int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev,
49 	       int phy_headroom, int phy_tailroom, struct llt_ndlc **ndlc_id,
50 	       struct st_nci_se_status *se_status);
51 void ndlc_remove(struct llt_ndlc *ndlc);
52 #endif /* __LOCAL_NDLC_H__ */
53