mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 06:48:16 +00:00
trezorhal: add usb_deinit
This commit is contained in:
parent
b592a95fb1
commit
0e33357ee7
@ -71,12 +71,20 @@ int usb_init(const usb_dev_info_t *dev_info) {
|
|||||||
// Reset the iface state map
|
// Reset the iface state map
|
||||||
memset(&usb_ifaces, 0, sizeof(usb_ifaces));
|
memset(&usb_ifaces, 0, sizeof(usb_ifaces));
|
||||||
|
|
||||||
USBD_Init(&usb_dev_handle, (USBD_DescriptorsTypeDef*)&usb_descriptors, USB_PHY_FS_ID);
|
if (0 != USBD_Init(&usb_dev_handle, (USBD_DescriptorsTypeDef*)&usb_descriptors, USB_PHY_FS_ID)) {
|
||||||
USBD_RegisterClass(&usb_dev_handle, (USBD_ClassTypeDef*)&usb_class);
|
return 1;
|
||||||
|
}
|
||||||
|
if (0 != USBD_RegisterClass(&usb_dev_handle, (USBD_ClassTypeDef*)&usb_class)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int usb_deinit(void) {
|
||||||
|
return USBD_DeInit(&usb_dev_handle);
|
||||||
|
}
|
||||||
|
|
||||||
int usb_start(void) {
|
int usb_start(void) {
|
||||||
return USBD_Start(&usb_dev_handle);
|
return USBD_Start(&usb_dev_handle);
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ typedef struct {
|
|||||||
} usb_iface_t;
|
} usb_iface_t;
|
||||||
|
|
||||||
int usb_init(const usb_dev_info_t *dev_info);
|
int usb_init(const usb_dev_info_t *dev_info);
|
||||||
|
int usb_deinit(void);
|
||||||
int usb_start(void);
|
int usb_start(void);
|
||||||
int usb_stop(void);
|
int usb_stop(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user