summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-05-22 21:45:34 +0700
committerhathach <[email protected]>2020-05-22 21:45:34 +0700
commitd108ea4326d824da73da0a4f9632c5da6aa2e3ec (patch)
treec1dab18adf3655e305a4d5a7d1f878e246244ce3 /src
parent4c01099a3d6e92404c645e5c906968955a6c9b1a (diff)
implement hcd_uframe_number for ohci
able to get 8 byte descriptors using LPC1769 + base, but failed to reset and set address.
Diffstat (limited to 'src')
-rw-r--r--src/host/ohci/ohci.c15
-rw-r--r--src/host/ohci/ohci.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/host/ohci/ohci.c b/src/host/ohci/ohci.c
index 547622edf..5ee5fe8c4 100644
--- a/src/host/ohci/ohci.c
+++ b/src/host/ohci/ohci.c
@@ -166,7 +166,7 @@ bool hcd_init(void)
OHCI_REG->interrupt_disable = OHCI_REG->interrupt_enable; // disable all interrupts
OHCI_REG->interrupt_status = OHCI_REG->interrupt_status; // clear current set bits
OHCI_REG->interrupt_enable = OHCI_INT_WRITEBACK_DONEHEAD_MASK | OHCI_INT_RESUME_DETECTED_MASK |
- OHCI_INT_UNRECOVERABLE_ERROR_MASK | /*OHCI_INT_FRAME_OVERFLOW_MASK |*/ OHCI_INT_RHPORT_STATUS_CHANGE_MASK |
+ OHCI_INT_UNRECOVERABLE_ERROR_MASK | OHCI_INT_FRAME_OVERFLOW_MASK | OHCI_INT_RHPORT_STATUS_CHANGE_MASK |
OHCI_INT_MASTER_ENABLE_MASK;
OHCI_REG->control |= OHCI_CONTROL_CONTROL_BULK_RATIO | OHCI_CONTROL_LIST_CONTROL_ENABLE_MASK |
@@ -181,6 +181,13 @@ bool hcd_init(void)
return true;
}
+uint32_t hcd_uframe_number(uint8_t rhport)
+{
+ (void) rhport;
+ return (ohci_data.frame_number_hi << 16 | OHCI_REG->frame_number) << 3;
+}
+
+
//--------------------------------------------------------------------+
// PORT API
//--------------------------------------------------------------------+
@@ -606,6 +613,12 @@ void hcd_isr(uint8_t hostid)
if (int_status == 0) return;
+ // Frame number overflow
+ if ( int_status & OHCI_INT_FRAME_OVERFLOW_MASK )
+ {
+ ohci_data.frame_number_hi++;
+ }
+
//------------- RootHub status -------------//
if ( int_status & OHCI_INT_RHPORT_STATUS_CHANGE_MASK )
{
diff --git a/src/host/ohci/ohci.h b/src/host/ohci/ohci.h
index 6f6ef9676..bfcdaf9a3 100644
--- a/src/host/ohci/ohci.h
+++ b/src/host/ohci/ohci.h
@@ -180,6 +180,8 @@ typedef struct TU_ATTR_ALIGNED(256)
ohci_ed_t ed_pool[HCD_MAX_ENDPOINT];
ohci_gtd_t gtd_pool[HCD_MAX_XFER];
+ volatile uint16_t frame_number_hi;
+
} ohci_data_t;
//--------------------------------------------------------------------+