示例#1
0
/**
 * Starts the timeout timer
 *
 * @param timeout Number of microseconds to wait
 */
static inline void startTimer(unsigned int timeout) {

    WriteTimer6(0);
    PR6 = US_TO_TICKS(timeout);
    _T6IF = 0;
    EnableIntT6;

}
示例#2
0
文件: timer.c 项目: dafyddcrosby/L4OS
void
utimer_sleep(uint32_t microseconds)
{
	utimer_entry_t entry =
	{ L4_KDB_GetTick(), (uint32_t) US_TO_TICKS(microseconds)};

	L4_Msg_t msg; L4_MsgClear(&msg);
	L4_MsgAppendWord(&msg, (uintptr_t) &entry);
	L4_MsgLoad(&msg);

	L4_Call(utimer_tid);
}
示例#3
0
文件: motor.c 项目: linuxfans/escX4
void motor_start(MOTOR *p) 
{
    p->state = STATE_START;
    p->phase = 1;
    p->start_counter = 0;
    *(p->phase_a_pwm) = 800;
    *(p->phase_b_pwm) = 800;
    *(p->phase_c_pwm) = 800;
    p->start_comm_period =  US_TO_TICKS(10000);
    commutate(p);
//    TIM_ITConfig(TIM10, TIM_IT_CC1, ENABLE);
    TIM10->DIER |= TIM_IT_CC1;
    *(p->commutate_timer) = *(p->commutate_counter) + p->start_comm_period;
    p->prev_comm_ticks = *(p->commutate_timer);
    p->start_comm_period = ((p->start_comm_period * 15) >> 4);
}
示例#4
0
PUBLIC IX_STATUS
ixOsalSemaphoreWait (IxOsalOsSemaphore *sid, INT32 timeout)
{
    VALID_HANDLE(sid);

    struct semaphore *sem = *sid;
    UINT32 start, duration;

    if (timeout == IX_OSAL_WAIT_FOREVER)
	return ixOsalSemaphoreWaitInternal(sem, /* wait */ true);

    IX_STATUS ixStatus = ixOsalSemaphoreWaitInternal(sem, /* wait */ false);
    if (!timeout || ixStatus == IX_SUCCESS)
	return ixStatus;

    start = IX_OSAL_OEM_TIMESTAMP_GET();
    duration = US_TO_TICKS(timeout * 1000);
    do {
	ixOsalYield();
	ixStatus = ixOsalSemaphoreWaitInternal(sem, /* wait */ false);
    } while (ixStatus != IX_SUCCESS
	  && IX_OSAL_OEM_TIMESTAMP_GET() - start < duration);
    return ixStatus;
}
void ux500_rtcrtt_next(u32 time_us)
{
	writel(US_TO_TICKS(time_us), rtc_base + RTC_TLR1);
}