xref: /openbmc/linux/net/nfc/hci/llc.h (revision e23feb16)
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, write to the
17  * Free Software Foundation, Inc.,
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef __LOCAL_LLC_H_
22 #define __LOCAL_LLC_H_
23 
24 #include <net/nfc/hci.h>
25 #include <net/nfc/llc.h>
26 #include <linux/skbuff.h>
27 
28 struct nfc_llc_ops {
29 	void *(*init) (struct nfc_hci_dev *hdev, xmit_to_drv_t xmit_to_drv,
30 		       rcv_to_hci_t rcv_to_hci, int tx_headroom,
31 		       int tx_tailroom, int *rx_headroom, int *rx_tailroom,
32 		       llc_failure_t llc_failure);
33 	void (*deinit) (struct nfc_llc *llc);
34 	int (*start) (struct nfc_llc *llc);
35 	int (*stop) (struct nfc_llc *llc);
36 	void (*rcv_from_drv) (struct nfc_llc *llc, struct sk_buff *skb);
37 	int (*xmit_from_hci) (struct nfc_llc *llc, struct sk_buff *skb);
38 };
39 
40 struct nfc_llc_engine {
41 	const char *name;
42 	struct nfc_llc_ops *ops;
43 	struct list_head entry;
44 };
45 
46 struct nfc_llc {
47 	void *data;
48 	struct nfc_llc_ops *ops;
49 	int rx_headroom;
50 	int rx_tailroom;
51 };
52 
53 void *nfc_llc_get_data(struct nfc_llc *llc);
54 
55 int nfc_llc_register(const char *name, struct nfc_llc_ops *ops);
56 void nfc_llc_unregister(const char *name);
57 
58 int nfc_llc_nop_register(void);
59 
60 #if defined(CONFIG_NFC_SHDLC)
61 int nfc_llc_shdlc_register(void);
62 #else
63 static inline int nfc_llc_shdlc_register(void)
64 {
65 	return 0;
66 }
67 #endif
68 
69 #endif /* __LOCAL_LLC_H_ */
70