forked from lhdjply/f1c200s_library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
usbh_msc_config.c
46 lines (38 loc) · 1.01 KB
/
usbh_msc_config.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "usbh_msc_config.h"
volatile bool mounted_flag;
USB_NOCACHE_RAM_SECTION struct usbh_msc * active_msc_class;
extern void USBH_IRQHandler(uint8_t busid);
static void My_USBH_IRQHandler(int irqno, void * param)
{
rt_interrupt_enter();
USBH_IRQHandler(0);
rt_interrupt_leave();
}
void usb_hc_low_level_init(struct usbh_bus * bus)
{
usb_phy_open_clock();
USBC_PhyConfig();
USBC_ConfigFIFO_Base();
USBC_EnableDpDmPullUp();
USBC_EnableIdPullUp();
USBC_ForceId(USBC_ID_TYPE_HOST);
USBC_ForceVbusValid(USBC_VBUS_TYPE_HIGH);
rt_hw_interrupt_install(USB_OTG_INTERRUPT, (rt_isr_handler_t)My_USBH_IRQHandler, NULL, "musb_irq");
rt_hw_interrupt_umask(USB_OTG_INTERRUPT);
}
void usb_disk_set_active_msc_class(void * ptr)
{
active_msc_class = (struct usbh_msc *)ptr;
}
void usbh_msc_run(struct usbh_msc * msc_class)
{
if(msc_class != NULL)
{
usb_disk_set_active_msc_class((void *)msc_class);
mounted_flag = true;
}
}
void usbh_msc_stop(struct usbh_msc * msc_class)
{
mounted_flag = false;
}