Sansa Connect: use udelay() in AVR spi_txrx().

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31377 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Tomasz Moń 2011-12-20 13:36:43 +00:00
parent 4aec001244
commit 44d1a26271
2 changed files with 7 additions and 9 deletions

View file

@ -426,7 +426,7 @@ void udelay(int usec) {
stop = count + usec*((tmp+1)/10000);
stop += (unsigned short)(((unsigned long)(usec)*((tmp%10000)+1))/10000);
/* stop values over tmdiv won't ever be reached */
/* stop values over TMDIV won't ever be reached */
if (stop > tmp)
{
stop -= tmp;
@ -435,15 +435,13 @@ void udelay(int usec) {
if (stop < count)
{
/* udelay will end after counter reset (tick) */
while ((((tmp = IO_TIMER1_TMCNT) < stop) &&
(current_tick != prev_tick)) ||
while (((IO_TIMER1_TMCNT < stop) && (current_tick != prev_tick)) ||
(current_tick == prev_tick)); /* ensure new tick */
}
else
{
/* udelay will end before counter reset (tick) */
while (((tmp = IO_TIMER1_TMCNT) < stop) &&
(current_tick == prev_tick));
while ((IO_TIMER1_TMCNT < stop) && (current_tick == prev_tick));
}
}