- InaboF407 working code
This commit is contained in:
parent
8ca9852915
commit
4df8912593
14
usb_driver.c
14
usb_driver.c
@ -132,6 +132,9 @@ void usbdrv_init_global_state() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------
|
||||||
|
|
||||||
|
|
||||||
#if defined(USB_STM32H7)
|
#if defined(USB_STM32H7)
|
||||||
#define TOCAL_VALUE (0x00)
|
#define TOCAL_VALUE (0x00)
|
||||||
#define TRDT_VALUE (0x05)
|
#define TRDT_VALUE (0x05)
|
||||||
@ -382,11 +385,10 @@ void usbdrv_initial_ep0_setup() {
|
|||||||
|
|
||||||
// addresses of specific DIEPTXF registers, addresses from the RM
|
// addresses of specific DIEPTXF registers, addresses from the RM
|
||||||
static uint32_t *USB_pDIEPTXF[4] = {
|
static uint32_t *USB_pDIEPTXF[4] = {
|
||||||
(uint32_t *)(USBG + 0x028), // DIEPTXF0
|
(uint32_t *)(((uint32_t)USBG) + 0x028), // DIEPTXF0
|
||||||
(uint32_t *)(USBG + 0x104), // DIEPTXF1
|
(uint32_t *)(((uint32_t)USBG) + 0x104), // DIEPTXF1
|
||||||
(uint32_t *)(USBG + 0x108), // DIEPTXF2
|
(uint32_t *)(((uint32_t)USBG) + 0x108), // DIEPTXF2
|
||||||
(uint32_t *)(USBG + 0x10C), // DIEPTXF3
|
(uint32_t *)(((uint32_t)USBG) + 0x10C), // DIEPTXF3
|
||||||
// TODO: HS USB controller has more endpoints
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// configure USB endpoint
|
// configure USB endpoint
|
||||||
@ -641,7 +643,7 @@ uint32_t usbdrv_arm_IN_endpoint(uint8_t ep, const uint8_t *data, uint16_t len) {
|
|||||||
|
|
||||||
// arm OUT endpoint
|
// arm OUT endpoint
|
||||||
uint32_t usbdrv_arm_OUT_endpoint(uint8_t ep, uint8_t size) {
|
uint32_t usbdrv_arm_OUT_endpoint(uint8_t ep, uint8_t size) {
|
||||||
// arm endpoint only if it was not armed before OR if it's the EP0 OUT which is always enabled, but responds NAK after a successful transfer
|
// arm endpoint only if it was not armed before
|
||||||
if (READ_BIT(USBOUTEP[ep].DOEPCTL, USB_OTG_DOEPCTL_EPENA)) {
|
if (READ_BIT(USBOUTEP[ep].DOEPCTL, USB_OTG_DOEPCTL_EPENA)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user