mirror of
https://github.com/sakumisu/CherryUSB.git
synced 2025-05-07 15:36:55 +08:00
update(osal): rename ticks to timeout_ms
Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
parent
93a8457700
commit
e29d87bb20
@ -33,7 +33,7 @@ struct usb_osal_timer {
|
||||
usb_timer_handler_t handler;
|
||||
void *argument;
|
||||
bool is_period;
|
||||
uint32_t ticks;
|
||||
uint32_t timeout_ms;
|
||||
void *timer;
|
||||
};
|
||||
|
||||
|
@ -129,7 +129,7 @@ usb_osal_mutex_t usb_osal_mutex_create(void)
|
||||
{
|
||||
UINT32 mux_handle;
|
||||
UINT32 ret;
|
||||
|
||||
|
||||
ret = LOS_MuxCreate(&mux_handle);
|
||||
if (ret != LOS_OK) {
|
||||
USB_LOG_ERR("Create mux failed code[%u]\r\n", ret);
|
||||
@ -144,7 +144,7 @@ void usb_osal_mutex_delete(usb_osal_mutex_t mutex)
|
||||
UINT32 mux_handle = (UINT32)mutex;
|
||||
UINT32 ret;
|
||||
|
||||
ret = LOS_MuxDelete(mux_handle);
|
||||
ret = LOS_MuxDelete(mux_handle);
|
||||
if (ret != LOS_OK) {
|
||||
USB_LOG_ERR("Delete mux handle[%u] failed code[%u]\r\n",\
|
||||
mux_handle, ret);
|
||||
@ -263,7 +263,7 @@ struct usb_osal_timer *usb_osal_timer_create(const char *name, uint32_t timeout_
|
||||
timer_handle->handler = handler;
|
||||
timer_handle->argument = argument;
|
||||
timer_handle->is_period = is_period;
|
||||
timer_handle->ticks = timeout_ms;
|
||||
timer_handle->timeout_ms = timeout_ms;
|
||||
timer_handle->timer = (void *)timer_id;
|
||||
|
||||
return timer_handle;
|
||||
|
@ -295,7 +295,7 @@ static void os_timer_callback(wdparm_t arg)
|
||||
}
|
||||
|
||||
if (timer->is_period) {
|
||||
wd_start(timer->timer, timer->ticks, os_timer_callback, arg);
|
||||
wd_start(timer->timer, timer->timeout_ms, os_timer_callback, arg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ struct usb_osal_timer *usb_osal_timer_create(const char *name, uint32_t timeout_
|
||||
|
||||
timer->handler = handler;
|
||||
timer->argument = argument;
|
||||
timer->ticks = MSEC2TICK(timeout_ms);
|
||||
timer->timeout_ms = MSEC2TICK(timeout_ms);
|
||||
timer->is_period = is_period;
|
||||
timer->timer = (void *)wdog;
|
||||
|
||||
@ -332,7 +332,7 @@ void usb_osal_timer_delete(struct usb_osal_timer *timer)
|
||||
|
||||
void usb_osal_timer_start(struct usb_osal_timer *timer)
|
||||
{
|
||||
wd_start(timer->timer, timer->ticks, os_timer_callback, (wdparm_t)timer);
|
||||
wd_start(timer->timer, timer->timeout_ms, os_timer_callback, (wdparm_t)timer);
|
||||
}
|
||||
|
||||
void usb_osal_timer_stop(struct usb_osal_timer *timer)
|
||||
|
@ -236,7 +236,7 @@ struct usb_osal_timer *usb_osal_timer_create(const char *name, uint32_t timeout_
|
||||
}
|
||||
|
||||
timer->timer = timer_ptr;
|
||||
timer->ticks = timeout_ms;
|
||||
timer->timeout_ms = timeout_ms;
|
||||
timer->is_period = is_period;
|
||||
if (tx_timer_create(timer_ptr, (CHAR *)name, (void (*)(ULONG))handler, (uintptr_t)argument, 1, is_period ? 1 : 0,
|
||||
TX_NO_ACTIVATE) != TX_SUCCESS) {
|
||||
@ -255,7 +255,7 @@ void usb_osal_timer_delete(struct usb_osal_timer *timer)
|
||||
|
||||
void usb_osal_timer_start(struct usb_osal_timer *timer)
|
||||
{
|
||||
if (tx_timer_change((TX_TIMER *)timer->timer, timer->ticks, timer->is_period ? timer->ticks : 0) == TX_SUCCESS) {
|
||||
if (tx_timer_change((TX_TIMER *)timer->timer, timer->timeout_ms, timer->is_period ? timer->timeout_ms : 0) == TX_SUCCESS) {
|
||||
/* Call the tx_timer_activate to activates the specified application
|
||||
timer. The expiration routines of timers that expire at the same
|
||||
time are executed in the order they were activated. */
|
||||
|
@ -182,7 +182,7 @@ struct usb_osal_timer *usb_osal_timer_create(const char *name, uint32_t timeout_
|
||||
timer->handler = handler;
|
||||
timer->argument = argument;
|
||||
timer->is_period = is_period;
|
||||
timer->ticks = timeout_ms;
|
||||
timer->timeout_ms = timeout_ms;
|
||||
|
||||
k_timer_init(timer->timer, zephyr_timer_wrapper, NULL);
|
||||
k_timer_user_data_set(timer->timer, timer);
|
||||
@ -200,9 +200,9 @@ void usb_osal_timer_delete(struct usb_osal_timer *timer)
|
||||
void usb_osal_timer_start(struct usb_osal_timer *timer)
|
||||
{
|
||||
if (timer->is_period) {
|
||||
k_timer_start(timer->timer, K_MSEC(timer->ticks), K_MSEC(timer->ticks));
|
||||
k_timer_start(timer->timer, K_MSEC(timer->timeout_ms), K_MSEC(timer->timeout_ms));
|
||||
} else {
|
||||
k_timer_start(timer->timer, K_MSEC(timer->ticks), K_NO_WAIT);
|
||||
k_timer_start(timer->timer, K_MSEC(timer->timeout_ms), K_NO_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user