xref: /aosp_15_r20/external/flashrom/tests/usb_unittests.h (revision 0d6140be3aa665ecc836e8907834fcd3e3b018fc)
1 /*
2  * This file is part of the flashrom project.
3  *
4  * Copyright 2022 Google LLC
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
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 
16 /*
17  * This header provides a temporary solution to unblock build system
18  * work. The main goal is to remove unconditional dependency on libusb
19  * for unit tests. The dependency is still present, but now it is present
20  * only when it is needed and only when the header is present in the env.
21  *
22  * The contents of the file will be modified in a very near future.
23  */
24 
25 #ifndef _USB_UNITTESTS_H_
26 #define _USB_UNITTESTS_H_
27 
28 #if CONFIG_RAIDEN_DEBUG_SPI == 1 || CONFIG_DEDIPROG == 1 || CONFIG_CH341A_SPI == 1
29 
30 #include <libusb.h>
31 
32 #else
33 
34 struct libusb_context;
35 typedef struct libusb_context libusb_context;
36 
37 struct libusb_device_handle;
38 typedef struct libusb_device_handle libusb_device_handle;
39 
40 struct libusb_device_descriptor;
41 typedef struct libusb_device_descriptor libusb_device_descriptor;
42 
43 struct libusb_device;
44 typedef struct libusb_device libusb_device;
45 
46 struct libusb_config_descriptor;
47 typedef struct libusb_config_descriptor libusb_config_descriptor;
48 
49 struct libusb_interface;
50 typedef struct libusb_interface libusb_interface;
51 
52 struct libusb_interface_descriptor;
53 typedef struct libusb_interface_descriptor libusb_interface_descriptor;
54 
55 struct libusb_endpoint_descriptor;
56 typedef struct libusb_endpoint_descriptor libusb_endpoint_descriptor;
57 
58 struct libusb_transfer;
59 
60 #endif
61 
62 #endif /* _USB_UNITTESTS_H_ */
63