gint_strcat/src/tmu/sleep.c

20 lines
422 B
C

//---
// gint:clock:sleep - Various low-level sleep functions
//---
#include <gint/clock.h>
#include <gint/timer.h>
/* sleep_us() - sleep for a definite duration in microseconds */
void sleep_us(int tid, int us_delay)
{
volatile int flag = 0;
uint32_t delay = timer_delay(tid, us_delay);
int free = timer_setup(tid, delay, 0, timer_timeout, &flag);
if(free < 0) return;
timer_start(tid);
while(!flag) sleep();
}