xiltimer
Vitis Drivers API Documentation
sleep.h File Reference

Overview

This header file contains sleep related APIs.

MODIFICATION HISTORY :
Ver   Who  Date  Changes


1.0 adk 24/11/21 Initial release. 1.2 adk 22/12/22 Fixed doxygen style and indentation issues. 2.1 adk 11/09/24 Added missing prototype for msleep() API.

 

Macros

#define Xil_poll_timeout(IO_func, ADDR, VALUE, COND, TIMEOUT_US)
 This macro polls an address periodically until a condition is met or till the timeout occurs. More...
 

Functions

void usleep (unsigned long useconds)
 This API gives delay in usec. More...
 
void msleep (unsigned long mseconds)
 This API gives delay in msec. More...
 
void sleep (unsigned int seconds)
 This API gives delay in sec. More...
 

Macro Definition Documentation

#define Xil_poll_timeout (   IO_func,
  ADDR,
  VALUE,
  COND,
  TIMEOUT_US 
)
Value:
( { \
u64 timeout = TIMEOUT_US/100; \
if(TIMEOUT_US%100!=0) \
timeout++; \
for(;;) { \
VALUE = IO_func(ADDR); \
if(COND) \
break; \
else { \
usleep(100); \
timeout--; \
if(timeout==0) \
break; \
} \
} \
(timeout>0) ? 0 : -1; \
} )
void usleep(unsigned long useconds)
This API gives delay in usec.
Definition: xiltimer.c:87

This macro polls an address periodically until a condition is met or till the timeout occurs.

The minimum timeout for calling this macro is 100us. If the timeout is less than 100us, it still waits for 100us. Also the unit for the timeout is 100us. If the timeout is not a multiple of 100us, it waits for a timeout of the next usec value which is a multiple of 100us.

Parameters
IO_func- accessor function to read the register contents. Depends on the register width.
ADDR- Address to be polled
VALUE- variable to read the value
COND- Condition to checked (usually involves VALUE)
TIMEOUT_US- timeout in micro seconds
Returns
  • 0 - when the condition is met
  • 1 - when the condition is not met till the timeout period
Note
none