cc2x3x clock driver cleanup
* Bit-Addressable SFRs are now accessed as such, instead of (N)OR-ing the byte * A routine was declared as CCIF but not defined as such. Fixed * Deleted a leftover duplicate define * Formatting * Comment updates and clarifications
This commit is contained in:
parent
1fd7dcd2ef
commit
ffa3a1c4c3
2 changed files with 31 additions and 52 deletions
|
@ -27,15 +27,14 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: clock.c,v 1.1 2009/09/08 20:07:35 zdshelby Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Implementation of the clock functions for the 8051 CPU
|
||||
* Implementation of the clock functions for the cc253x.
|
||||
* Ported over from the cc243x original.
|
||||
* \author
|
||||
* Zach Shelby (zach@sensinode.com) - original
|
||||
* Zach Shelby (zach@sensinode.com) - original (cc243x)
|
||||
* George Oikonomou - <oikonomou@users.sourceforge.net> - cc2530 port
|
||||
*/
|
||||
#include "sfr-bits.h"
|
||||
|
@ -47,8 +46,6 @@
|
|||
/* Sleep timer runs on the 32k RC osc. */
|
||||
/* One clock tick is 7.8 ms */
|
||||
#define TICK_VAL (32768/128) /* 256 */
|
||||
|
||||
#define MAX_TICKS (~((clock_time_t)0) / 2)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Do NOT remove the absolute address and do NOT remove the initialiser here */
|
||||
__xdata __at(0x0000) static unsigned long timer_value = 0;
|
||||
|
@ -117,7 +114,7 @@ clock_init(void)
|
|||
CLKCONCMD |= CLKCONCMD_TICKSPD2 | CLKCONCMD_TICKSPD1;
|
||||
while(CLKCONSTA != CLKCONCMD);
|
||||
|
||||
/*Initialize tick value*/
|
||||
/* Initialize tick value */
|
||||
timer_value = ST0;
|
||||
timer_value += ((unsigned long int) ST1) << 8;
|
||||
timer_value += ((unsigned long int) ST2) << 16;
|
||||
|
@ -126,7 +123,7 @@ clock_init(void)
|
|||
ST1 = (unsigned char) (timer_value >> 8);
|
||||
ST0 = (unsigned char) timer_value;
|
||||
|
||||
STIE = 1; /* IEN0.STIE interrupt enable */
|
||||
STIE = 1; /* IEN0.STIE interrupt enable */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
@ -135,15 +132,6 @@ clock_isr(void) __interrupt(ST_VECTOR)
|
|||
DISABLE_INTERRUPTS();
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
/*
|
||||
* If the Sleep timer throws an interrupt while we are powering down to
|
||||
* PM1, we need to abort the power down. Clear SLEEP.MODE, this will signal
|
||||
* main() to abort the PM1 transition
|
||||
*
|
||||
* On cc2430 this would be:
|
||||
* SLEEPCMD &= 0xFC;
|
||||
*/
|
||||
|
||||
/*
|
||||
* Read value of the ST0:ST1:ST2, add TICK_VAL and write it back.
|
||||
* Next interrupt occurs after the current time + TICK_VAL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue