summaryrefslogtreecommitdiff
path: root/tinyusb/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-06-21 14:20:08 +0700
committerhathach <[email protected]>2013-06-21 14:20:08 +0700
commit5c564df8c172af0da3badabfa8e813fdd33949ff (patch)
treec0dcc52362aa02e8eb4eb6f45f4354c1bdf2d286 /tinyusb/host
parent3924764dff9d90ccff09e1d657c6f40ed8def8d9 (diff)
add api for hcd: hcd_pipe_is_idle
add api for usbh: tusbh_device_get_mounted_class_flag implement api for custom class - is mounted - read
Diffstat (limited to 'tinyusb/host')
-rw-r--r--tinyusb/host/ehci/ehci.c6
-rw-r--r--tinyusb/host/hcd.h1
-rw-r--r--tinyusb/host/usbh.c5
-rw-r--r--tinyusb/host/usbh.h4
4 files changed, 15 insertions, 1 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 4a030cbbe..b023fafed 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -444,6 +444,12 @@ tusb_error_t hcd_pipe_close(pipe_handle_t pipe_hdl)
return TUSB_ERROR_NONE;
}
+bool hcd_pipe_is_idle(pipe_handle_t pipe_hdl)
+{
+ ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle( pipe_hdl );
+ return (p_qhd->p_qtd_list_head == NULL);
+}
+
//--------------------------------------------------------------------+
// EHCI Interrupt Handler
//--------------------------------------------------------------------+
diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h
index fed45bf8a..33582dc61 100644
--- a/tinyusb/host/hcd.h
+++ b/tinyusb/host/hcd.h
@@ -96,6 +96,7 @@ tusb_error_t hcd_pipe_control_close(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc, uint8_t class_code) ATTR_WARN_UNUSED_RESULT;
tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
tusb_error_t hcd_pipe_close(pipe_handle_t pipe_hdl) ATTR_WARN_UNUSED_RESULT;
+bool hcd_pipe_is_idle(pipe_handle_t pipe_hdl);
#if 0
tusb_error_t hcd_pipe_cancel()ATTR_WARN_UNUSED_RESULT;
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 33e68b5ed..bbddfef8a 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -130,6 +130,11 @@ tusb_device_state_t tusbh_device_get_state (uint8_t const dev_addr)
return usbh_devices[dev_addr].state;
}
+uint32_t tusbh_device_get_mounted_class_flag(uint8_t dev_addr)
+{
+ return tusbh_device_is_configured(dev_addr) ? usbh_devices[dev_addr].flag_supported_class : 0;
+}
+
//--------------------------------------------------------------------+
// CLASS-USBD API (don't require to verify parameters)
//--------------------------------------------------------------------+
diff --git a/tinyusb/host/usbh.h b/tinyusb/host/usbh.h
index 6dcf12066..5879e7321 100644
--- a/tinyusb/host/usbh.h
+++ b/tinyusb/host/usbh.h
@@ -86,13 +86,14 @@ typedef struct {
//--------------------------------------------------------------------+
// APPLICATION API
//--------------------------------------------------------------------+
-tusb_error_t tusbh_configuration_set (uint8_t dev_addr, uint8_t configure_number) ATTR_WARN_UNUSED_RESULT;
+//tusb_error_t tusbh_configuration_set (uint8_t dev_addr, uint8_t configure_number) ATTR_WARN_UNUSED_RESULT;
tusb_device_state_t tusbh_device_get_state (uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT ATTR_PURE;
static inline bool tusbh_device_is_configured(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT ATTR_PURE;
static inline bool tusbh_device_is_configured(uint8_t dev_addr)
{
return tusbh_device_get_state(dev_addr) == TUSB_DEVICE_STATE_CONFIGURED;
}
+uint32_t tusbh_device_get_mounted_class_flag(uint8_t dev_addr);
//--------------------------------------------------------------------+
// APPLICATION CALLBACK
@@ -106,6 +107,7 @@ void tusbh_device_mount_failed_cb(tusb_error_t error, tusb_descriptor_de
//--------------------------------------------------------------------+
#ifdef _TINY_USB_SOURCE_FILE_
+
OSAL_TASK_FUNCTION (usbh_enumeration_task) (void* p_task_para);
tusb_error_t usbh_init(void);