drivers/wireless/gs2200m: Notify disssociation event

After recover disassociation, usrsock daemon must destroy all sockets.
Add notification to prompt the daemon to do so.
This commit is contained in:
Takayoshi Koizumi 2022-07-31 20:58:47 +00:00 committed by Masayuki Ishikawa
parent 9bb5148d10
commit 883c6fc2ef
2 changed files with 26 additions and 7 deletions

View File

@ -76,7 +76,7 @@
#define MAX_PKT_LEN 1500
#define MAX_PAYLOAD (MAX_PKT_LEN - BULK_CMD_HDR_SIZE_WITH_GUARD)
#define MAX_NOTIF_Q 16
#define MAX_NOTIF_Q 18 /* for 16 sockets and disasso event + dummy */
#define WR_REQ 0x01
#define RD_REQ 0x02
@ -169,7 +169,7 @@ struct notif_q_s
uint8_t rpos;
uint8_t wpos;
uint8_t count;
uint16_t inuse;
uint32_t inuse;
char cids[MAX_NOTIF_Q];
};
@ -184,8 +184,8 @@ struct gs2200m_dev_s
bool int_enabled;
dq_queue_t pkt_q[16];
uint16_t pkt_q_cnt[16];
uint16_t valid_cid_bits;
uint16_t aip_cid_bits;
uint32_t valid_cid_bits;
uint32_t aip_cid_bits;
uint32_t total_bulk;
uint8_t tx_buff[MAX_PKT_LEN];
struct net_driver_s net_dev;
@ -297,6 +297,10 @@ static uint8_t _cid_to_uint8(char c)
{
ret = (c - 'a') + 10;
}
else if (c == DISASSOCIATION_CID)
{
ret = 16;
}
else
{
ret = 0xff;
@ -334,9 +338,9 @@ static uint16_t _to_uint16(char *str)
* Name: _enable_cid
****************************************************************************/
static bool _enable_cid(uint16_t *cid_bits, char cid, bool on)
static bool _enable_cid(uint32_t *cid_bits, char cid, bool on)
{
uint16_t mask = 1 << _cid_to_uint8(cid);
uint32_t mask = 1 << _cid_to_uint8(cid);
bool ret = true;
if (on)
@ -369,7 +373,7 @@ static bool _enable_cid(uint16_t *cid_bits, char cid, bool on)
* Name: _cid_is_set
****************************************************************************/
static bool _cid_is_set(uint16_t *cid_bits, char cid)
static bool _cid_is_set(uint32_t *cid_bits, char cid)
{
uint16_t mask = 1 << _cid_to_uint8(cid);
@ -2140,6 +2144,16 @@ static enum pkt_type_e gs2200m_set_loglevel(FAR struct gs2200m_dev_s *dev,
}
#endif
/****************************************************************************
* Name: gs2200m_closeallsock
* NOTE: See 7.1.5 Closing All Connections
****************************************************************************/
static void gs2200m_closeallsock(FAR struct gs2200m_dev_s *dev)
{
gs2200m_send_cmd2(dev, "AT+NCLOSEALL\r\n");
}
/****************************************************************************
* Name: gs2200m_get_version
****************************************************************************/
@ -3213,6 +3227,9 @@ repeat:
wlwarn("=== recover DISASSOCIATE\n");
dev->disassociate_flag = false;
gs2200m_closeallsock(dev);
_notif_q_push(dev, DISASSOCIATION_CID);
goto errout;
}

View File

@ -58,6 +58,8 @@ extern "C"
#define GS2200M_IOC_IFREQ _WLCIOC(GS2200M_FIRST + 7)
#define GS2200M_IOC_NAME _WLCIOC(GS2200M_FIRST + 8)
#define DISASSOCIATION_CID ('x')
/* NOTE: do not forget to update include/nuttx/wireless/ioctl.h */
struct gs2200m_connect_msg