Lines Matching full:timer
44 /* User CC 2 for reading counter, CC 3 for timer isr */
54 /* Maximum timer frequency */
121 /* Resolve timer number into timer structure */
141 /* Force a capture of the timer into 'cntr' capture channel; read it */ in nrf_read_timer_cntr()
149 * nrf timer set ocmp
151 * Set the OCMP used by the timer to the desired expiration tick
155 * @param timer Pointer to timer.
201 /* Set output compare register to timer expiration */ in nrf_timer_set_ocmp()
217 /* Disable output compare used for timer */
258 * hal timer chk queue
269 struct hal_timer *timer; in hal_timer_chk_queue() local
273 while ((timer = TAILQ_FIRST(&bsptimer->hal_timer_q)) != NULL) { in hal_timer_chk_queue()
278 * Thus, we have to service this timer early. in hal_timer_chk_queue()
285 if ((int32_t)(tcntr - timer->expiry) >= delta) { in hal_timer_chk_queue()
286 TAILQ_REMOVE(&bsptimer->hal_timer_q, timer, link); in hal_timer_chk_queue()
287 timer->link.tqe_prev = NULL; in hal_timer_chk_queue()
288 timer->cb_func(timer->cb_arg); in hal_timer_chk_queue()
295 timer = TAILQ_FIRST(&bsptimer->hal_timer_q); in hal_timer_chk_queue()
296 if (timer) { in hal_timer_chk_queue()
297 nrf_timer_set_ocmp(bsptimer, timer->expiry); in hal_timer_chk_queue()
310 * hal timer irq handler
312 * Generic HAL timer irq handler.
317 * hal timer irq handler
319 * This is the global timer interrupt routine.
341 /* Count # of timer isrs */ in hal_timer_irq_handler()
345 * NOTE: we dont check the 'compare' variable here due to how the timer in hal_timer_irq_handler()
347 * compare, so if we are late setting the output compare (i.e. the timer in hal_timer_irq_handler()
384 /* Count # of timer isrs */ in hal_rtc_timer_irq_handler()
388 * NOTE: we dont check the 'compare' variable here due to how the timer in hal_rtc_timer_irq_handler()
390 * compare, so if we are late setting the output compare (i.e. the timer in hal_rtc_timer_irq_handler()
452 * hal timer init
454 * Initialize platform specific timer items
456 * @param timer_num Timer number to initialize
472 /* If timer is enabled do not allow init */ in hal_timer_init()
518 * hal timer config
520 * Configure a timer to run at the desired frequency. This starts the timer.
555 /* Stop the timer first */ in hal_timer_config()
565 /* Start the timer */ in hal_timer_config()
585 * hal timer deinit
587 * De-initialize a HW timer.
624 * hal timer get resolution
626 * Get the resolution of the timer. This is the timer period, in nanoseconds
650 * hal timer read
652 * Returns the timer counter. NOTE: if the timer is a 16-bit timer, only
653 * the lower 16 bits are valid. If the timer is a 64-bit timer, only the
656 * @return uint32_t The timer counter register.
682 * hal timer delay
706 * Initialize the HAL timer structure with the callback and the callback
707 * argument. Also initializes the HW specific timer pointer.
714 hal_timer_set_cb(int timer_num, struct hal_timer *timer, hal_timer_cb cb_func, in hal_timer_set_cb() argument
722 timer->cb_func = cb_func; in hal_timer_set_cb()
723 timer->cb_arg = arg; in hal_timer_set_cb()
724 timer->link.tqe_prev = NULL; in hal_timer_set_cb()
725 timer->bsp_timer = bsptimer; in hal_timer_set_cb()
734 hal_timer_start(struct hal_timer *timer, uint32_t ticks) in hal_timer_start() argument
740 /* Set the tick value at which the timer should expire */ in hal_timer_start()
741 bsptimer = (struct nrf52_hal_timer *)timer->bsp_timer; in hal_timer_start()
747 rc = hal_timer_start_at(timer, tick); in hal_timer_start()
752 hal_timer_start_at(struct hal_timer *timer, uint32_t tick) in hal_timer_start_at() argument
758 if ((timer == NULL) || (timer->link.tqe_prev != NULL) || in hal_timer_start_at()
759 (timer->cb_func == NULL)) { in hal_timer_start_at()
762 bsptimer = (struct nrf52_hal_timer *)timer->bsp_timer; in hal_timer_start_at()
763 timer->expiry = tick; in hal_timer_start_at()
768 TAILQ_INSERT_HEAD(&bsptimer->hal_timer_q, timer, link); in hal_timer_start_at()
771 if ((int32_t)(timer->expiry - entry->expiry) < 0) { in hal_timer_start_at()
772 TAILQ_INSERT_BEFORE(entry, timer, link); in hal_timer_start_at()
777 TAILQ_INSERT_TAIL(&bsptimer->hal_timer_q, timer, link); in hal_timer_start_at()
782 if (timer == TAILQ_FIRST(&bsptimer->hal_timer_q)) { in hal_timer_start_at()
783 nrf_timer_set_ocmp(bsptimer, timer->expiry); in hal_timer_start_at()
792 * hal timer stop
794 * Stop a timer.
796 * @param timer
801 hal_timer_stop(struct hal_timer *timer) in hal_timer_stop() argument
808 if (timer == NULL) { in hal_timer_stop()
812 bsptimer = (struct nrf52_hal_timer *)timer->bsp_timer; in hal_timer_stop()
816 if (timer->link.tqe_prev != NULL) { in hal_timer_stop()
818 if (timer == TAILQ_FIRST(&bsptimer->hal_timer_q)) { in hal_timer_stop()
820 entry = TAILQ_NEXT(timer, link); in hal_timer_stop()
823 TAILQ_REMOVE(&bsptimer->hal_timer_q, timer, link); in hal_timer_stop()
824 timer->link.tqe_prev = NULL; in hal_timer_stop()