xref: /openbmc/u-boot/include/g_dnl.h (revision 6b44ae6b)
1 /*
2  *  Copyright (C) 2012 Samsung Electronics
3  *  Lukasz Majewski <l.majewski@samsung.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef __G_DOWNLOAD_H_
9 #define __G_DOWNLOAD_H_
10 
11 #include <linux/usb/ch9.h>
12 #include <linux/usb/gadget.h>
13 #include <linux/usb/composite.h>
14 #include <linker_lists.h>
15 
16 /*
17  * @usb_fname: unescaped USB function name
18  * @callback_ptr: bind callback, one per function name
19  */
20 #define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \
21 	ll_entry_declare(struct g_dnl_bind_callback, \
22 			__usb_function_name_##usb_fname, \
23 			g_dnl_bind_callbacks) = { \
24 				.usb_function_name = #usb_fname, \
25 				.fptr = callback_ptr \
26 			}
27 
28 typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
29 
30 /* used in Gadget downloader callback linker list */
31 struct g_dnl_bind_callback {
32 	const char *usb_function_name;
33 	g_dnl_bind_callback_f fptr;
34 };
35 
36 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
37 int g_dnl_get_board_bcd_device_number(int gcnum);
38 int g_dnl_board_usb_cable_connected(void);
39 int g_dnl_register(const char *s);
40 void g_dnl_unregister(void);
41 void g_dnl_set_serialnumber(char *);
42 
43 bool g_dnl_detach(void);
44 void g_dnl_trigger_detach(void);
45 void g_dnl_clear_detach(void);
46 
47 #endif /* __G_DOWNLOAD_H_ */
48