Replace all usleep with hl_usleep

Several places where usleep max value could be overflowed
New hl_usleep can take values > 1000000
pull/168/head
Michael Black 2020-01-07 23:18:56 -06:00
rodzic 8f17b6fbf1
commit 7ee3a702f5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6599353EC683404D
30 zmienionych plików z 111 dodań i 88 usunięć

Wyświetl plik

@ -2602,7 +2602,7 @@ int adat_transaction(RIG *pRig,
// sleep between cmds - ADAT needs time to act upoon cmds
usleep(ADAT_SLEEP_MICROSECONDS_BETWEEN_CMDS);
hl_usleep(ADAT_SLEEP_MICROSECONDS_BETWEEN_CMDS);
}
}
@ -2884,6 +2884,10 @@ int adat_open(RIG *pRig)
int adat_close(RIG *pRig)
{
int nRC = RIG_OK;
adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv;
if (pPriv->pcCmd != NULL) free(pPriv->pcCmd);
if (pPriv->pcResult != NULL) free(pPriv->pcResult);
gFnLevel++;

Wyświetl plik

@ -251,7 +251,7 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
if (retval == -RIG_ETIMEOUT)
{
rig_debug(RIG_DEBUG_ERR, "%s:timeout retry=%d\n", __func__, retry);
usleep(50000);
hl_usleep(50000);
}
}
@ -259,7 +259,7 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
}
while ((retval <= 0) && (--retry > 0));
usleep(1000); // 1ms sleep per manual
hl_usleep(1000); // 1ms sleep per manual
if (data_len != NULL && retval > 0)
{

Wyświetl plik

@ -306,7 +306,7 @@ ars_move(ROT *rot, int direction, int speed)
{
rig_debug(RIG_DEBUG_TRACE, "%s need settling delay\n", __func__);
usleep(ARS_SETTLE_DELAY);
hl_usleep(ARS_SETTLE_DELAY);
}
priv->curr_move = direction;
@ -337,7 +337,7 @@ ars_move(ROT *rot, int direction, int speed)
}
priv->brake_off = 1;
usleep(ARS_BRAKE_DELAY);
hl_usleep(ARS_BRAKE_DELAY);
}
@ -437,7 +437,7 @@ static void *handle_set_position(void *arg)
if (!priv->set_pos_active)
{
/* TODO: replace polling period by cond var */
usleep(100 * 1000 - 1);
hl_usleep(100 * 1000 - 1);
continue;
}
@ -448,7 +448,7 @@ static void *handle_set_position(void *arg)
{
rig_debug(RIG_DEBUG_WARN, "%s: ars_set_position_sync() failed: %s\n",
__func__, rigerror(retcode));
usleep(1000 * 1000);
hl_usleep(1000 * 1000);
continue;
}
}
@ -535,7 +535,7 @@ ars_set_position_sync(ROT *rot, azimuth_t az, elevation_t el)
}
/* wait a little */
usleep(10 * 1000);
hl_usleep(10 * 1000);
retval = ars_get_position(rot, &curr_az, &curr_el);
@ -621,22 +621,22 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
/* flush last sampled value, with a dummy read */
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CS));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
for (i = 0; i < priv->adc_res; i++)
{
CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CLK));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
}
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CS));
/* end of dummy read */
@ -646,12 +646,12 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
/* read ADC value TLC(1)549 (8/10 bits), by SPI bitbanging */
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CS));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
az_samples[num_sample] = 0;
el_samples[num_sample] = 0;
@ -659,7 +659,7 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
for (i = 0; i < priv->adc_res; i++)
{
CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CLK));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
CHKPPRET(par_read_status(pport, &status));
@ -670,7 +670,7 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
el_samples[num_sample] |= (status & STA_PIN_D1) ? 1 : 0;
CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK));
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
}
CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CS));
@ -678,7 +678,7 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
rig_debug(RIG_DEBUG_TRACE, "%s: raw samples: az %u, el %u\n",
__func__, az_samples[num_sample], el_samples[num_sample]);
usleep(PP_IO_PERIOD);
hl_usleep(PP_IO_PERIOD);
}
par_unlock(pport);

Wyświetl plik

@ -489,7 +489,7 @@ int barrett_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
// we need a little extra time before we assert PTT
// testing with rigctld worked, but from WSJT-X did not
// WSJT-X is just a little faster without the network timing
usleep(100 * 1000);
hl_usleep(100 * 1000);
sprintf(cmd_buf, "XP%d", ptt);
response = NULL;
retval = barrett_transaction(rig, cmd_buf, 0, &response);

Wyświetl plik

@ -442,7 +442,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
{
rig_debug(RIG_DEBUG_TRACE, "%s: got %s\n", __func__, terminator);
// Slow down just a bit -- not sure this is needed anymore but not a big deal here
usleep(2 * 1000);
hl_usleep(2 * 1000);
retval = RIG_OK;
}
else
@ -949,7 +949,7 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (strlen(value) == 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: retries=%d\n", __func__, retries);
//usleep(10*1000);
//hl_usleep(10*1000);
}
}
while (--retries && strlen(value) == 0);

Wyświetl plik

@ -348,7 +348,7 @@ transaction_read:
if (retry_read++ < rs->rigport.retry)
{
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__);
usleep(rig->caps->timeout * 1000);
hl_usleep(rig->caps->timeout * 1000);
goto transaction_read;
}
@ -477,7 +477,7 @@ int elad_safe_transaction(RIG *rig, const char *cmd, char *buf,
"expected = %d, got %d\n",
__func__, cmd, (int)expected, (int)length);
err = -RIG_EPROTO;
usleep(rig->caps->timeout * 1000);
hl_usleep(rig->caps->timeout * 1000);
}
}
while (err != RIG_OK && ++retry < rig->state.rigport.retry);
@ -3187,7 +3187,7 @@ int elad_send_morse(RIG *rig, vfo_t vfo, const char *msg)
*/
if (!strncmp(m2, "KY0", 3)) { break; }
if (!strncmp(m2, "KY1", 3)) { usleep(500000); }
if (!strncmp(m2, "KY1", 3)) { hl_usleep(500000); }
else { return -RIG_EINVAL; }
}

Wyświetl plik

@ -70,7 +70,7 @@ static int setDirection(hamlib_port_t *port, unsigned char outputvalue,
par_write_control(port, outputstatus ^ CP_ACTIVE_LOW_BITS);
// and now the strobe impulse
usleep(1);
hl_usleep(1);
if (direction)
{
@ -82,7 +82,7 @@ static int setDirection(hamlib_port_t *port, unsigned char outputvalue,
}
par_write_control(port, outputstatus ^ CP_ACTIVE_LOW_BITS);
usleep(1);
hl_usleep(1);
if (direction)
{

Wyświetl plik

@ -4760,7 +4760,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
// sending more than enough 0xfe's to wake up the rs232
retval = write_block(&rs->rigport, (char *) fe_buf, fe_max);
usleep(100 * 1000);
hl_usleep(100 * 1000);
// we'll try 0x18 0x01 now -- should work on STBY rigs too
pwr_sc = S_PWR_ON;
fe_buf[0] = 0;

Wyświetl plik

@ -832,7 +832,7 @@ static int optoscan_wait_timer(RIG *rig, pltstate_t *state)
if (usec_diff < settle_usec)
{
usleep(settle_usec - usec_diff); /* sleep balance of settle_time */
hl_usleep(settle_usec - usec_diff); /* sleep balance of settle_time */
}
return RIG_OK;

Wyświetl plik

@ -2438,6 +2438,9 @@ extern HAMLIB_EXPORT(const char *) rig_copyright HAMLIB_PARAMS(());
HAMLIB_EXPORT(void) rig_no_restore_ai();
#include <unistd.h>
int hl_usleep(useconds_t msec);
__END_DECLS
#endif /* _RIG_H */

Wyświetl plik

@ -137,6 +137,7 @@ const struct rig_caps k2_caps =
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0, /* Timing between bytes */
.post_write_delay = 100, /* Timing between command strings */
// Note that 2000 timeout exceeds usleep but hl_usleep handles it
.timeout = 2000, /* FA and FB make take up to 500 ms on band change */
.retry = 10,

Wyświetl plik

@ -401,7 +401,7 @@ transaction_read:
if (retry_read++ < rs->rigport.retry)
{
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly\n", __func__);
usleep(rig->caps->timeout * 1000);
hl_usleep(rig->caps->timeout * 1000);
goto transaction_read;
}
@ -536,7 +536,7 @@ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf,
"%s: wrong answer; len for cmd %s: expected = %d, got %d\n",
__func__, cmd, (int)expected, (int)length);
err = -RIG_EPROTO;
usleep(rig->caps->timeout * 1000);
hl_usleep(rig->caps->timeout * 1000);
}
}
while (err != RIG_OK && ++retry < rig->state.rigport.retry);
@ -3488,7 +3488,7 @@ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg)
*/
if (!strncmp(m2, "KY0", 3)) { break; }
if (!strncmp(m2, "KY1", 3)) { usleep(500000); }
if (!strncmp(m2, "KY1", 3)) { hl_usleep(500000); }
else { return -RIG_EINVAL; }
}

Wyświetl plik

@ -37,7 +37,7 @@
// Some commands are very slow to process so we put a DELAY in those places
#define DELAY usleep(300*1000)
#define DELAY hl_usleep(300*1000)
#define THD72_MODES (RIG_MODE_FM|RIG_MODE_FMN|RIG_MODE_AM)
#define THD72_MODES_TX (RIG_MODE_FM|RIG_MODE_FMN)
@ -1502,7 +1502,7 @@ int thd72_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
serial_setup(rp);
usleep(100 * 1000); /* let the pcr settle */
hl_usleep(100 * 1000); /* let the pcr settle */
serial_flush(rp); /* flush any remaining data */
ret = ser_set_rts(rp, 1); /* setRTS or Hardware flow control? */

Wyświetl plik

@ -1513,7 +1513,7 @@ int thd74_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
serial_setup(rp);
usleep(100 * 1000); /* let the pcr settle */
hl_usleep(100 * 1000); /* let the pcr settle */
serial_flush(rp); /* flush any remaining data */
ret = ser_set_rts(rp, 1); /* setRTS or Hardware flow control? */

Wyświetl plik

@ -4,10 +4,6 @@
#if defined(WIN32) && !defined(HAVE_TERMIOS_H)
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* usleep() */
#endif
#undef DEBUG
#undef TRACE
@ -1631,9 +1627,9 @@ int win32_serial_read(int fd, void *vb, int size)
if (stat.cbInQue < index->ttyset->c_cc[VMIN])
{
/*
usleep(50);
hl_usleep(50);
*/
usleep(100); /* don't hog the CPU while waiting */
hl_usleep(100); /* don't hog the CPU while waiting */
/* we should use -1 instead of 0 for disabled timeout */
now = GetTickCount();
@ -1665,7 +1661,7 @@ int win32_serial_read(int fd, void *vb, int size)
do
{
ClearErrors(index, &stat);
usleep(1000);
hl_usleep(1000);
}
while (stat.cbInQue < index->ttyset->c_cc[VMIN] && c > clock());
@ -1700,7 +1696,7 @@ int win32_serial_read(int fd, void *vb, int size)
case ERROR_MORE_DATA:
/*
usleep(1000);
hl_usleep(1000);
*/
report("ERROR_MORE_DATA\n");
break;
@ -1746,14 +1742,14 @@ int win32_serial_read(int fd, void *vb, int size)
sprintf(message, "end nBytes=%ld] ", nBytes);
report(message);
/*
usleep(1000);
hl_usleep(1000);
*/
report("ERROR_IO_PENDING\n");
break;
default:
/*
usleep(1000);
hl_usleep(1000);
*/
YACK();
return -1;
@ -1765,7 +1761,7 @@ int win32_serial_read(int fd, void *vb, int size)
total += nBytes;
/*
usleep(1000);
hl_usleep(1000);
*/
ClearErrors(index, &stat);
return (total);
@ -1829,8 +1825,8 @@ int win32_serial_read(int fd, void *vb, int size)
#endif /* DEBUG_VERBOSE */
ClearErrors(index, &Stat);
/*
usleep(1000);
usleep(50);
hl_usleep(1000);
hl_usleep(50);
*/
/* we should use -1 instead of 0 for disabled timeout */
now = GetTickCount();
@ -1863,7 +1859,7 @@ int win32_serial_read(int fd, void *vb, int size)
do
{
error = ClearErrors(index, &Stat);
usleep(1000);
hl_usleep(1000);
}
while (c > clock());
@ -1898,7 +1894,7 @@ int win32_serial_read(int fd, void *vb, int size)
case ERROR_MORE_DATA:
/*
usleep(1000);
hl_usleep(1000);
*/
report("ERROR_MORE_DATA\n");
break;
@ -1946,14 +1942,14 @@ int win32_serial_read(int fd, void *vb, int size)
sprintf(message, "end nBytes=%ld] ", nBytes);
report(message);
/*
usleep(1000);
hl_usleep(1000);
*/
report("ERROR_IO_PENDING\n");
break;
default:
/*
usleep(1000);
hl_usleep(1000);
*/
YACK();
errno = EIO;
@ -1967,7 +1963,7 @@ int win32_serial_read(int fd, void *vb, int size)
total += nBytes;
/*
usleep(1000);
hl_usleep(1000);
*/
ClearErrors(index, &Stat);
printf("7\n");
@ -2876,7 +2872,7 @@ int tcsendbreak(int fd, int duration)
}
/* 0.25 seconds == 250000 usec */
usleep(duration * 250000);
hl_usleep(duration * 250000);
if (!ClearCommBreak(index->hComm))
{
@ -3722,7 +3718,7 @@ static void termios_interrupt_event_loop(int fd, int flag)
/*
index->event_flag = 0;
TRENT SetCommMask( index->hComm, index->event_flag );
usleep(2000);
hl_usleep(2000);
tcdrain( index->fd );
SetEvent( index->sol.hEvent );
*/
@ -3786,9 +3782,9 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
things can fire up
this does happen. loops ~twice on a 350 Mzh with
usleep(1000000)
hl_usleep(1000000)
*/
/* usleep(10000); */
/* hl_usleep(10000); */
LEAVE("serial_uselect");
return (0);
}
@ -3820,7 +3816,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
goto end;
}
usleep(10000);
hl_usleep(10000);
/* FIXME: not very accurate wrt process time */
timeout_usec -= 10000;
@ -3885,7 +3881,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
end:
/* You may want to chop this out for lower latency */
/* usleep(1000); */
/* hl_usleep(1000); */
LEAVE("serial_select");
return (1);
timeout:
@ -3913,7 +3909,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
if (fd <= 0)
{
/* usleep(1000); */
/* hl_usleep(1000); */
return 1;
}
@ -3932,7 +3928,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
while (!index->event_flag)
{
/* usleep(1000); */
/* hl_usleep(1000); */
return -1;
}
@ -4012,7 +4008,7 @@ int win32_serial_select(int n, fd_set *readfds, fd_set *writefds,
end:
/*
usleep(1000);
hl_usleep(1000);
*/
LEAVE("serial_select");
return (1);

Wyświetl plik

@ -247,7 +247,7 @@ rc2800_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
retval1 = rc2800_transaction(rot, cmdstr, NULL, 0);
/* do not overwhelm the MCU? */
usleep(200 * 1000);
hl_usleep(200 * 1000);
num_sprintf(cmdstr, "E%3.1f"CR, el);
retval2 = rc2800_transaction(rot, cmdstr, NULL, 0);
@ -333,7 +333,7 @@ rc2800_rot_stop(ROT *rot)
if (retval != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: az S command failed?\n", __func__); }
/* do not overwhelm the MCU? */
usleep(200 * 1000);
hl_usleep(200 * 1000);
/* Stop EL*/
retval = rc2800_transaction(rot, "E" CR, NULL, 0); /* select EL */

Wyświetl plik

@ -580,15 +580,15 @@ pcr_open(RIG *rig)
serial_setup(&rs->rigport);
/* let the pcr settle and flush any remaining data*/
usleep(100 * 1000);
hl_usleep(100 * 1000);
serial_flush(&rs->rigport);
/* try powering on twice, sometimes the pcr answers H100 (off) */
pcr_send(rig, "H101");
usleep(100 * 250);
hl_usleep(100 * 250);
pcr_send(rig, "H101");
usleep(100 * 250);
hl_usleep(100 * 250);
serial_flush(&rs->rigport);

Wyświetl plik

@ -109,7 +109,7 @@ int HAMLIB_API port_open(hamlib_port_t *p)
*/
if (want_state_delay)
{
usleep(100 * 1000);
hl_usleep(100 * 1000);
}
break;
@ -449,7 +449,7 @@ int HAMLIB_API write_block(hamlib_port_t *p, const char *txbuffer, size_t count)
/*
* optional delay after last write
*/
usleep(date_delay);
hl_sleep(date_delay);
}
p->post_write_date.tv_sec = 0;
@ -477,7 +477,7 @@ int HAMLIB_API write_block(hamlib_port_t *p, const char *txbuffer, size_t count)
return -RIG_EIO;
}
usleep(p->write_delay * 1000);
hl_usleep(p->write_delay * 1000);
}
}
else
@ -511,7 +511,7 @@ int HAMLIB_API write_block(hamlib_port_t *p, const char *txbuffer, size_t count)
}
else
#endif
usleep(p->post_write_delay * 1000); /* optional delay after last write */
hl_usleep(p->post_write_delay * 1000); /* optional delay after last write */
/* otherwise some yaesu rigs get confused */
/* with sequential fast writes*/

Wyświetl plik

@ -35,11 +35,29 @@
* \param same as man page for each
*
*/
#ifdef HAVE_NANOSLEEP
#include <unistd.h>
#include <errno.h>
#include <time.h>
// In order to stop the usleep warnings in cppcheck we provide our own interface
// So this will use system usleep or our usleep depending on availability of nanosleep
// This version of usleep can handle > 1000000 usec values
int hl_usleep(useconds_t usec)
{
int retval = 0;
while (usec > 1000000)
{
if (retval != 0) { return retval; }
retval = usleep(1000000);
usec -= 1000000;
}
return usleep(usec);
}
#ifdef HAVE_NANOSLEEP
unsigned int sleep(unsigned int secs)
{
int retval;
@ -54,6 +72,7 @@ unsigned int sleep(unsigned int secs)
return 0;
}
// Does not have the same 1000000 limit as usleep
int usleep(useconds_t usec)
{

Wyświetl plik

@ -729,7 +729,7 @@ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
}
/* Orion may need some time to "recover" from ?RxM before ?RxF */
usleep(80000); // try 80 ms
hl_usleep(80000); // try 80 ms
/* Query passband width (filter) */
cmd_len = sprintf(cmdbuf, "?R%cF" EOM, ttreceiver);
resp_len = sizeof(respbuf);
@ -1833,7 +1833,7 @@ int tt565_send_morse(RIG *rig, vfo_t vfo, const char *msg)
}
keyer_set = TRUE;
usleep(100000); /* 100 msec - guess */
hl_usleep(100000); /* 100 msec - guess */
}
msg_len = strlen(msg);

Wyświetl plik

@ -512,7 +512,7 @@ int main(int argc, char *argv[])
do { // we'll try 5 times and sleep 200ms between tries
retcode = rig_open(my_rig);
if (retcode != RIG_OK) {
usleep(200000);
hl_usleep(200000);
rig_debug(RIG_DEBUG_TRACE, "%s: error opening rig, try#%d\n", __func__, i+1);
}
} while (retcode != RIG_OK && ++i < 5);

Wyświetl plik

@ -668,7 +668,7 @@ static int write_block2(void *func,
size_t count)
{
int retval = write_block(p, txbuffer, count);
usleep(5000);
hl_usleep(5000);
if (retval != RIG_OK)
{

Wyświetl plik

@ -366,7 +366,7 @@ int main(int argc, char *argv[])
while (fabs(azimuth - rot->state.min_az) > 1.)
{
rot_get_position(rot, &azimuth, &elevation);
usleep(step);
hl_usleep(step);
}
fprintf(stderr, "Now initiating full 360° rotation...\n");

Wyświetl plik

@ -321,7 +321,7 @@ int main(int argc, char *argv[])
value_t swr;
rig_set_ptt(rig, RIG_VFO_CURR, RIG_PTT_ON);
usleep(500000);
hl_usleep(500000);
rig_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_SWR, &swr);
rig_set_ptt(rig, RIG_VFO_CURR, RIG_PTT_OFF);

Wyświetl plik

@ -324,7 +324,7 @@ static void read_7xxx_adc(int adc_result[NUM_CHANNELS][NUM_SAMPLES])
//read more samples
for (j = 0; j < NUM_SAMPLES; j++)
{
usleep(10000);
hl_usleep(10000);
adc_result[i][j] = read_channel(adc_page, cur_ch);
}
}

Wyświetl plik

@ -327,7 +327,7 @@ static void read_7xxx_adc(int adc_result[NUM_CHANNELS][NUM_SAMPLES])
//read more samples
for (j = 0; j < NUM_SAMPLES; j++)
{
usleep(10000);
hl_usleep(10000);
adc_result[i][j] = read_channel(adc_page, cur_ch);
}
}

Wyświetl plik

@ -3339,7 +3339,7 @@ int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
return err;
}
usleep(rig_s->rigport.write_delay * 1000);
hl_usleep(rig_s->rigport.write_delay * 1000);
return RIG_OK;
}
@ -3402,7 +3402,7 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
return err;
}
usleep(rig_s->rigport.write_delay * 1000);
hl_usleep(rig_s->rigport.write_delay * 1000);
return RIG_OK;
}
@ -3464,7 +3464,7 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
return err;
}
usleep(rig_s->rigport.write_delay * 1000);
hl_usleep(rig_s->rigport.write_delay * 1000);
return RIG_OK;
}
@ -3532,7 +3532,7 @@ int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
return err;
}
usleep(rig_s->rigport.write_delay * 1000);
hl_usleep(rig_s->rigport.write_delay * 1000);
return RIG_OK;
}

Wyświetl plik

@ -753,7 +753,7 @@ int ft757_get_update_data(RIG *rig)
__func__, retval, FT757GX_STATUS_UPDATE_DATA_LENGTH,
nbtries, maxtries);
/* The delay is quadratic. */
usleep(nbtries * nbtries * 1000000);
hl_usleep(nbtries * nbtries * 1000000);
}
if (retval != FT757GX_STATUS_UPDATE_DATA_LENGTH)

Wyświetl plik

@ -1006,7 +1006,7 @@ int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
if (ptt_response != ptt)
{
usleep(1000l *
hl_usleep(1000l *
FT817_RETRY_DELAY); // Wait before next try. Helps with slower rigs cloning FT817 protocol (e.g. MCHF)
}
@ -1297,7 +1297,7 @@ int ft817_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
rig_force_cache_timeout(&((struct ft817_priv_data *)
rig->state.priv)->fm_status_tv);
n = ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_VFOAB);
usleep(100 * 1000); // rig needs a little time to do this
hl_usleep(100 * 1000); // rig needs a little time to do this
return n;
default:

Wyświetl plik

@ -2263,7 +2263,7 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status)
// when powering on need a dummy byte to wake it up
// then sleep from 1 to 2 seconds so we'll do 1.5 secs
write_block(&state->rigport, "\n", 1);
usleep(1500000);
hl_usleep(1500000);
break;
case RIG_POWER_OFF: