summaryrefslogtreecommitdiff
path: root/tinyusb/host
diff options
context:
space:
mode:
Diffstat (limited to 'tinyusb/host')
-rw-r--r--tinyusb/host/ehci/ehci.c11
-rw-r--r--tinyusb/host/ehci/ehci.h1
-rw-r--r--tinyusb/host/usbh.c6
3 files changed, 11 insertions, 7 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 078cf6261..d570b18eb 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -232,6 +232,7 @@ void hcd_isr(uint8_t hostid)
if (int_status & EHCI_INT_MASK_ERROR)
{
// TODO something going wrong
+ ASM_BREAKPOINT;
}
//------------- some QTD/SITD/ITD with IOC set is completed -------------//
@@ -247,10 +248,8 @@ void hcd_isr(uint8_t hostid)
if (int_status & EHCI_INT_MASK_PORT_CHANGE)
{
- printf("%s %d\n", __PRETTY_FUNCTION__, __LINE__);
if (regs->portsc_bit.connect_status_change)
{
- printf("%s %d\n", __PRETTY_FUNCTION__, __LINE__);
port_connect_status_isr(hostid);
}
@@ -278,11 +277,10 @@ tusb_error_t hcd_controller_init(uint8_t hostid)
regs->usb_sts = EHCI_INT_MASK_ALL; // 2. clear all status
regs->usb_int_enable =
EHCI_INT_MASK_ERROR | EHCI_INT_MASK_PORT_CHANGE
- | EHCI_INT_MASK_ASYNC_ADVANCE | EHCI_INT_MASK_NXP_ASYNC
#if EHCI_PERIODIC_LIST
| EHCI_INT_MASK_NXP_PERIODIC
#endif
- ;
+ | EHCI_INT_MASK_ASYNC_ADVANCE | EHCI_INT_MASK_NXP_ASYNC;
//------------- Asynchronous List -------------//
ehci_qhd_t * const async_head = get_async_head(hostid);
@@ -292,6 +290,7 @@ tusb_error_t hcd_controller_init(uint8_t hostid)
async_head->next.type = EHCI_QUEUE_ELEMENT_QHD;
async_head->head_list_flag = 1;
async_head->qtd_overlay.halted = 1; // inactive most of time
+ async_head->qtd_overlay.next.terminate = 1; // TODO removed if verified
regs->async_list_base = (uint32_t) async_head;
@@ -321,7 +320,7 @@ tusb_error_t hcd_controller_init(uint8_t hostid)
//------------- USB CMD Register -------------//
- regs->usb_cmd = BIT_(EHCI_USBCMD_POS_ASYNC_ENABLE)
+ regs->usb_cmd |= BIT_(EHCI_USBCMD_POS_RUN_STOP) | BIT_(EHCI_USBCMD_POS_ASYNC_ENABLE)
#if EHCI_PERIODIC_LIST
| BIT_(EHCI_USBCMD_POS_PERIOD_ENABLE)
#endif
@@ -330,6 +329,8 @@ tusb_error_t hcd_controller_init(uint8_t hostid)
//------------- ConfigFlag Register (skip) -------------//
+ regs->portsc_bit.port_power = 1; // enable port power
+
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h
index bceb78e74..f631e89ec 100644
--- a/tinyusb/host/ehci/ehci.h
+++ b/tinyusb/host/ehci/ehci.h
@@ -320,6 +320,7 @@ enum ehci_interrupt_mask_{
};
enum ehci_usbcmd_pos_ {
+ EHCI_USBCMD_POS_RUN_STOP = 0,
EHCI_USBCMD_POS_FRAMELIST_SZIE = 2,
EHCI_USBCMD_POS_PERIOD_ENABLE = 4,
EHCI_USBCMD_POS_ASYNC_ENABLE = 5,
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 05234aadc..b7deaee84 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -171,7 +171,7 @@ void usbh_isr(pipe_handle_t pipe_hdl, uint8_t class_code)
{
if (class_code == 0) // Control transfer
{
- // TODO some semaphore posting
+ osal_semaphore_post( usbh_device_info_pool[ pipe_hdl.dev_addr ].sem_hdl );
}else if (usbh_class_drivers[class_code].isr)
{
usbh_class_drivers[class_code].isr(pipe_hdl);
@@ -183,7 +183,9 @@ void usbh_isr(pipe_handle_t pipe_hdl, uint8_t class_code)
void usbh_device_plugged_isr(uint8_t hostid, tusb_speed_t speed)
{
-
+ osal_queue_send(enum_queue_hdl,
+ *( (uint32_t*) ( &(usbh_enumerate_t){ .core_id = hostid, .speed = speed} ) )
+ );
}
void usbh_device_unplugged_isr(uint8_t hostid)