COMM-DRV/Lib: CdrvDelay() Delay specified time

Description-

This function delays for the specified amount of time. Additionally, if the CdrvSetTimeoutFunction() was used to install a time-out function, then that time-out function will be called each time this routine is called. That time-out function can control the status returned by this function.

Syntax-

stat = CdrvDelay(port,delay_time);

On Entry-

int port;

Port previously opened with OpenComPort(). If this value is -1 then this function will not attempt to validate the port or will not call any user installed function installed with CdrvSetTimeoutFunction.

int delay_time;

Number of tics to delay. Note that the tic resolution is dependent on the setting by the function CdrvSetTimerResolution().

On Exit-

int stat;

If the CdrvSetTimeoutFunction() was not called to install a user time-out function then the return values are as follows.

0 If successful.
!=0 If port was not initialized.

If the CdrvSetTimeoutFunction() was called to install a user function, and the return value from the user function is 0, this function returns immediately.

See Also-

CdrvCheckTime()
CdrvSetTime()
CdrvSetTimerResolution()
CdrvSetTimeoutFunction()

Example-

#include <comm.h>
int ret;
 int port=0;
 int timeout=10;
if ((ret = CdrvDelay(port,timeout)) == -1)
    {
    printf("Port was not initialized \n");
    /* Take remedial action */
    }