diff options
| author | hathach <[email protected]> | 2013-03-12 12:06:40 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-03-12 12:06:40 +0700 |
| commit | 453ea3986563c11c74ab3bf9d773a90458635ede (patch) | |
| tree | 458c107257cb73cfcdb5b77aa2ef7131e19dbdd8 /tinyusb/host | |
| parent | 38ff7123b4f43aa85ce1848a0cb99bb73303cadd (diff) | |
add project file for keil
fix binary.h compiler specific
add hal_init code to reset & set usbmode --> able to get USB ISR
remove const qualifier from return function of
- get_operational_register
- get_period_frame_list
- get_async_head
- get_period_head
- get_control_qhd
add stub for
- hcd_port_connect_status
- hcd_port_speed
Diffstat (limited to 'tinyusb/host')
| -rw-r--r-- | tinyusb/host/ehci/ehci.c | 43 | ||||
| -rw-r--r-- | tinyusb/host/ehci/ehci.h | 3 | ||||
| -rw-r--r-- | tinyusb/host/hcd.h | 1 | ||||
| -rw-r--r-- | tinyusb/host/usbh.c | 9 | ||||
| -rw-r--r-- | tinyusb/host/usbh.h | 12 |
5 files changed, 44 insertions, 24 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index faabb4a55..2fefed23e 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -71,14 +71,14 @@ STATIC_ASSERT( ALIGN_OF(period_frame_list1) == 4096, "Period Framelist must be 4 //--------------------------------------------------------------------+ // IMPLEMENTATION //--------------------------------------------------------------------+ -STATIC_ INLINE_ ehci_registers_t* const get_operational_register(uint8_t hostid) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; -STATIC_ INLINE_ ehci_registers_t* const get_operational_register(uint8_t hostid) +STATIC_ INLINE_ ehci_registers_t* get_operational_register(uint8_t hostid) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; +STATIC_ INLINE_ ehci_registers_t* get_operational_register(uint8_t hostid) { - return (ehci_registers_t* const) (hostid ? (&LPC_USB1->USBCMD_H) : (&LPC_USB0->USBCMD_H) ); + return (ehci_registers_t*) (hostid ? (&LPC_USB1->USBCMD_H) : (&LPC_USB0->USBCMD_H) ); } -STATIC_ INLINE_ ehci_link_t* const get_period_frame_list(uint8_t list_idx) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; -STATIC_ INLINE_ ehci_link_t* const get_period_frame_list(uint8_t list_idx) +STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t list_idx) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; +STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t list_idx) { #if CONTROLLER_HOST_NUMBER > 1 return list_idx ? period_frame_list1 : period_frame_list0; // TODO more than 2 controller @@ -98,14 +98,14 @@ STATIC_ INLINE_ uint8_t hostid_to_data_idx(uint8_t hostid) #endif } -STATIC_ INLINE_ ehci_qhd_t* const get_async_head(uint8_t hostid) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT; -STATIC_ INLINE_ ehci_qhd_t* const get_async_head(uint8_t hostid) +STATIC_ INLINE_ ehci_qhd_t* get_async_head(uint8_t hostid) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT; +STATIC_ INLINE_ ehci_qhd_t* get_async_head(uint8_t hostid) { return &ehci_data.async_head[ hostid_to_data_idx(hostid) ]; } -STATIC_ INLINE_ ehci_qhd_t* const get_period_head(uint8_t hostid) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT; -STATIC_ INLINE_ ehci_qhd_t* const get_period_head(uint8_t hostid) +STATIC_ INLINE_ ehci_qhd_t* get_period_head(uint8_t hostid) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT; +STATIC_ INLINE_ ehci_qhd_t* get_period_head(uint8_t hostid) { return &ehci_data.period_head[ hostid_to_data_idx(hostid) ]; } @@ -211,7 +211,7 @@ void hcd_isr(uint8_t hostid) if (int_status & EHCI_INT_MASK_PORT_CHANGE) { - +// port_status_change_isr(h) } if (int_status & EHCI_INT_MASK_ASYNC_ADVANCE) @@ -304,17 +304,16 @@ tusb_error_t hcd_controller_stop(uint8_t hostid) return timeout_expired(&timeout) ? TUSB_ERROR_OSAL_TIMEOUT : TUSB_ERROR_NONE; } -//TODO host/device mode must be set immediately after a reset -tusb_error_t hcd_controller_reset(uint8_t hostid) ATTR_WARN_UNUSED_RESULT; tusb_error_t hcd_controller_reset(uint8_t hostid) { ehci_registers_t* const regs = get_operational_register(hostid); timeout_timer_t timeout; - if (regs->usb_sts_bit.hc_halted == 0) // need to stop before reset - { - ASSERT_STATUS( hcd_controller_stop(hostid) ); - } +// NXP chip powered with non-host mode --> sts bit is not correctly reflected +// if (regs->usb_sts_bit.hc_halted == 0) // need to stop before reset +// { +// ASSERT_STATUS( hcd_controller_stop(hostid) ); +// } regs->usb_cmd_bit.reset = 1; @@ -327,14 +326,22 @@ tusb_error_t hcd_controller_reset(uint8_t hostid) //--------------------------------------------------------------------+ // PORT API //--------------------------------------------------------------------+ +bool hcd_port_connect_status(uint8_t core_id) +{ + return false; +} +tusb_speed_t hcd_port_speed(uint8_t core_id) +{ + return TUSB_SPEED_HIGH; +} //--------------------------------------------------------------------+ // PIPE API //--------------------------------------------------------------------+ static void init_qhd(ehci_qhd_t *p_qhd, uint8_t dev_addr, uint16_t max_packet_size, uint8_t endpoint_addr, uint8_t xfer_type); -static inline ehci_qhd_t* const get_control_qhd(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT; +static inline ehci_qhd_t* get_control_qhd(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT; static inline ehci_qtd_t* get_control_qtds(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT; //--------------------------------------------------------------------+ @@ -522,7 +529,7 @@ tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t t //--------------------------------------------------------------------+ // HELPER //--------------------------------------------------------------------+ -static inline ehci_qhd_t* const get_control_qhd(uint8_t dev_addr) +static inline ehci_qhd_t* get_control_qhd(uint8_t dev_addr) { return (dev_addr == 0) ? get_async_head( usbh_device_info_pool[dev_addr].core_id ) : diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h index 8ff1f52ea..cd03c2b96 100644 --- a/tinyusb/host/ehci/ehci.h +++ b/tinyusb/host/ehci/ehci.h @@ -453,6 +453,9 @@ typedef struct { }device[TUSB_CFG_HOST_DEVICE_MAX]; }ehci_data_t; +//For NXP's MCU, host/device mode must be set immediately after a reset +tusb_error_t hcd_controller_reset(uint8_t hostid) ATTR_WARN_UNUSED_RESULT; + #ifdef __cplusplus } #endif diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h index 7091e6c54..95eea8718 100644 --- a/tinyusb/host/hcd.h +++ b/tinyusb/host/hcd.h @@ -93,6 +93,7 @@ tusb_error_t hcd_pipe_cancel()ATTR_WARN_UNUSED_RESULT; /// return the current connect status of roothub port bool hcd_port_connect_status(uint8_t core_id) ATTR_WARN_UNUSED_RESULT; tusb_speed_t hcd_port_speed(uint8_t core_id) ATTR_WARN_UNUSED_RESULT; +//tusb_error_t hcd_port_reset(uint8_t core_id) ATTR_WARN_UNUSED_RESULT; #ifdef __cplusplus } diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index fa16e5403..f0b79dabd 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -47,6 +47,10 @@ #include "tusb.h" #include "usbh_hcd.h" +void tusb_tick_tock(void) +{ + osal_tick_tock(); +} //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF //--------------------------------------------------------------------+ @@ -165,6 +169,11 @@ tusb_error_t usbh_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size) return TUSB_ERROR_NONE; } +pipe_status_t usbh_pipe_status_get(pipe_handle_t pipe_hdl) +{ + return PIPE_STATUS_BUSY; +} + //--------------------------------------------------------------------+ // ENUMERATION TASK //--------------------------------------------------------------------+ diff --git a/tinyusb/host/usbh.h b/tinyusb/host/usbh.h index 2c367d743..b89cc3bb9 100644 --- a/tinyusb/host/usbh.h +++ b/tinyusb/host/usbh.h @@ -125,7 +125,7 @@ enum { TUSB_FLAGS_CLASS_WIRELESS_CONTROLLER = BIT_(28), TUSB_FLAGS_CLASS_MISC = BIT_(29), TUSB_FLAGS_CLASS_APPLICATION_SPECIFIC = BIT_(30), - TUSB_FLAGS_CLASS_VENDOR_SPECIFIC = BIT_(31) + TUSB_FLAGS_CLASS_VENDOR_SPECIFIC = BIT_(31) // TODO out of range for int type }; /// Device Status @@ -169,11 +169,11 @@ tusb_error_t tusbh_configuration_set (tusb_handle_device_t device_hdl, uint8 tusbh_device_status_t tusbh_device_status_get (tusb_handle_device_t const device_hdl) ATTR_WARN_UNUSED_RESULT; #if TUSB_CFG_OS == TUSB_OS_NONE // TODO move later -static inline void tusb_tick_tock(void) ATTR_ALWAYS_INLINE; -static inline void tusb_tick_tock(void) -{ - osal_tick_tock(); -} +//static inline void tusb_tick_tock(void) ATTR_ALWAYS_INLINE; +//static inline void tusb_tick_tock(void) +//{ +// osal_tick_tock(); +//} #endif //--------------------------------------------------------------------+ |
