cc3200: Make sure to update sleep objects when registered.

This commit is contained in:
Daniel Campora 2015-08-12 16:39:45 +02:00
parent 6ff2d54347
commit 641a3d39e1
2 changed files with 7 additions and 6 deletions

View File

@ -55,6 +55,7 @@
#include "sleeprestore.h" #include "sleeprestore.h"
#include "serverstask.h" #include "serverstask.h"
#include "antenna.h" #include "antenna.h"
#include "cryptohash.h"
/****************************************************************************** /******************************************************************************
DECLARE PRIVATE CONSTANTS DECLARE PRIVATE CONSTANTS
@ -211,10 +212,9 @@ void pybsleep_add (const mp_obj_t obj, WakeUpCB_t wakeup) {
sleep_obj->base.type = &pybsleep_type; sleep_obj->base.type = &pybsleep_type;
sleep_obj->obj = obj; sleep_obj->obj = obj;
sleep_obj->wakeup = wakeup; sleep_obj->wakeup = wakeup;
// only add objects once // remove it in case it was already registered
if (!pybsleep_find(sleep_obj)) { pybsleep_remove (sleep_obj);
mp_obj_list_append(&MP_STATE_PORT(pybsleep_obj_list), sleep_obj); mp_obj_list_append(&MP_STATE_PORT(pybsleep_obj_list), sleep_obj);
}
} }
void pybsleep_remove (const mp_obj_t obj) { void pybsleep_remove (const mp_obj_t obj) {
@ -412,6 +412,9 @@ void pybsleep_suspend_exit (void) {
// reconfigure all the previously enabled interrupts // reconfigure all the previously enabled interrupts
mpcallback_wake_all(); mpcallback_wake_all();
// we need to init the crypto hash engine again
CRYPTOHASH_Init();
// trigger a sw interrupt // trigger a sw interrupt
MAP_IntPendSet(INT_PRCM); MAP_IntPendSet(INT_PRCM);
@ -460,7 +463,6 @@ STATIC void pybsleep_iopark (bool hibernate) {
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)&pin_cpu_pins_locals_dict); mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)&pin_cpu_pins_locals_dict);
for (uint i = 0; i < named_map->used; i++) { for (uint i = 0; i < named_map->used; i++) {
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value; pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
// skip the sflash pins since these are shared with the network processor
switch (pin->pin_num) { switch (pin->pin_num) {
#ifdef DEBUG #ifdef DEBUG
// skip the JTAG pins // skip the JTAG pins

View File

@ -41,7 +41,6 @@
/****************************************************************************** /******************************************************************************
DEFINE PUBLIC FUNCTIONS DEFINE PUBLIC FUNCTIONS
******************************************************************************/ ******************************************************************************/
__attribute__ ((section (".boot")))
void CRYPTOHASH_Init (void) { void CRYPTOHASH_Init (void) {
// Enable the Data Hashing and Transform Engine // Enable the Data Hashing and Transform Engine
MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK); MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);