Commit 73173169 authored by Niclas Finne's avatar Niclas Finne
Browse files

energest: removed energest type ENERGEST_TYPE_IRQ

parent 8b930bfa
......@@ -68,8 +68,6 @@ __attribute__ ((__naked__))
void
svcall_handler(void)
{
/* This is a controlled system handler, so do not use ENERGEST_TYPE_IRQ. */
/*
* Decide whether to switch to the main thread or to a process thread,
* depending on the type of the thread preempted by SVCall.
......@@ -124,8 +122,6 @@ __attribute__ ((__naked__))
void
pendsv_handler(void)
{
/* This is a controlled system handler, so do not use ENERGEST_TYPE_IRQ. */
/*
* Return without doing anything if PendSV has not preempted a process thread.
* This can occur either because PendSV has preempted the main thread, in
......
......@@ -241,11 +241,7 @@ clock_adjust(void)
void
clock_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
update_ticks();
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
......
......@@ -1060,16 +1060,12 @@ PROCESS_THREAD(cc2538_rf_process, ev, data)
void
cc2538_rf_rx_tx_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(!poll_mode) {
process_poll(&cc2538_rf_process);
}
/* We only acknowledge FIFOP so we can safely wipe out the entire SFR */
REG(RFCORE_SFR_RFIRQF0) = 0;
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/**
......@@ -1091,8 +1087,6 @@ cc2538_rf_rx_tx_isr(void)
void
cc2538_rf_err_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
PRINTF("RF Error: 0x%08lx\n", REG(RFCORE_SFR_RFERRF));
/* If the error is not an RX FIFO overflow, set a flag */
......@@ -1103,8 +1097,6 @@ cc2538_rf_err_isr(void)
REG(RFCORE_SFR_RFERRF) = 0;
process_poll(&cc2538_rf_process);
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
void
......
......@@ -36,7 +36,6 @@
* Implementation of the cc2538 AES/SHA cryptoprocessor driver
*/
#include "contiki.h"
#include "sys/energest.h"
#include "dev/sys-ctrl.h"
#include "dev/nvic.h"
#include "dev/crypto.h"
......@@ -59,8 +58,6 @@ static volatile struct process *notification_process = NULL;
void
crypto_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
NVIC_ClearPendingIRQ(AES_IRQn);
NVIC_DisableIRQ(AES_IRQn);
......@@ -68,8 +65,6 @@ crypto_isr(void)
process_poll((struct process *)notification_process);
notification_process = NULL;
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
static bool
......
......@@ -36,7 +36,6 @@
* Implementation of the cc2538 GPIO controller
*/
#include "contiki.h"
#include "sys/energest.h"
#include "dev/leds.h"
#include "dev/gpio.h"
#include "dev/nvic.h"
......@@ -90,8 +89,6 @@ gpio_port_isr(uint8_t port)
lpm_exit();
ENERGEST_ON(ENERGEST_TYPE_IRQ);
base = GPIO_PORT_TO_BASE(port);
int_status = GPIO_GET_MASKED_INT_STATUS(base);
power_up_int_status = GPIO_GET_POWER_UP_INT_STATUS(port);
......@@ -100,8 +97,6 @@ gpio_port_isr(uint8_t port)
GPIO_CLEAR_INTERRUPT(base, int_status);
GPIO_CLEAR_POWER_UP_INTERRUPT(port, power_up_int_status);
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
#define GPIO_PORT_ISR(lowercase_port, uppercase_port) \
......
......@@ -40,7 +40,6 @@
* Implementation of the cc2538 PKA engine driver
*/
#include "contiki.h"
#include "sys/energest.h"
#include "dev/pka.h"
#include "dev/sys-ctrl.h"
#include "dev/nvic.h"
......@@ -62,8 +61,6 @@ static volatile struct process *notification_process = NULL;
void
pka_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
NVIC_ClearPendingIRQ(PKA_IRQn);
NVIC_DisableIRQ(PKA_IRQn);
......@@ -71,8 +68,6 @@ pka_isr(void)
process_poll((struct process *)notification_process);
notification_process = NULL;
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
static bool
......
......@@ -36,7 +36,6 @@
* Implementation of the cc2538 UART driver
*/
#include "contiki.h"
#include "sys/energest.h"
#include "dev/sys-ctrl.h"
#include "dev/ioc.h"
#include "dev/gpio.h"
......@@ -363,8 +362,6 @@ uart_isr(uint8_t uart)
uint32_t uart_base;
uint16_t mis;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
uart_base = uart_regs[uart].base;
/* Store the current MIS and clear all flags early, except the RTM flag.
......@@ -387,8 +384,6 @@ uart_isr(uint8_t uart)
/* ISR triggered due to some error condition */
reset(uart_base);
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
#define UART_ISR(u) void uart##u##_isr(void) { uart_isr(u); }
......
......@@ -51,18 +51,6 @@
#if LPM_CONF_ENABLE != 0
/*---------------------------------------------------------------------------*/
#if ENERGEST_CONF_ON
static unsigned long irq_energest = 0;
#define ENERGEST_IRQ_SAVE(a) do { \
a = energest_type_time(ENERGEST_TYPE_IRQ); } while(0)
#define ENERGEST_IRQ_RESTORE(a) do { \
energest_type_set(ENERGEST_TYPE_IRQ, a); } while(0)
#else
#define ENERGEST_IRQ_SAVE(a) do {} while(0)
#define ENERGEST_IRQ_RESTORE(a) do {} while(0)
#endif
/*---------------------------------------------------------------------------*/
/*
* Deep Sleep thresholds in rtimer ticks (~30.5 usec)
*
......@@ -130,9 +118,6 @@ enter_pm0(void)
{
ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM);
/* We are only interested in IRQ energest while idle or in LPM */
ENERGEST_IRQ_RESTORE(irq_energest);
/* Remember the current time so we can keep stats when we wake up */
if(LPM_CONF_STATS) {
sleep_enter_time = RTIMER_NOW();
......@@ -143,9 +128,6 @@ enter_pm0(void)
/* We reach here when the interrupt context that woke us up has returned */
LPM_STATS_ADD(0, RTIMER_NOW() - sleep_enter_time);
/* Remember IRQ energest for next pass */
ENERGEST_IRQ_SAVE(irq_energest);
ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
}
/*---------------------------------------------------------------------------*/
......@@ -233,9 +215,6 @@ lpm_exit()
/* Restore PMCTL to PM0 for next pass */
REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM0;
/* Remember IRQ energest for next pass */
ENERGEST_IRQ_SAVE(irq_energest);
ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
}
/*---------------------------------------------------------------------------*/
......@@ -307,8 +286,6 @@ lpm_enter()
REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM1;
}
/* We are only interested in IRQ energest while idle or in LPM */
ENERGEST_IRQ_RESTORE(irq_energest);
ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM);
/* Remember the current time so we can keep stats when we wake up */
......@@ -333,8 +310,6 @@ lpm_enter()
REG(SYS_CTRL_PMCTL) = SYS_CTRL_PMCTL_PM0;
/* Remember IRQ energest for next pass */
ENERGEST_IRQ_SAVE(irq_energest);
ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
} else {
/* All clear. Assert WFI and drop to PM1/2. This is now un-interruptible */
......
......@@ -37,7 +37,6 @@
*
*/
#include "contiki.h"
#include "sys/energest.h"
#include "sys/rtimer.h"
#include "dev/nvic.h"
#include "dev/smwdthrosc.h"
......@@ -143,16 +142,12 @@ rtimer_isr()
*/
lpm_exit();
ENERGEST_ON(ENERGEST_TYPE_IRQ);
next_trigger = 0;
NVIC_ClearPendingIRQ(SMT_IRQn);
NVIC_DisableIRQ(SMT_IRQn);
rtimer_run_next();
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */
......@@ -37,7 +37,6 @@
* the cc2530 driver written by Philippe Retornaz
*/
#include "contiki.h"
#include "energest.h"
#include "usb-arch.h"
#include "usb-api.h"
#include "dev/usb-regs.h"
......@@ -1257,8 +1256,6 @@ usb_isr(void)
uint8_t common_if = REG(USB_CIF) & REG(USB_CIE);
uint8_t i;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(ep_in_if) {
/* EP0 flag is in the IN Interrupt Flags register */
if(ep_in_if & USB_IIF_EP0IF) {
......@@ -1287,8 +1284,6 @@ usb_isr(void)
if(common_if & USB_CIF_SUSPENDIF) {
notify_process(USB_EVENT_SUSPEND);
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
......
......@@ -46,7 +46,6 @@
#include "uart.h"
#include "lpm.h"
#include "ti-lib.h"
#include "sys/energest.h"
#include <stdint.h>
#include <stdbool.h>
......@@ -366,8 +365,6 @@ cc26xx_uart_isr(void)
char the_char;
uint32_t flags;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
power_and_clock();
/* Read out the masked interrupt status */
......@@ -389,8 +386,6 @@ cc26xx_uart_isr(void)
}
}
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */
......@@ -38,7 +38,6 @@
/*---------------------------------------------------------------------------*/
#include "ioc.h"
#include "gpio-interrupt.h"
#include "sys/energest.h"
#include "lpm.h"
#include "ti-lib.h"
......@@ -83,8 +82,6 @@ gpio_interrupt_isr(void)
uint32_t pin_mask;
uint8_t i;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
/* Read interrupt flags */
pin_mask = (HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) & GPIO_DIO_ALL_MASK);
......@@ -98,8 +95,6 @@ gpio_interrupt_isr(void)
handlers[i](i);
}
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */
......@@ -37,7 +37,6 @@
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "sys/energest.h"
#include "rtimer.h"
#include "lpm.h"
......@@ -146,8 +145,6 @@ soc_rtc_isr(void)
{
uint32_t next;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
last_isr_time = RTIMER_NOW();
/* Adjust the s/w tick counter irrespective of which event trigger this */
......@@ -177,8 +174,6 @@ soc_rtc_isr(void)
ti_lib_aon_rtc_channel_disable(AON_RTC_CH2);
HWREG(AON_RTC_BASE + AON_RTC_O_EVFLAGS) = AON_RTC_EVFLAGS_CH2;
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */
......@@ -284,8 +284,6 @@ PROCESS_THREAD(soc_trng_process, ev, data)
void
soc_trng_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
ti_lib_trng_disable();
disable_number_ready_interrupt();
......@@ -294,8 +292,6 @@ soc_trng_isr(void)
ti_lib_trng_enable();
process_post(&soc_trng_process, rng_ready_event, NULL);
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
void
......
......@@ -56,18 +56,6 @@
#include <string.h>
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
#if ENERGEST_CONF_ON
static unsigned long irq_energest = 0;
#define ENERGEST_IRQ_SAVE(a) do { \
a = energest_type_time(ENERGEST_TYPE_IRQ); } while(0)
#define ENERGEST_IRQ_RESTORE(a) do { \
energest_type_set(ENERGEST_TYPE_IRQ, a); } while(0)
#else
#define ENERGEST_IRQ_SAVE(a) do {} while(0)
#define ENERGEST_IRQ_RESTORE(a) do {} while(0)
#endif
/*---------------------------------------------------------------------------*/
LIST(modules_list);
/*---------------------------------------------------------------------------*/
/* PDs that may stay on in deep sleep */
......@@ -197,8 +185,6 @@ wake_up(void)
{
lpm_registered_module_t *module;
/* Remember IRQ energest for next pass */
ENERGEST_IRQ_SAVE(irq_energest);
ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
/* Sync so that we get the latest values before adjusting recharge settings */
......@@ -389,17 +375,11 @@ lpm_sleep(void)
{
ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM);
/* We are only interested in IRQ energest while idle or in LPM */
ENERGEST_IRQ_RESTORE(irq_energest);
/* Just to be on the safe side, explicitly disable Deep Sleep */
HWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP);
ti_lib_prcm_sleep();
/* Remember IRQ energest for next pass */
ENERGEST_IRQ_SAVE(irq_energest);
ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
}
/*---------------------------------------------------------------------------*/
......@@ -505,8 +485,6 @@ deep_sleep(void)
ti_lib_pwr_ctrl_source_set(PWRCTRL_PWRSRC_ULDO);
}
/* We are only interested in IRQ energest while idle or in LPM */
ENERGEST_IRQ_RESTORE(irq_energest);
ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM);
/* Sync the AON interface to ensure all writes have gone through. */
......
......@@ -567,8 +567,6 @@ rx_nok_isr(void)
void
cc26xx_rf_cpe1_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
PRINTF("RF Error\n");
if(!rf_core_is_accessible()) {
......@@ -579,15 +577,11 @@ cc26xx_rf_cpe1_isr(void)
/* Clear INTERNAL_ERROR interrupt flag */
HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x7FFFFFFF;
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
void
cc26xx_rf_cpe0_isr(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(!rf_core_is_accessible()) {
printf("RF ISR called but RF not ready... PANIC!!\n");
if(rf_core_power_up() != RF_CORE_CMD_OK) {
......@@ -619,8 +613,6 @@ cc26xx_rf_cpe0_isr(void)
}
ti_lib_int_master_enable();
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */
......@@ -42,7 +42,7 @@ extern volatile uint16_t cc2420_sfd_end_time;
ISR(TIMERB1, cc2420_timerb1_interrupt)
{
int tbiv;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
/* always read TBIV to clear IFG */
tbiv = TBIV;
/* read and discard tbiv to avoid "variable set but not used" warning */
......@@ -54,7 +54,6 @@ ISR(TIMERB1, cc2420_timerb1_interrupt)
cc2420_sfd_counter = 0;
cc2420_sfd_end_time = TBCCR1;
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
void
......
......@@ -50,13 +50,9 @@
/*---------------------------------------------------------------------------*/
ISR(CC2420_IRQ, cc2420_port1_interrupt)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(cc2420_interrupt()) {
LPM4_EXIT;
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
void
......
......@@ -41,7 +41,7 @@ extern volatile uint16_t cc2520_sfd_end_time;
ISR(TIMERB1, cc2520_timerb1_interrupt)
{
int tbiv;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
/* always read TBIV to clear IFG */
tbiv = TBIV;
/* read and discard tbiv to avoid "variable set but not used" warning */
......@@ -53,7 +53,6 @@ ISR(TIMERB1, cc2520_timerb1_interrupt)
cc2520_sfd_counter = 0;
cc2520_sfd_end_time = TBCCR1;
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
void
......
......@@ -49,13 +49,9 @@
/*---------------------------------------------------------------------------*/
ISR(CC2520_IRQ, cc2520_port1_interrupt)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(cc2520_interrupt()) {
LPM4_EXIT;
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment