示例#1
0
void sensor_delay_ms(uint32_t msecs)
{
	if (msecs >= CONVERT_TICKS_TO_MS(1)) {
		T_SEMAPHORE sem = semaphore_create(0);
		semaphore_take(sem, (int)msecs + 1); /* details in FIRE-5618 */
		semaphore_delete(sem);
	} else {
		wait_ticks(msecs * AON_CNT_TICK_PER_MS);
	}
}
示例#2
0
void sensor_delay_ms(uint32_t msecs)
{
	if (msecs >= CONVERT_TICKS_TO_MS(1)) {
		T_SEMAPHORE sem = semaphore_create(0);
/* Ensure that we will wait at least 'msecs' millisecond as if semaphore_take is called
 * right before the timer tick interrupt it will be released immediately */
		semaphore_take(sem, (int)msecs + 1);
		semaphore_delete(sem);
	} else {
		wait_ticks(msecs * AON_CNT_TICK_PER_MS);
	}
}
示例#3
0
文件: timer.c 项目: CurieBSP/main
/**
 * Return the current tick converted in milliseconds.
 *
 * Authorized execution levels:  task, fiber
 *
 * @warning: the return value is false in interrupt context.
 *
 * @return current tick converted in milliseconds
 */
uint32_t get_time_ms(void)
{
	return (uint32_t)CONVERT_TICKS_TO_MS(sys_tick_get_32());
}
示例#4
0
/**
 * Return the current tick converted in milliseconds.
 *
 * Authorized execution levels:  task, fiber, ISR
 *
 * @return current tick converted in milliseconds
 */
uint32_t get_time_ms(void)
{
    return ( (uint32_t) CONVERT_TICKS_TO_MS(_GET_TICK()));
}