9 #ifndef NBWILCDRIVER_H_ 10 #define NBWILCDRIVER_H_ 14 #include <constants.h> 16 #define WILC_Q_SIZE 220 17 #define WIFI_RX_FLOW_OFF_COUNT BUFFER_POOL_SIZE/2 19 #define DEFAULT_WIFI_SCAN_SLOTS_PER_CHANNEL 6 20 #define DEFAULT_WIFI_SCAN_SLOT_TIME 50 22 #define WIFI_RX_FLAG (0x01) 23 #define WIFI_TX_FLAG (0x02) 24 #define WIFI_STA_CON_FLAG (0x04) 25 #define WIFI_STA_DISCON_FLAG (0x08) 26 #define WIFI_AP_START_FLAG (0x0F) 27 #define WIFI_AP_STOP_FLAG (0x10) 28 #define WIFI_CON_INFO_FLAG (0x20) 29 #define WIFI_ANY_FLAG (0xFF) 33 uint8_t ssid[SSID_MAX_LEN];
35 uint8_t psk[PASS_MAX_LEN];
42 class NBWifiWILC :
public Wifi
45 static NB::Wifi* GetNewWilcDriver();
48 static void TransmitBuffer_0( PoolPtr txBuffer );
49 static void TransmitBuffer_1( PoolPtr txBuffer );
52 static BOOL linkActive_0();
53 static BOOL linkActive_1();
54 static void enab_multicast_0( MACADR macAddress, BOOL addAddress );
55 static void enab_multicast_1( MACADR macAddress, BOOL addAddress );
57 void TransmitBuffer( PoolPtr txBuffer )
override;
58 int SetITUCountry( NB::ITU_Country::CountryCode_t country );
59 bool GetLinkStatus()
override;
60 void enab_multicast( MACADR macAddress, BOOL addAddress )
override;
61 int APIStart()
override;
65 void Pause()
override;
66 void Resume()
override;
70 const char * ssid =
nullptr,
const char * passwd =
"",
71 uint8_t retryCount = CONNECT_RETRIES,
72 uint8_t security = DEFAULT_WIFI_SEC_ALL
74 int ConnectToAP( nbWifiConnect connect )
override;
76 const char * ssid =
nullptr,
77 const char * passwd =
"",
78 uint8_t channel = DEFAULT_TABLE_LABEL_CHANNEL,
79 uint8_t security = DEFAULT_TABLE_LABEL_SEC,
80 uint8_t cipher = DEFAULT_TABLE_LABEL_CIPH,
84 int StartConfigAP(uint8_t channel = DEFAULT_TABLE_LABEL_CHANNEL)
override;
87 nbWifiScanResult * Scan(
const char * ssid =
nullptr, uint8_t optionCount = 0, uint16_t *optionList =
nullptr)
override;
90 void Disconnect()
override;
91 int StartAsyncScan( uint8_t channel = DEFAULT_WIFI_CH_ALL,
const char * ssid =
nullptr, uint8_t optionCount = 0, uint16_t *optionList =
nullptr);
96 int StoreSSIDPWToConfig(
char *ssid,
char *password,
int ssidLen = 0)
override;
97 int GetSSIDFromConfig(
char *returnBuf,
int maxLen )
override;
98 int GetKeyFromConfig(
char *returnBuf,
int maxLen )
override;
100 bool isRegistered()
const override;
101 int GetWifiInterfaceNumber()
const override;
102 int GetSystemInterfaceNumber()
const override;
105 int GetCurSSID(
char * buf,
int maxlen)
override;
106 MACADR GetCurBSSID()
override;
107 void GetCurrentAP(driverStatusStruct *ap)
override;
108 void GetDeviceInformation(nbWifiDeviceInfo *ap)
override;
109 bool Connected()
override;
110 int GetSignalStrength()
override;
111 uint8_t GetCurChannel()
override;
112 uint8_t GetSecurity()
override;
113 uint8_t GetCipher()
override;
114 void GetMACAddress(MACADR* macAddr);
116 void SetWifiEventFlag(uint8_t flag,
bool setNotClear);
117 void SetConnectState(
tstrM2MConnInfo * ConnInfo,
bool connected,
int ssidLen, MACADR * mac,
bool STAmode);
118 virtual bool SetBusSpeed( uint32_t busSpeed ) = 0;
119 bool UpdateSlaveFirmware( uint32_t imageLength,
const uint8_t *imageBuffer )
override;
123 volatile bool gbConnectedWifi;
124 volatile bool processingConnectRequest;
128 bool gbDhcpServerStarted;
130 volatile unsigned char gu8ChipMode;
131 volatile unsigned char gu8ChipSleep;
132 volatile unsigned char gu8HifSizeDone;
135 void ReadyInterface();
136 PoolPtr GetDeviceInformation();
137 int AddWaitingCommand( uint8_t requestType, uint8_t commandID,
OS_MBOX *pmbox );
140 static uint32_t DriverStk[MAX_WIFI_INTERFACES][USER_TASK_STK_SIZE];
141 volatile bool bFatalError;
146 void TransmitBuffer_Core( PoolPtr txBuffer, uint8_t credits );
148 int RegisterDriver();
149 virtual void WifiTask() = 0;
150 static void WifiTaskLauncher(
void *wifiDriverObj);
153 uint32_t scanResultIndex;
154 uint32_t sta_connected;
161 bool hardwareInitialized;
162 uint8_t chipsetIntfNum;
163 int chipEnablePinNum;
165 char softAPName[SSID_MAX_LEN + 1];
166 volatile lastConnected lastConnection;
169 NBWifiWILC(CommBus busType,
int resetPinConnector,
int resetPinMum,
int chipEnablePinNum,
const char * name);
174 extern NB::Wifi * theWifiIntf;
176 #endif // NBWILCDRIVER_H_ Semaphores are used to control access to shared resource critical section, or to communicate between ...
Definition: nbrtos.h:318
A queue functions as a fixed size FIFO for communication between tasks.
Definition: nbrtos.h:531
NMC1500 IoT Application Interface Internal Types.
Wi-Fi Scan Result.
Definition: m2m_types.h:1006
Definition: dhcpv6_internal.h:34
M2M Provisioning Information obtained from the HTTP Provisioning server.
Definition: m2m_types.h:1399
Mailboxes are used to communicate between tasks.
Definition: nbrtos.h:391
An OS_FLAGS object is used to set, clear, and pend on a set of flags that is held and maintained by t...
Definition: nbrtos.h:1009
void SetWifiSPISpeed(int busSpeed)
Set SPI bus speed.