Added energy estimation
This commit is contained in:
parent
9277197506
commit
9a5bac6282
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: cc2420_uart0.c,v 1.2 2006/08/17 15:41:13 bg- Exp $
|
* @(#)$Id: cc2420_uart0.c,v 1.3 2007/05/22 20:59:11 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -41,8 +41,11 @@
|
||||||
interrupt(PORT1_VECTOR)
|
interrupt(PORT1_VECTOR)
|
||||||
__fifop_interrupt(void)
|
__fifop_interrupt(void)
|
||||||
{
|
{
|
||||||
if(__cc2420_intr())
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
|
if(__cc2420_intr()) {
|
||||||
LPM4_EXIT;
|
LPM4_EXIT;
|
||||||
|
}
|
||||||
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: clock.c,v 1.6 2007/04/02 16:32:20 joxe Exp $
|
* @(#)$Id: clock.c,v 1.7 2007/05/22 20:59:27 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include "contiki-conf.h"
|
#include "contiki-conf.h"
|
||||||
|
|
||||||
|
#include "lib/energest.h"
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
#include "sys/etimer.h"
|
#include "sys/etimer.h"
|
||||||
|
|
||||||
|
@ -50,6 +51,7 @@ static volatile clock_time_t count = 0;
|
||||||
static unsigned short last_tar = 0;
|
static unsigned short last_tar = 0;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
interrupt(TIMERA1_VECTOR) timera1 (void) {
|
interrupt(TIMERA1_VECTOR) timera1 (void) {
|
||||||
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
if(TAIV == 2) {
|
if(TAIV == 2) {
|
||||||
TACCR1 += INTERVAL;
|
TACCR1 += INTERVAL;
|
||||||
last_tar = TAR;
|
last_tar = TAR;
|
||||||
|
@ -61,6 +63,7 @@ interrupt(TIMERA1_VECTOR) timera1 (void) {
|
||||||
LPM4_EXIT;
|
LPM4_EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
clock_time_t
|
clock_time_t
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: uart1.c,v 1.1 2007/03/15 21:37:19 adamdunkels Exp $
|
* @(#)$Id: uart1.c,v 1.2 2007/05/22 21:01:51 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include "lib/energest.h"
|
||||||
#include "dev/uart1.h"
|
#include "dev/uart1.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -110,6 +111,7 @@ uart1_init(unsigned long ubr)
|
||||||
interrupt(UART1RX_VECTOR)
|
interrupt(UART1RX_VECTOR)
|
||||||
uart1_interrupt(void)
|
uart1_interrupt(void)
|
||||||
{
|
{
|
||||||
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
/* Check status register for receive errors. */
|
/* Check status register for receive errors. */
|
||||||
if(URCTL1 & RXERR) {
|
if(URCTL1 & RXERR) {
|
||||||
volatile unsigned dummy;
|
volatile unsigned dummy;
|
||||||
|
@ -119,5 +121,6 @@ uart1_interrupt(void)
|
||||||
LPM4_EXIT;
|
LPM4_EXIT;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: slip_uart1.c,v 1.6 2007/03/29 23:43:59 adamdunkels Exp $
|
* @(#)$Id: slip_uart1.c,v 1.7 2007/05/22 21:00:27 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -136,12 +136,15 @@ slip_arch_init(unsigned long ubr)
|
||||||
interrupt(UART1RX_VECTOR)
|
interrupt(UART1RX_VECTOR)
|
||||||
__uart1_intr()
|
__uart1_intr()
|
||||||
{
|
{
|
||||||
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
/* Check status register for receive errors. */
|
/* Check status register for receive errors. */
|
||||||
if (URCTL1 & RXERR) {
|
if(URCTL1 & RXERR) {
|
||||||
volatile unsigned dummy;
|
volatile unsigned dummy;
|
||||||
dummy = RXBUF1; /* Clear error flags by forcing a dummy read. */
|
dummy = RXBUF1; /* Clear error flags by forcing a dummy read. */
|
||||||
} else {
|
} else {
|
||||||
if(slip_input_byte(RXBUF1))
|
if(slip_input_byte(RXBUF1)) {
|
||||||
LPM4_EXIT;
|
LPM4_EXIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue