xref: /openbmc/linux/net/nfc/hci/llc.h (revision bbecb07f)
1 /*
2  * Link Layer Control manager
3  *
4  * Copyright (C) 2012  Intel Corporation. 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 
19 #ifndef __LOCAL_LLC_H_
20 #define __LOCAL_LLC_H_
21 
22 #include <net/nfc/hci.h>
23 #include <net/nfc/llc.h>
24 #include <linux/skbuff.h>
25 
26 struct nfc_llc_ops {
27 	void *(*init) (struct nfc_hci_dev *hdev, xmit_to_drv_t xmit_to_drv,
28 		       rcv_to_hci_t rcv_to_hci, int tx_headroom,
29 		       int tx_tailroom, int *rx_headroom, int *rx_tailroom,
30 		       llc_failure_t llc_failure);
31 	void (*deinit) (struct nfc_llc *llc);
32 	int (*start) (struct nfc_llc *llc);
33 	int (*stop) (struct nfc_llc *llc);
34 	void (*rcv_from_drv) (struct nfc_llc *llc, struct sk_buff *skb);
35 	int (*xmit_from_hci) (struct nfc_llc *llc, struct sk_buff *skb);
36 };
37 
38 struct nfc_llc_engine {
39 	const char *name;
40 	struct nfc_llc_ops *ops;
41 	struct list_head entry;
42 };
43 
44 struct nfc_llc {
45 	void *data;
46 	struct nfc_llc_ops *ops;
47 	int rx_headroom;
48 	int rx_tailroom;
49 };
50 
51 void *nfc_llc_get_data(struct nfc_llc *llc);
52 
53 int nfc_llc_register(const char *name, struct nfc_llc_ops *ops);
54 void nfc_llc_unregister(const char *name);
55 
56 int nfc_llc_nop_register(void);
57 
58 #if defined(CONFIG_NFC_SHDLC)
59 int nfc_llc_shdlc_register(void);
60 #else
61 static inline int nfc_llc_shdlc_register(void)
62 {
63 	return 0;
64 }
65 #endif
66 
67 #endif /* __LOCAL_LLC_H_ */
68