Lines Matching defs:timer
926 ocs_timer_t *timer = t;
928 if (callout_pending(&timer->callout)) {
933 if (!callout_active(&timer->callout)) {
938 callout_deactivate(&timer->callout);
940 if (timer->func) {
941 timer->func(timer->data);
946 ocs_setup_timer(ocs_os_handle_t os, ocs_timer_t *timer, void(*func)(void *arg), void *data, uint32_t timeout_ms)
951 if (timer == NULL) {
956 if (!mtx_initialized(&timer->lock)) {
957 mtx_init(&timer->lock, "ocs_timer", NULL, MTX_DEF);
960 callout_init_mtx(&timer->callout, &timer->lock, 0);
962 timer->func = func;
963 timer->data = data;
974 mtx_lock(&timer->lock);
975 callout_reset(&timer->callout, hz, __ocs_callout, timer);
976 mtx_unlock(&timer->lock);
982 ocs_mod_timer(ocs_timer_t *timer, uint32_t timeout_ms)
987 if (timer == NULL) {
1001 mtx_lock(&timer->lock);
1002 callout_reset(&timer->callout, hz, __ocs_callout, timer);
1003 mtx_unlock(&timer->lock);
1009 ocs_timer_pending(ocs_timer_t *timer)
1011 return callout_active(&timer->callout);
1015 ocs_del_timer(ocs_timer_t *timer)
1018 mtx_lock(&timer->lock);
1019 callout_stop(&timer->callout);
1020 mtx_unlock(&timer->lock);