diff --git a/drivers/wireless/Kconfig b/drivers/wireless/Kconfig index a80f2526d2..5ffef5d87f 100644 --- a/drivers/wireless/Kconfig +++ b/drivers/wireless/Kconfig @@ -55,6 +55,17 @@ config WL_GS2200M_CHECK_VERSION bool "Check the version of GS2200M" default n +config WL_GS2200M_SYNC_INTERVAL + int "Sync loss interval in station mode (100ms)" + default 100 + range 1 63325 + ---help--- + Time interval to recognize dis-association situation. + The value indicate n times of Wi-Fi beacon. If the node + lost receiving beacon n times, behave as dis-associtaion. + Time difference between 2 beacons are approximetely 100 msec. + So the unit of the value is 100 ms. + config WL_GS2200M_LOGLEVEL int "Log level" default 0 diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c index 20276fcb21..da1c4d6370 100644 --- a/drivers/wireless/gs2200m.c +++ b/drivers/wireless/gs2200m.c @@ -2112,6 +2112,34 @@ static enum pkt_type_e gs2200m_activate_wrx(FAR struct gs2200m_dev_s *dev, return gs2200m_send_cmd2(dev, cmd); } +/**************************************************************************** + * Name: gs2200m_powersave_wrx + * NOTE: See 9.1.1 Active Radio Receive + ****************************************************************************/ + +static enum pkt_type_e gs2200m_powersave_wrx(FAR struct gs2200m_dev_s *dev, + uint8_t on) +{ + char cmd[30]; + + snprintf(cmd, sizeof(cmd), "AT+WRXPS=%d\r\n", on); + return gs2200m_send_cmd2(dev, cmd); +} + +/**************************************************************************** + * Name: gs2200m_syncloss + * NOTE: See 5.1.4 Sync loss interval + ****************************************************************************/ + +static enum pkt_type_e gs2200m_syncloss(FAR struct gs2200m_dev_s *dev, + int val) +{ + char cmd[30]; + + snprintf(cmd, sizeof(cmd), "AT+WSYNCINTRL=%d\r\n", val); + return gs2200m_send_cmd2(dev, cmd); +} + /**************************************************************************** * Name: gs2200m_set_gpio * NOTE: See 10.3 GPIO Commands @@ -2667,6 +2695,11 @@ static int gs2200m_ioctl_assoc_sta(FAR struct gs2200m_dev_s *dev, dev->disassociate_flag = false; + /* Sync lost time interval */ + + t = gs2200m_syncloss(dev, CONFIG_WL_GS2200M_SYNC_INTERVAL); + ASSERT(TYPE_OK == t); + return OK; } @@ -3411,6 +3444,11 @@ static int gs2200m_start(FAR struct gs2200m_dev_s *dev) t = gs2200m_activate_wrx(dev, 1); ASSERT(TYPE_OK == t); + /* Power save disable */ + + t = gs2200m_powersave_wrx(dev, 0); + ASSERT(TYPE_OK == t); + /* Set Bulk Data mode */ t = gs2200m_enable_bulk(dev, 1);