blob: 4eeb5e40702fe97a60a32ee8f227b0097a7a5f6f [file] [log] [blame]
Lukasz Majewski1d4a0b62012-08-06 14:41:05 +02001/*
2 * Copyright (C) 2012 Samsung Electronics
3 * Lukasz Majewski <l.majewski@samsung.com>
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Lukasz Majewski1d4a0b62012-08-06 14:41:05 +02006 */
7
8#ifndef __G_DOWNLOAD_H_
9#define __G_DOWNLOAD_H_
10
11#include <linux/usb/ch9.h>
Lukasz Majewski1d4a0b62012-08-06 14:41:05 +020012#include <linux/usb/gadget.h>
Mateusz Zalegac4d0e852014-04-28 21:13:28 +020013#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
28typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
29
30/* used in Gadget downloader callback linker list */
31struct g_dnl_bind_callback {
32 const char *usb_function_name;
33 g_dnl_bind_callback_f fptr;
34};
35
Lukasz Majewskid6eae7b2013-10-08 14:30:41 +020036int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
Mateusz Zalega75504e92014-04-30 13:07:48 +020037int g_dnl_board_usb_cable_connected(void);
Lukasz Majewski1d4a0b62012-08-06 14:41:05 +020038int g_dnl_register(const char *s);
39void g_dnl_unregister(void);
Heiko Schocherec9002e2013-11-04 14:05:01 +010040void g_dnl_set_serialnumber(char *);
Lukasz Majewski1d4a0b62012-08-06 14:41:05 +020041
Rob Herringfe1b28c2014-12-10 14:43:03 -060042bool g_dnl_detach(void);
43void g_dnl_trigger_detach(void);
44void g_dnl_clear_detach(void);
45
Lukasz Majewski1d4a0b62012-08-06 14:41:05 +020046#endif /* __G_DOWNLOAD_H_ */