From 4e4f90c107c351c726bfdfb14852d47acd46a519 Mon Sep 17 00:00:00 2001 From: David Betz Date: Sun, 25 Jan 2015 21:37:19 -0500 Subject: [PATCH] Switch from ms_sleep to us_sleep. --- ploader.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ploader.c b/ploader.c index 2e050c4..b96c180 100644 --- a/ploader.c +++ b/ploader.c @@ -12,7 +12,7 @@ #define ACK_TIMEOUT 20 -static int ms_sleep(unsigned long msecs); +static int us_sleep(unsigned long usecs); static void SerialInit(PL_state *state); static void TByte(PL_state *state, uint8_t x); static void TLong(PL_state *state, uint32_t x); @@ -42,7 +42,7 @@ int PL_LoadSpinBinary(PL_state *state, int loadType, uint8_t *image, int size) TLong(state, data); } TComm(state); - ms_sleep(1); + us_sleep(1000); /* wait for an ACK */ while (--retries >= 0) { @@ -57,11 +57,11 @@ int PL_LoadSpinBinary(PL_state *state, int loadType, uint8_t *image, int size) return retries >= 0 ? 0 : -1; } -static int ms_sleep(unsigned long msecs) +static int us_sleep(unsigned long usecs) { struct timespec req; - req.tv_sec = (int)(msecs / 1000L); - req.tv_nsec = (msecs - (req.tv_sec * 1000)) * 1000000L; + req.tv_sec = (int)(usecs / 1000000L); + req.tv_nsec = (usecs - (req.tv_sec * 1000000L)) * 1000L; while (nanosleep(&req, &req) < 0) ; return 1;