Use usleep instead of usdelay as CONFIG_BOARD_LOOPSPERMSEC might not be calibrated correctly and CC3000 is fine with longer wait.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@haltian.com>
This commit is contained in:
Gregory Nutt 2014-11-28 08:16:30 -06:00
parent 2d9bd07525
commit 5f0343bed9
1 changed files with 2 additions and 20 deletions

View File

@ -232,24 +232,6 @@ static inline int cc3000_devgive(FAR struct cc3000_dev_s *priv)
return sem_post(&priv->devsem); return sem_post(&priv->devsem);
} }
/************************************************************************************
* Name: usdelay()
*
* Description:
* timeout = the time out is uS
*
************************************************************************************/
static void usdelay(long ustimeout)
{
volatile int j;
ustimeout = 1 + (ustimeout * CONFIG_BOARD_LOOPSPERMSEC)/1000;
for (j = 0; j < ustimeout; j++)
{
}
}
/**************************************************************************** /****************************************************************************
* Function: cc3000_configspi * Function: cc3000_configspi
* *
@ -1223,9 +1205,9 @@ static ssize_t cc3000_write(FAR struct file *filep, FAR const char *usrbuffer, s
if (priv->state == eSPI_STATE_INITIALIZED) if (priv->state == eSPI_STATE_INITIALIZED)
{ {
cc3000_lock_and_select(priv->spi); /* Assert CS */ cc3000_lock_and_select(priv->spi); /* Assert CS */
usdelay(55); usleep(55);
SPI_SNDBLOCK(priv->spi, buffer, 4); SPI_SNDBLOCK(priv->spi, buffer, 4);
usdelay(55); usleep(55);
SPI_SNDBLOCK(priv->spi, buffer+4, tx_len-4); SPI_SNDBLOCK(priv->spi, buffer+4, tx_len-4);
} }
else else