mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-21 19:29:18 +00:00
Adjust cc2x3x ports to the new clock API
This commit is contained in:
parent
efd6d12831
commit
1f7171f943
@ -14,6 +14,11 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* This port no longer implements the legacy clock_delay. Hack its usages
|
||||
* outta the way till it gets phased out completely
|
||||
* NB: This also overwrites the prototype so delay_usec() is declared twice */
|
||||
#define clock_delay(t) clock_delay_usec(t)
|
||||
|
||||
/*
|
||||
* lint - style defines to help syntax parsers with sdcc-specific 8051 code
|
||||
* They don't interfere with actual compilation
|
||||
|
@ -126,7 +126,7 @@ cc2430_rf_command(uint8_t command)
|
||||
case ISTXON:
|
||||
fifo_count = RXFIFOCNT;
|
||||
RFST = command;
|
||||
clock_delay(2);
|
||||
clock_delay_usec(2);
|
||||
if(fifo_count != RXFIFOCNT) {
|
||||
RFST = ISFLUSHRX;
|
||||
RFST = ISFLUSHRX;
|
||||
@ -430,7 +430,7 @@ transmit(unsigned short transmit_len)
|
||||
cc2430_rf_command(ISTXON);
|
||||
counter = 0;
|
||||
while(!(RFSTATUS & TX_ACTIVE) && (counter++ < 3)) {
|
||||
clock_delay(10);
|
||||
clock_delay_usec(6);
|
||||
}
|
||||
|
||||
if(!(RFSTATUS & TX_ACTIVE)) {
|
||||
|
@ -59,11 +59,11 @@ static volatile __data clock_time_t seconds = 0; /* Uptime in secs */
|
||||
* Each iteration is ~1.0xy usec, so this function delays for roughly len usec
|
||||
*/
|
||||
void
|
||||
clock_delay(unsigned int len)
|
||||
clock_delay_usec(uint16_t len)
|
||||
{
|
||||
DISABLE_INTERRUPTS();
|
||||
while(len--) {
|
||||
ASM(nop); ASM(nop); ASM(nop);
|
||||
ASM(nop); ASM(nop);
|
||||
ASM(nop); ASM(nop);
|
||||
}
|
||||
ENABLE_INTERRUPTS();
|
||||
|
@ -19,6 +19,11 @@
|
||||
#include "dev/watchdog.h"
|
||||
#define watchdog_stop() watchdog_periodic()
|
||||
|
||||
/* This port no longer implements the legacy clock_delay. Hack its usages
|
||||
* outta the way till it gets phased out completely
|
||||
* NB: This also overwrites the prototype so delay_usec() is declared twice */
|
||||
#define clock_delay(t) clock_delay_usec(t)
|
||||
|
||||
/*
|
||||
* lint - style defines to help syntax parsers with sdcc-specific 8051 code
|
||||
* They don't interfere with actual compilation
|
||||
|
@ -287,7 +287,7 @@ transmit(unsigned short transmit_len)
|
||||
|
||||
counter = 0;
|
||||
while(!(FSMSTAT1 & FSMSTAT1_TX_ACTIVE) && (counter++ < 3)) {
|
||||
clock_delay(10);
|
||||
clock_delay_usec(6);
|
||||
}
|
||||
|
||||
if(!(FSMSTAT1 & FSMSTAT1_TX_ACTIVE)) {
|
||||
|
@ -62,7 +62,7 @@ static volatile __data clock_time_t seconds = 0; /* Uptime in secs */
|
||||
* Each iteration is ~1.0xy usec, so this function delays for roughly len usec
|
||||
*/
|
||||
void
|
||||
clock_delay(unsigned int len)
|
||||
clock_delay_usec(uint16_t len)
|
||||
{
|
||||
DISABLE_INTERRUPTS();
|
||||
while(len--) {
|
||||
|
@ -16,14 +16,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define TEST_CLOCK_DELAY 1
|
||||
#define TEST_RTIMER 1
|
||||
#define TEST_ETIMER 1
|
||||
#define TEST_CLOCK_SECONDS 1
|
||||
#define TEST_CLOCK_DELAY_USEC 1
|
||||
#define TEST_RTIMER 1
|
||||
#define TEST_ETIMER 1
|
||||
#define TEST_CLOCK_SECONDS 1
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static struct etimer et;
|
||||
|
||||
#if TEST_CLOCK_DELAY
|
||||
#if TEST_CLOCK_DELAY_USEC
|
||||
static rtimer_clock_t start_count, end_count, diff;
|
||||
#endif
|
||||
|
||||
@ -64,16 +64,16 @@ PROCESS_THREAD(clock_test_process, ev, data)
|
||||
|
||||
PROCESS_YIELD();
|
||||
|
||||
#if TEST_CLOCK_DELAY
|
||||
printf("Clock delay test, (10,000 x i) cycles:\n");
|
||||
#if TEST_CLOCK_DELAY_USEC
|
||||
printf("clock_delay_usec test, (10,000 x i) usec:\n");
|
||||
i = 1;
|
||||
while(i < 7) {
|
||||
start_count = RTIMER_NOW();
|
||||
clock_delay(10000 * i);
|
||||
clock_delay_usec(10000 * i);
|
||||
end_count = RTIMER_NOW();
|
||||
diff = end_count - start_count;
|
||||
printf("Delayed %u = %u rtimer ticks = ~%u us\n", 10000 * i, diff,
|
||||
diff * 64);
|
||||
printf("Requested: %u usec, Real: %u rtimer ticks = ~%u us\n",
|
||||
10000 * i, diff, diff * 64);
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
|
@ -76,7 +76,7 @@ PROCESS_THREAD(energy_scan, ev, data)
|
||||
while(1) {
|
||||
cmax = RSSI_BASE;
|
||||
cc2430_rf_channel_set(channel);
|
||||
clock_delay(200);
|
||||
clock_delay_usec(200);
|
||||
|
||||
for(j = 0; j < RSSI_SAMPLES; j++) {
|
||||
t0 = RTIMER_NOW();
|
||||
|
@ -16,14 +16,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define TEST_CLOCK_DELAY 1
|
||||
#define TEST_RTIMER 1
|
||||
#define TEST_ETIMER 1
|
||||
#define TEST_CLOCK_SECONDS 1
|
||||
#define TEST_CLOCK_DELAY_USEC 1
|
||||
#define TEST_RTIMER 1
|
||||
#define TEST_ETIMER 1
|
||||
#define TEST_CLOCK_SECONDS 1
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static struct etimer et;
|
||||
|
||||
#if TEST_CLOCK_DELAY
|
||||
#if TEST_CLOCK_DELAY_USEC
|
||||
static rtimer_clock_t start_count, end_count, diff;
|
||||
#endif
|
||||
|
||||
@ -64,16 +64,16 @@ PROCESS_THREAD(clock_test_process, ev, data)
|
||||
|
||||
PROCESS_YIELD();
|
||||
|
||||
#if TEST_CLOCK_DELAY
|
||||
printf("Clock delay test, (10,000 x i) cycles:\n");
|
||||
#if TEST_CLOCK_DELAY_USEC
|
||||
printf("clock_delay_usec test, (10,000 x i) usec:\n");
|
||||
i = 1;
|
||||
while(i < 7) {
|
||||
start_count = RTIMER_NOW();
|
||||
clock_delay(10000 * i);
|
||||
clock_delay_usec(10000 * i);
|
||||
end_count = RTIMER_NOW();
|
||||
diff = end_count - start_count;
|
||||
printf("Delayed %u = %u rtimer ticks = ~%u us\n", 10000 * i, diff,
|
||||
diff * 64);
|
||||
printf("Requested: %u usec, Real: %u rtimer ticks = ~%u us\n",
|
||||
10000 * i, diff, diff * 64);
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
|
@ -343,7 +343,7 @@ main(void) CC_NON_BANKED
|
||||
* On occasion the XOSC is reported stable when in reality it's not.
|
||||
* We need to wait for a safeguard of 64us or more before selecting it
|
||||
*/
|
||||
clock_delay(10);
|
||||
clock_delay_usec(65);
|
||||
while(CLKCONCMD & CLKCONCMD_OSC); /* Wait till it's happened */
|
||||
}
|
||||
#endif /* LPM_MODE==LPM_MODE_PM2 */
|
||||
|
@ -371,7 +371,7 @@ main(void)
|
||||
* On occasion the XOSC is reported stable when in reality it's not.
|
||||
* We need to wait for a safeguard of 64us or more before selecting it
|
||||
*/
|
||||
clock_delay(10);
|
||||
clock_delay_usec(65);
|
||||
while(CLKCON & OSC); /* Wait till it's happened */
|
||||
}
|
||||
#endif /* LPM_MODE==LPM_MODE_PM2 */
|
||||
|
Loading…
Reference in New Issue
Block a user