Change the LPM locks API:
Instead of using a separate data structure to request that a PD remain powered during deep sleep, we do the same within the main LPM data structure through an additional field. This allows us to maintain only one linked list of LPM modules and overall improves code clarity
This commit is contained in:
parent
b3ac3ac0c1
commit
421fbfae25
9 changed files with 38 additions and 96 deletions
|
@ -59,10 +59,10 @@
|
|||
#include "contiki-conf.h"
|
||||
#include "sys/process.h"
|
||||
#include "dev/serial-line.h"
|
||||
#include "dev/cc26xx-uart.h"
|
||||
#include "net/ip/uip.h"
|
||||
#include "net/ip/uip-udp-packet.h"
|
||||
#include "net/ip/uiplib.h"
|
||||
#include "lpm.h"
|
||||
#include "net-uart.h"
|
||||
#include "httpd-simple.h"
|
||||
|
||||
|
@ -148,37 +148,16 @@ net_input(void)
|
|||
return;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* In order to maintain UART input operation:
|
||||
* - Keep the uart clocked in sleep and deep sleep
|
||||
* - Keep the serial PD on in deep sleep
|
||||
*/
|
||||
static lpm_power_domain_lock_t lock;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
release_uart(void)
|
||||
{
|
||||
/* Release serial PD lock */
|
||||
lpm_pd_lock_release(&lock);
|
||||
|
||||
/* Let the UART turn off during Sleep and Deep Sleep */
|
||||
ti_lib_prcm_peripheral_sleep_disable(PRCM_PERIPH_UART0);
|
||||
ti_lib_prcm_peripheral_deep_sleep_disable(PRCM_PERIPH_UART0);
|
||||
ti_lib_prcm_load_set();
|
||||
while(!ti_lib_prcm_load_get());
|
||||
cc26xx_uart_set_input(NULL);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
keep_uart_on(void)
|
||||
{
|
||||
/* Keep the serial PD on */
|
||||
lpm_pd_lock_obtain(&lock, PRCM_DOMAIN_SERIAL);
|
||||
|
||||
/* Keep the UART clock on during Sleep and Deep Sleep */
|
||||
ti_lib_prcm_peripheral_sleep_enable(PRCM_PERIPH_UART0);
|
||||
ti_lib_prcm_peripheral_deep_sleep_enable(PRCM_PERIPH_UART0);
|
||||
ti_lib_prcm_load_set();
|
||||
while(!ti_lib_prcm_load_get());
|
||||
cc26xx_uart_set_input(serial_line_input_byte);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue