COMM-DRV/Lib: CdrvSetTime() Sets a timer to a specified delay


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.


stat = CdrvDelay(port,delay_time);

On Entry-

int port;

Port previously opened with InitializePort() or 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-



int ret;
int port=0;
int timeout=10;
if ((ret = CdrvDelay(port,timeout)) == -1)
   printf("Port was not initialized \n");
   /* Take remedial action */