1 /*
2  * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef R_USB_DEVICE_H
8 #define R_USB_DEVICE_H
9 
10 /***********************************************************************************************************************
11  * Includes
12  **********************************************************************************************************************/
13 #include "bsp_api.h"
14 #include "r_usb_device_api.h"
15 #include "r_usb_device_cfg.h"
16 
17 /* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
18 FSP_HEADER
19 
20 /***********************************************************************************************************************
21  * Macro definitions
22  **********************************************************************************************************************/
23 
24 /**********************************************************************************************************************
25  * Typedef definitions
26  **********************************************************************************************************************/
27 
28 typedef struct st_usbd_instance_ctrl
29 {
30     uint32_t           open;
31     void             * p_reg;
32     usbd_cfg_t const * p_cfg;
33     void (* p_callback)(usbd_callback_arg_t * p_args);
34     usbd_callback_arg_t * p_callback_memory;
35     void const          * p_context;
36 } usbd_instance_ctrl_t;
37 
38 /**********************************************************************************************************************
39  * Exported global variables
40  **********************************************************************************************************************/
41 
42 fsp_err_t R_USBD_Open(usbd_ctrl_t * const p_api_ctrl, usbd_cfg_t const * const p_cfg);
43 fsp_err_t R_USBD_RemoteWakeup(usbd_ctrl_t * const p_api_ctrl);
44 fsp_err_t R_USBD_Connect(usbd_ctrl_t * const p_api_ctrl);
45 fsp_err_t R_USBD_Disconnect(usbd_ctrl_t * const p_api_ctrl);
46 fsp_err_t R_USBD_EdptOpen(usbd_ctrl_t * const p_api_ctrl, usbd_desc_endpoint_t const * p_ep_desc);
47 fsp_err_t R_USBD_EdptClose(usbd_ctrl_t * const p_api_ctrl, uint8_t ep_addr);
48 fsp_err_t R_USBD_XferStart(usbd_ctrl_t * const p_api_ctrl, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
49 fsp_err_t R_USBD_XferAbort(usbd_ctrl_t * const p_api_ctrl, uint8_t ep_addr);
50 fsp_err_t R_USBD_EdptStall(usbd_ctrl_t * const p_api_ctrl, uint8_t ep_addr);
51 fsp_err_t R_USBD_EdptClearStall(usbd_ctrl_t * const p_api_ctrl, uint8_t ep_addr);
52 fsp_err_t R_USBD_Close(usbd_ctrl_t * const p_api_ctrl);
53 
54 /* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
55 FSP_FOOTER
56 
57 #endif /* R_USB_DEVICE_H */
58