9 #ifndef NBWILCDRIVER_H_ 10 #define NBWILCDRIVER_H_ 13 #include <nbwifi/wilc/atmel/driver/m2m_types.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 WILC1000 :
public Master
45 static NBWifi::Master* 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 bool GetLinkStatus()
override;
59 void enab_multicast( MACADR macAddress, BOOL addAddress )
override;
60 int APIStart()
override;
64 void Pause()
override;
65 void Resume()
override;
69 const char * ssid =
nullptr,
const char * passwd =
"",
70 uint8_t retryCount = CONNECT_RETRIES,
71 uint8_t security = DEFAULT_WIFI_SEC_ALL
73 int ConnectToAP( nbWifiConnect connect )
override;
75 const char * ssid =
nullptr,
76 const char * passwd =
"",
77 uint8_t channel = DEFAULT_TABLE_LABEL_CHANNEL,
78 uint8_t security = DEFAULT_TABLE_LABEL_SEC,
79 uint8_t cipher = DEFAULT_TABLE_LABEL_CIPH,
83 int StartConfigAP(uint8_t channel = DEFAULT_TABLE_LABEL_CHANNEL)
override;
86 nbWifiScanResult * Scan(
const char * ssid =
nullptr, uint8_t optionCount = 0, uint16_t *optionList =
nullptr)
override;
89 void Disconnect()
override;
90 int StartAsyncScan( uint8_t channel = DEFAULT_WIFI_CH_ALL,
const char * ssid =
nullptr, uint8_t optionCount = 0, uint16_t *optionList =
nullptr);
91 void SetScanResult(tstrM2mWifiscanResult * scanResult, uint8_t numAPFound);
95 int StoreSSIDPWToConfig(
char *ssid,
char *password,
int ssidLen = 0)
override;
96 int GetSSIDFromConfig(
char *returnBuf,
int maxLen )
override;
97 int GetKeyFromConfig(
char *returnBuf,
int maxLen )
override;
99 bool isRegistered()
const override;
100 int GetWifiInterfaceNumber()
const override;
101 int GetSystemInterfaceNumber()
const override;
104 int GetCurSSID(
char * buf,
int maxlen)
override;
105 MACADR GetCurBSSID()
override;
106 void GetCurrentAP(driverStatusStruct *ap)
override;
107 void GetDeviceInformation(nbWifiDeviceInfo *ap)
override;
108 bool Connected()
override;
109 int GetSignalStrength()
override;
110 uint8_t GetCurChannel()
override;
111 uint8_t GetSecurity()
override;
112 uint8_t GetCipher()
override;
113 void GetMACAddress(MACADR* macAddr);
115 void SetWifiEventFlag(uint8_t flag,
bool setNotClear);
116 void SetConnectState(tstrM2MConnInfo * ConnInfo,
bool connected,
int ssidLen, MACADR * mac,
bool STAmode);
117 virtual bool SetBusSpeed( uint32_t busSpeed ) = 0;
121 volatile bool gbConnectedWifi;
122 volatile bool processingConnectRequest;
126 bool gbDhcpServerStarted;
128 volatile unsigned char gu8ChipMode;
129 volatile unsigned char gu8ChipSleep;
130 volatile unsigned char gu8HifSizeDone;
133 NBWifi::APIMessage::Response::DeviceInfo devInfo;
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;
162 bool hardwareInitialized;
163 int myInterfaceNumber;
164 uint8_t nChipsetIntfNum;
165 char softAPName[SSID_MAX_LEN + 1];
166 volatile lastConnected lastConnection;
169 WILC1000(CommBus busType,
int resetPinConnector,
int resetPinMum,
const char * name);
174 extern NBWifi::Master * theWifiIntf;
176 #endif // NBWILCDRIVER_H_ void SetWifiSPISpeed(int busSpeed)
Set SPI bus speed.
Semaphores are used to control access to shared resource critical section, or to communicate between ...
Definition: nbrtos.h:289
NetBurner System Constants.
A queue functions as a fixed size FIFO for communication between tasks.
Definition: nbrtos.h:502
NBWifi namespace that encompaces the WiFi driver.
Definition: nbWifiBsp.h:15
Mailboxes are used to communicate between tasks.
Definition: nbrtos.h:362
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:956