cc3200: Add parameter to wlan_stop() for custom timeout values.

This commit is contained in:
danicampora 2015-03-18 21:49:48 +01:00
parent f382f4442e
commit 0e96d1b3f1
6 changed files with 11 additions and 14 deletions

View File

@ -82,11 +82,8 @@ extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
/// Resets the pyboard in a manner similar to pushing the external RESET /// Resets the pyboard in a manner similar to pushing the external RESET
/// button. /// button.
STATIC mp_obj_t pyb_hard_reset(void) { STATIC mp_obj_t pyb_hard_reset(void) {
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP) // disable wlan
// disable wlan services wlan_stop(SL_STOP_TIMEOUT_LONG);
wlan_stop_servers();
#endif
wlan_stop();
// perform a SoC reset // perform a SoC reset
PRCMSOCReset(); PRCMSOCReset();
return mp_const_none; return mp_const_none;

View File

@ -529,7 +529,7 @@ void wlan_update(void) {
} }
// call this function to disable the complete WLAN subsystem before a system reset // call this function to disable the complete WLAN subsystem before a system reset
void wlan_stop (void) { void wlan_stop (uint32_t timeout) {
if (wlan_obj.mode >= 0) { if (wlan_obj.mode >= 0) {
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP) #if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
// Stop all other processes using the wlan engine // Stop all other processes using the wlan engine
@ -539,7 +539,7 @@ void wlan_stop (void) {
#endif #endif
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER); sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
wlan_obj.mode = -1; wlan_obj.mode = -1;
sl_Stop(SL_STOP_TIMEOUT); sl_Stop(MAX(timeout, SL_STOP_TIMEOUT));
} }
} }

View File

@ -33,6 +33,7 @@
#define SIMPLELINK_SPAWN_TASK_PRIORITY 3 #define SIMPLELINK_SPAWN_TASK_PRIORITY 3
#define SIMPLELINK_TASK_STACK_SIZE 2048 #define SIMPLELINK_TASK_STACK_SIZE 2048
#define SL_STOP_TIMEOUT 35 #define SL_STOP_TIMEOUT 35
#define SL_STOP_TIMEOUT_LONG 255
/****************************************************************************** /******************************************************************************
DEFINE TYPES DEFINE TYPES
@ -56,7 +57,7 @@ extern void wlan_init0 (void);
extern modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ssid_len, uint8_t sec, extern modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ssid_len, uint8_t sec,
const char *key, uint8_t key_len, uint8_t channel); const char *key, uint8_t key_len, uint8_t channel);
extern void wlan_first_start (void); extern void wlan_first_start (void);
extern void wlan_stop (void); extern void wlan_stop (uint32_t timeout);
extern void wlan_get_mac (uint8_t *macAddress); extern void wlan_get_mac (uint8_t *macAddress);
extern void wlan_get_ip (uint32_t *ip); extern void wlan_get_ip (uint32_t *ip);
extern void wlan_stop_servers (void); extern void wlan_stop_servers (void);

View File

@ -331,12 +331,12 @@ STATIC void pin_extint_enable (mp_obj_t self_in) {
MAP_PRCMHibernateWakeupSourceDisable(hib_pin); MAP_PRCMHibernateWakeupSourceDisable(hib_pin);
} }
} }
// if idx is invalid, the the pin supports active interrupts for sure // if idx is invalid, the pin supports active interrupts for sure
if (idx >= PYBPIN_NUM_WAKE_PINS || pybpin_wake_pin[idx].active) { if (idx >= PYBPIN_NUM_WAKE_PINS || pybpin_wake_pin[idx].active) {
MAP_GPIOIntClear(self->port, self->bit); MAP_GPIOIntClear(self->port, self->bit);
MAP_GPIOIntEnable(self->port, self->bit); MAP_GPIOIntEnable(self->port, self->bit);
} }
// in case in was enabled before // in case it was enabled before
else if (idx < PYBPIN_NUM_WAKE_PINS && !pybpin_wake_pin[idx].active) { else if (idx < PYBPIN_NUM_WAKE_PINS && !pybpin_wake_pin[idx].active) {
MAP_GPIOIntDisable(self->port, self->bit); MAP_GPIOIntDisable(self->port, self->bit);
} }

View File

@ -613,7 +613,7 @@ STATIC mp_obj_t pyb_sleep_hibernate (mp_obj_t self_in) {
return mp_const_none; return mp_const_none;
} }
} }
wlan_stop(); wlan_stop(SL_STOP_TIMEOUT);
pybsleep_flash_powerdown(); pybsleep_flash_powerdown();
MAP_PRCMHibernateEnter(); MAP_PRCMHibernateEnter();
return mp_const_none; return mp_const_none;

View File

@ -246,9 +246,8 @@ soft_reset_exit:
// wait for all bus transfers to complete // wait for all bus transfers to complete
HAL_Delay(50); HAL_Delay(50);
// disable wlan services // disable wlan
wlan_stop_servers(); wlan_stop(SL_STOP_TIMEOUT_LONG);
wlan_stop();
// de-initialize the stdio uart // de-initialize the stdio uart
if (pyb_stdio_uart) { if (pyb_stdio_uart) {