cc2x3x clock_delay(len) now delays for approx. len usecs
This commit is contained in:
parent
3cb26adeda
commit
57969259ce
2 changed files with 10 additions and 9 deletions
|
@ -56,17 +56,17 @@ static volatile __data clock_time_t count = 0; /* Uptime in ticks */
|
||||||
static volatile __data clock_time_t seconds = 0; /* Uptime in secs */
|
static volatile __data clock_time_t seconds = 0; /* Uptime in secs */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* One delay is about 0.6 us, so this function delays for len * 0.6 us
|
* Each iteration is ~1.0xy usec, so this function delays for roughly len usec
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clock_delay(unsigned int len)
|
clock_delay(unsigned int len)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
DISABLE_INTERRUPTS();
|
||||||
for(i = 0; i< len; i++) {
|
while(len--) {
|
||||||
__asm
|
ASM(nop); ASM(nop); ASM(nop);
|
||||||
nop
|
ASM(nop); ASM(nop);
|
||||||
__endasm;
|
|
||||||
}
|
}
|
||||||
|
ENABLE_INTERRUPTS();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,15 +59,16 @@ static volatile __data clock_time_t count = 0; /* Uptime in ticks */
|
||||||
static volatile __data clock_time_t seconds = 0; /* Uptime in secs */
|
static volatile __data clock_time_t seconds = 0; /* Uptime in secs */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* One delay is about 0.6 us, so this function delays for len * 0.6 us
|
* Each iteration is ~1.0xy usec, so this function delays for roughly len usec
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clock_delay(unsigned int len)
|
clock_delay(unsigned int len)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
DISABLE_INTERRUPTS();
|
||||||
for(i = 0; i< len; i++) {
|
while(len--) {
|
||||||
ASM(nop);
|
ASM(nop);
|
||||||
}
|
}
|
||||||
|
ENABLE_INTERRUPTS();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue