summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/driver/usbh_device_driver.h2
-rw-r--r--include/usbh_hubbed.h13
-rw-r--r--src/usbh_driver_gp_xbox.c11
-rw-r--r--src/usbh_driver_hid_mouse.c12
-rw-r--r--src/usbh_driver_hub.c6
-rw-r--r--src/usbh_hubbed.c6
6 files changed, 30 insertions, 20 deletions
diff --git a/include/driver/usbh_device_driver.h b/include/driver/usbh_device_driver.h
index f8837e0..137b39b 100644
--- a/include/driver/usbh_device_driver.h
+++ b/include/driver/usbh_device_driver.h
@@ -91,7 +91,7 @@ struct _usbh_driver {
void (*init)(void *drvdata);
void (*write)(void *drvdata, const usbh_packet_t *packet);
void (*read)(void *drvdata, usbh_packet_t *packet);
- enum USBH_POLL_STATUS (*poll)(void *drvdata, uint32_t t_us);
+ enum USBH_POLL_STATUS (*poll)(void *drvdata, uint32_t time_curr_us);
uint8_t (*root_speed)(void *drvdata);
// Pointer to Low-level driver data
diff --git a/include/usbh_hubbed.h b/include/usbh_hubbed.h
index 00d3b99..1b6b49a 100644
--- a/include/usbh_hubbed.h
+++ b/include/usbh_hubbed.h
@@ -62,14 +62,23 @@ typedef struct _usbh_dev_driver_info usbh_dev_driver_info_t;
struct _usbh_dev_driver {
bool (*analyze_descriptor)(void *drv, void *descriptor);
void *(*init)(void *usbh_dev);
- void (*poll)(void *drvdata, uint32_t t_us);
+ void (*poll)(void *drvdata, uint32_t time_curr_us);
void (*remove)(void *drvdata);
const usbh_dev_driver_info_t * const info;
};
typedef struct _usbh_dev_driver usbh_dev_driver_t;
void usbh_init(const void *drivers[], const usbh_dev_driver_t * const device_drivers[]);
-void usbh_poll(uint32_t t_us);
+
+/**
+ * \brief usbh_poll
+ * \param time_curr_us - use monotically rising time
+ *
+ * time_curr_us:
+ * * can overflow, in time of this writing, after 1s)
+ * * unit is microseconds
+ */
+void usbh_poll(uint32_t time_curr_us);
END_DECLS
diff --git a/src/usbh_driver_gp_xbox.c b/src/usbh_driver_gp_xbox.c
index 52955d9..07eab38 100644
--- a/src/usbh_driver_gp_xbox.c
+++ b/src/usbh_driver_gp_xbox.c
@@ -30,7 +30,7 @@
static void *gp_xbox_init(void *usbh_dev);
static bool gp_xbox_analyze_descriptor(void *drvdata, void *descriptor);
-static void gp_xbox_poll(void *drvdata, uint32_t tflp);
+static void gp_xbox_poll(void *drvdata, uint32_t time_curr_us);
static void gp_xbox_remove(void *drvdata);
static const usbh_dev_driver_info_t usbh_gp_xbox_driver_info = {
@@ -367,12 +367,13 @@ static void read_gp_xbox_in(gp_xbox_device_t *gp_xbox)
}
/**
- *
- * tflp time from last poll [us]
+ * \param time_curr_us - monotically rising time (see usbh_hubbed.h)
+ * unit is microseconds
*/
-static void gp_xbox_poll(void *drvdata, uint32_t tflp)
+static void gp_xbox_poll(void *drvdata, uint32_t time_curr_us)
{
- (void)tflp;
+ (void)time_curr_us;
+
gp_xbox_device_t *gp_xbox = drvdata;
usbh_device_t *dev = gp_xbox->usbh_device;
diff --git a/src/usbh_driver_hid_mouse.c b/src/usbh_driver_hid_mouse.c
index 5c01451..6391ed7 100644
--- a/src/usbh_driver_hid_mouse.c
+++ b/src/usbh_driver_hid_mouse.c
@@ -29,7 +29,7 @@
static void *mouse_init(void *usbh_dev);
static bool mouse_analyze_descriptor(void *drvdata, void *descriptor);
-static void mouse_poll(void *drvdata, uint32_t tflp);
+static void mouse_poll(void *drvdata, uint32_t time_curr_us);
static void mouse_remove(void *drvdata);
static const usbh_dev_driver_info_t usbh_hid_mouse_driver_info = {
@@ -248,13 +248,13 @@ static void read_mouse_in(void *drvdata)
}
/**
- *
- * tflp time from last poll [us]
+ * \param time_curr_us - monotically rising time (see usbh_hubbed.h)
+ * unit is microseconds
*/
-static void mouse_poll(void *drvdata, uint32_t tflp)
+static void mouse_poll(void *drvdata, uint32_t time_curr_us)
{
- (void)drvdata;
- (void)tflp;
+ (void)time_curr_us;
+
hid_mouse_device_t *mouse = drvdata;
usbh_device_t *dev = mouse->usbh_device;
switch (mouse->state_next) {
diff --git a/src/usbh_driver_hub.c b/src/usbh_driver_hub.c
index c82eacd..a70e0c0 100644
--- a/src/usbh_driver_hub.c
+++ b/src/usbh_driver_hub.c
@@ -32,7 +32,7 @@ static hub_device_t hub_device[USBH_MAX_HUBS];
static void *hub_init(void *usbh_dev);
static bool hub_analyze_descriptor(void *drvdata, void *descriptor);
-static void hub_poll(void *drvdata, uint32_t tflp);
+static void hub_poll(void *drvdata, uint32_t time_curr_us);
static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data);
static void hub_remove(void *drvdata);
@@ -765,8 +765,8 @@ static void read_ep1(void *drvdata)
}
/**
- *
- * tflp time from last poll [ms]
+ * \param time_curr_us - monotically rising time (see usbh_hubbed.h)
+ * unit is microseconds
*/
static void hub_poll(void *drvdata, uint32_t time_curr_us)
{
diff --git a/src/usbh_hubbed.c b/src/usbh_hubbed.c
index e935f99..b8fb97c 100644
--- a/src/usbh_hubbed.c
+++ b/src/usbh_hubbed.c
@@ -568,7 +568,7 @@ void device_enumeration_start(usbh_device_t *dev)
* Should be called with at least 1kHz frequency
*
*/
-void usbh_poll(uint32_t t_us)
+void usbh_poll(uint32_t time_curr_us)
{
uint32_t k = 0;
while (usbh_data.lld_drivers[k]) {
@@ -577,7 +577,7 @@ void usbh_poll(uint32_t t_us)
usbh_generic_data_t *lld_data = usbh_data.lld_drivers[k]->driver_data;
enum USBH_POLL_STATUS poll_status =
- usbh_data.lld_drivers[k]->poll(lld_data, t_us);
+ usbh_data.lld_drivers[k]->poll(lld_data, time_curr_us);
switch (poll_status) {
case USBH_POLL_STATUS_DEVICE_CONNECTED:
@@ -613,7 +613,7 @@ void usbh_poll(uint32_t t_us)
}
if (lld_data->usbh_device[0].drv && usbh_device[0].drvdata) {
- usbh_device[0].drv->poll(usbh_device[0].drvdata, t_us);
+ usbh_device[0].drv->poll(usbh_device[0].drvdata, time_curr_us);
}
k++;