diff options
| author | hathach <[email protected]> | 2013-05-06 20:51:34 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-05-06 20:51:34 +0700 |
| commit | 861f02943dabf23b5b87d9f94d3eb167e9fb5f10 (patch) | |
| tree | e54dd02c10690ac402c6ea66170e60ff53aa948f /tinyusb/host | |
| parent | 41fee0f48833d7305612aede26d4d59bb216387d (diff) | |
add log2_of and use this function in get_period_head
Diffstat (limited to 'tinyusb/host')
| -rw-r--r-- | tinyusb/host/ehci/ehci.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index 127b9bb0b..43dae3235 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -711,10 +711,8 @@ STATIC_ INLINE_ ehci_qhd_t* get_async_head(uint8_t hostid) STATIC_ INLINE_ ehci_link_t* get_period_head(uint8_t hostid, uint8_t interval_ms) { - return (ehci_link_t*) (ehci_data.period_head_arr[ hostid_to_data_idx(hostid) ] + - (interval_ms < 2 ? 0 : - interval_ms < 4 ? 1 : - interval_ms < EHCI_FRAMELIST_SIZE ? 2 : 3)); + return (ehci_link_t*) (&ehci_data.period_head_arr[ hostid_to_data_idx(hostid) ] + [ log2_of( min8_of(EHCI_FRAMELIST_SIZE, interval_ms) ) ] ); } STATIC_ INLINE_ ehci_qhd_t* get_control_qhd(uint8_t dev_addr) |
