Merge pull request #11370 from u-blox/ublox_odin_driver_os_5_v3.7.1_rc1

Driver Updates + ARMC6 driver support + WIFI fixes
pull/11356/head
Martin Kojtal 2019-08-29 13:35:06 +02:00 committed by GitHub
commit 8ef742a49c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 210 additions and 178 deletions

View File

@ -204,7 +204,7 @@ OdinWiFiEMAC::OdinWiFiEMAC()
void send_wlan_packet(void *buf) void send_wlan_packet(void *buf)
{ {
cbWLAN_sendPacket(buf); cbWLAN_sendPacket(cbWLAN_DEFAULT_HANDLE, buf);
} }
bool OdinWiFiEMAC::link_out(emac_mem_buf_t *buf) bool OdinWiFiEMAC::link_out(emac_mem_buf_t *buf)
@ -264,7 +264,7 @@ void OdinWiFiEMAC::set_link_input_cb(emac_link_input_cb_t input_cb)
emac_link_input_cb = input_cb; emac_link_input_cb = input_cb;
cbMAIN_driverLock(); cbMAIN_driverLock();
cbWLAN_registerPacketIndicationCallback(handleWlanPacketIndication, NULL); cbWLAN_registerPacketIndicationCallback(cbWLAN_DEFAULT_HANDLE, handleWlanPacketIndication, NULL);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
} }

View File

@ -755,7 +755,7 @@ OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_connect_fail_wait_disc
cbRTSL_Status error_code; cbRTSL_Status error_code;
cbMAIN_driverLock(); cbMAIN_driverLock();
error_code = cbWLAN_disconnect(); error_code = cbWLAN_disconnect(handle);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
MBED_ASSERT(error_code == cbSTATUS_OK); MBED_ASSERT(error_code == cbSTATUS_OK);
@ -776,7 +776,7 @@ OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_wait_disconnect()
cbRTSL_Status error_code; cbRTSL_Status error_code;
cbMAIN_driverLock(); cbMAIN_driverLock();
error_code = cbWLAN_disconnect(); error_code = cbWLAN_disconnect(handle);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
MBED_ASSERT(error_code == cbSTATUS_OK); MBED_ASSERT(error_code == cbSTATUS_OK);
@ -800,7 +800,7 @@ OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_started()
OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_wait_stop() OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_wait_stop()
{ {
cbMAIN_driverLock(); cbMAIN_driverLock();
cbRTSL_Status status = cbWLAN_apStop(); cbRTSL_Status status = cbWLAN_apStop(handle);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
MBED_ASSERT(status == cbSTATUS_OK); MBED_ASSERT(status == cbSTATUS_OK);
@ -811,7 +811,7 @@ OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_wait_stop()
OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_fail_wait_stop() OdinWiFiInterface::OdinWifiState OdinWiFiInterface::entry_ap_fail_wait_stop()
{ {
cbMAIN_driverLock(); cbMAIN_driverLock();
cbRTSL_Status status = cbWLAN_apStop(); cbRTSL_Status status = cbWLAN_apStop(handle);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
MBED_ASSERT(status == cbSTATUS_OK); MBED_ASSERT(status == cbSTATUS_OK);
@ -1024,6 +1024,8 @@ void OdinWiFiInterface::handle_user_connect(user_connect_s *user_connect)
if(error_code == NSAPI_ERROR_OK) { if(error_code == NSAPI_ERROR_OK) {
memset(&_wlan_status_connected_info, 0, sizeof(cbWLAN_StatusConnectedInfo)); memset(&_wlan_status_connected_info, 0, sizeof(cbWLAN_StatusConnectedInfo));
memset(&_wlan_status_disconnected_info, 0, sizeof(cbWLAN_StatusDisconnectedInfo)); memset(&_wlan_status_disconnected_info, 0, sizeof(cbWLAN_StatusDisconnectedInfo));
_wlan_status_disconnected_info.handle = cbWLAN_DEFAULT_HANDLE;
_wlan_status_connected_info.handle = cbWLAN_DEFAULT_HANDLE;
_state_sta = entry_wait_connect(); _state_sta = entry_wait_connect();
} }
@ -1296,43 +1298,45 @@ void OdinWiFiInterface::handle_wlan_status_connected(wlan_status_connected_s *wl
MBED_ASSERT(wlan_connect != 0); MBED_ASSERT(wlan_connect != 0);
switch(_state_sta) { switch(_state_sta) {
case S_STA_CONNECTED: case S_STA_CONNECTED:
case S_STA_WAIT_CONNECT: case S_STA_WAIT_CONNECT:
_timer.stop(); _timer.stop();
if(_debug) { if(_debug) {
printf("MBED_IPSTACK_ \r\n"); printf("MBED_IPSTACK_ \r\n");
} }
error_code = _interface->bringup(_dhcp, error_code = _interface->bringup(_dhcp,
_ip_address[0] ? _ip_address : 0, _ip_address[0] ? _ip_address : 0,
_netmask[0] ? _netmask : 0, _netmask[0] ? _netmask : 0,
_gateway[0] ? _gateway : 0, _gateway[0] ? _gateway : 0,
DEFAULT_STACK); DEFAULT_STACK);
if (error_code == NSAPI_ERROR_OK || error_code == NSAPI_ERROR_IS_CONNECTED) { if (error_code == NSAPI_ERROR_OK || error_code == NSAPI_ERROR_IS_CONNECTED) {
memcpy(&_wlan_status_connected_info, &(wlan_connect->info), sizeof(cbWLAN_StatusConnectedInfo)); memcpy(&_wlan_status_connected_info, &(wlan_connect->info), sizeof(cbWLAN_StatusConnectedInfo));
_state_sta = S_STA_CONNECTED; if(_state_sta != S_STA_CONNECTED){
send_user_response_msg(ODIN_WIFI_MSG_USER_CONNECT, NSAPI_ERROR_OK); _state_sta = S_STA_CONNECTED;
} send_user_response_msg(ODIN_WIFI_MSG_USER_CONNECT, NSAPI_ERROR_OK);
else { }
_state_sta = entry_connect_fail_wait_disconnect(); }
} else {
break; _state_sta = entry_connect_fail_wait_disconnect();
}
break;
case S_STA_DISCONNECTED_WAIT_CONNECT: case S_STA_DISCONNECTED_WAIT_CONNECT:
_state_sta = S_STA_CONNECTED; _state_sta = S_STA_CONNECTED;
break; break;
case S_STA_CONNECTION_FAIL_WAIT_DISCONNECT: case S_STA_CONNECTION_FAIL_WAIT_DISCONNECT:
case S_STA_WAIT_DISCONNECT: case S_STA_WAIT_DISCONNECT:
//Ignore //Ignore
break; break;
default: default:
MBED_ASSERT(FALSE); MBED_ASSERT(FALSE);
break; break;
} }
} }
@ -1398,21 +1402,25 @@ void OdinWiFiInterface::handle_wlan_status_disconnected(void)
case S_STA_CONNECTION_FAIL_WAIT_DISCONNECT: case S_STA_CONNECTION_FAIL_WAIT_DISCONNECT:
_state_sta = S_STA_IDLE; _state_sta = S_STA_IDLE;
if(_wlan_status_disconnected_info.handle == cbWLAN_DEFAULT_HANDLE){
switch(_wlan_status_disconnected_info.reason) {
error_code = NSAPI_ERROR_NO_SSID;
break;
switch(_wlan_status_disconnected_info) { case cbWLAN_STATUS_DISCONNECTED_AUTH_FAILURE:
case cbWLAN_STATUS_DISCONNECTED_AUTH_TIMEOUT: case cbWLAN_STATUS_DISCONNECTED_ASSOC_FAILURE:
case cbWLAN_STATUS_DISCONNECTED_MIC_FAILURE: case cbWLAN_STATUS_DISCONNECTED_MIC_FAILURE:
error_code = NSAPI_ERROR_AUTH_FAILURE; error_code = NSAPI_ERROR_AUTH_FAILURE;
break; break;
case cbWLAN_STATUS_DISCONNECTED_NO_BSSID_FOUND: case cbWLAN_STATUS_DISCONNECTED_NO_BSSID_FOUND:
case cbWLAN_STATUS_DISCONNECTED_UNKNOWN: case cbWLAN_STATUS_DISCONNECTED_UNKNOWN:
error_code = NSAPI_ERROR_NO_CONNECTION; error_code = NSAPI_ERROR_NO_CONNECTION;
break; break;
default: default:
error_code = NSAPI_ERROR_DEVICE_ERROR; error_code = NSAPI_ERROR_DEVICE_ERROR;
break; break;
}
} }
send_user_response_msg(ODIN_WIFI_MSG_USER_CONNECT, error_code); send_user_response_msg(ODIN_WIFI_MSG_USER_CONNECT, error_code);
break; break;
@ -1555,7 +1563,7 @@ void OdinWiFiInterface::init(bool debug = false)
memset(&_wlan_status_connected_info, 0, sizeof(cbWLAN_StatusConnectedInfo)); memset(&_wlan_status_connected_info, 0, sizeof(cbWLAN_StatusConnectedInfo));
memset(&_wlan_status_disconnected_info, 0, sizeof(cbWLAN_StatusDisconnectedInfo)); memset(&_wlan_status_disconnected_info, 0, sizeof(cbWLAN_StatusDisconnectedInfo));
_msg_pool = new MemoryPool<odin_wifi_msg_s, 7>(); _msg_pool = new MemoryPool<odin_wifi_msg_s, 11>();
if(!_wlan_initialized) { if(!_wlan_initialized) {
@ -1656,7 +1664,7 @@ nsapi_error_t OdinWiFiInterface::wlan_connect(
{ {
case NSAPI_SECURITY_NONE: case NSAPI_SECURITY_NONE:
cbMAIN_driverLock(); cbMAIN_driverLock();
status = cbWLAN_connectOpen(&connect_params); handle = cbWLAN_connectOpen(&connect_params);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
break; break;
case NSAPI_SECURITY_WPA: case NSAPI_SECURITY_WPA:
@ -1672,10 +1680,10 @@ nsapi_error_t OdinWiFiInterface::wlan_connect(
status = cbWLAN_Util_PSKFromPWD(temp_passphrase, connect_params.ssid, wpa_connect_params.psk.key); status = cbWLAN_Util_PSKFromPWD(temp_passphrase, connect_params.ssid, wpa_connect_params.psk.key);
if (status == cbSTATUS_OK) { if (status == cbSTATUS_OK) {
status = cbWLAN_connectWPAPSK(&connect_params, &wpa_connect_params); handle = cbWLAN_connectWPAPSK(&connect_params, &wpa_connect_params);
} }
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
if(_debug) {printf("cbWLAN_connect: %d\r\n", status);} if(_debug) {printf("cbWLAN_connect: %d\r\n", handle);}
break; break;
case NSAPI_SECURITY_EAP_TLS: case NSAPI_SECURITY_EAP_TLS:
@ -1685,7 +1693,7 @@ nsapi_error_t OdinWiFiInterface::wlan_connect(
{ {
printf("No client certificate found in root \r\n"); printf("No client certificate found in root \r\n");
} }
status = cb_eap_conn_handler(cert_handle->client_cert, cert_handle->client_prvt_key, &connect_params, &enterpriseParams); handle = cb_eap_conn_handler(cert_handle->client_cert, cert_handle->client_prvt_key, &connect_params, &enterpriseParams);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
if(_debug) {printf("cbWLAN_connect: %d\r\n", status);} if(_debug) {printf("cbWLAN_connect: %d\r\n", status);}
break; break;
@ -1697,7 +1705,7 @@ nsapi_error_t OdinWiFiInterface::wlan_connect(
strncpy((char*)enterpriseParams.passphrase, user_pswd, cbWLAN_MAX_USERNAME_LENGTH); strncpy((char*)enterpriseParams.passphrase, user_pswd, cbWLAN_MAX_USERNAME_LENGTH);
/* cert_handle->ca_cert could be NULL if client don;t need to verify server */ /* cert_handle->ca_cert could be NULL if client don;t need to verify server */
status = cb_eap_conn_handler(cert_handle->ca_cert, NULL, &connect_params, &enterpriseParams); handle = cb_eap_conn_handler(cert_handle->ca_cert, NULL, &connect_params, &enterpriseParams);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
if(_debug) {printf("cbWLAN_connect: %d\r\n", status);} if(_debug) {printf("cbWLAN_connect: %d\r\n", status);}
break; break;
@ -1709,7 +1717,7 @@ nsapi_error_t OdinWiFiInterface::wlan_connect(
break; break;
} }
if(status != cbSTATUS_OK) { if(status != cbSTATUS_OK || handle == cbWLAN_INVALID_HANDLE) {
error_code = NSAPI_ERROR_UNSUPPORTED; error_code = NSAPI_ERROR_UNSUPPORTED;
} }
@ -1741,7 +1749,7 @@ nsapi_error_t OdinWiFiInterface::wlan_ap_start(
params.basicRates = cbRATE_MASK_01 | APP_MASK_SHIFTUP(cbRATE_MASK_01, cbRATE_MASK_G); params.basicRates = cbRATE_MASK_01 | APP_MASK_SHIFTUP(cbRATE_MASK_01, cbRATE_MASK_G);
params.allowedRates = ODIN_WIFI_AP_ALLOWED_RATE_MASK; params.allowedRates = ODIN_WIFI_AP_ALLOWED_RATE_MASK;
cbMAIN_driverLock(); cbMAIN_driverLock();
status = cbWLAN_ioctl(cbWLAN_IOCTL_SET_AP_BEACON_INTERVAL, (void*)beacon_interval); status = cbWLAN_ioctl(cbWLAN_IOCTL_SET_AP_BEACON_INTERVAL, (void*)&beacon_interval);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
if (status != cbSTATUS_OK) { if (status != cbSTATUS_OK) {
@ -1750,7 +1758,7 @@ nsapi_error_t OdinWiFiInterface::wlan_ap_start(
switch (security) { switch (security) {
case NSAPI_SECURITY_NONE: case NSAPI_SECURITY_NONE:
cbMAIN_driverLock(); cbMAIN_driverLock();
status = cbWLAN_apStartOpen(&params); handle = cbWLAN_apStartOpen(&params);
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
break; break;
@ -1769,7 +1777,7 @@ nsapi_error_t OdinWiFiInterface::wlan_ap_start(
status = cbWLAN_Util_PSKFromPWD(temp_passphrase, params.ssid, wpa_params.psk.key); status = cbWLAN_Util_PSKFromPWD(temp_passphrase, params.ssid, wpa_params.psk.key);
if (status == cbSTATUS_OK) { if (status == cbSTATUS_OK) {
status = cbWLAN_apStartWPAPSK(&params, &wpa_params); handle = cbWLAN_apStartWPAPSK(&params, &wpa_params);
} }
cbMAIN_driverUnlock(); cbMAIN_driverUnlock();
break; break;
@ -1779,7 +1787,7 @@ nsapi_error_t OdinWiFiInterface::wlan_ap_start(
break; break;
} }
if (status != cbSTATUS_OK) { if (status != cbSTATUS_OK || handle == cbWLAN_INVALID_HANDLE) {
error_code = NSAPI_ERROR_UNSUPPORTED; error_code = NSAPI_ERROR_UNSUPPORTED;
} }
} }
@ -2015,80 +2023,87 @@ static bool is_valid_AP_channel(cbWLAN_Channel channel)
static cbTARGET_ConfigParams map_odin_config(target_config_params_e parameter) static cbTARGET_ConfigParams map_odin_config(target_config_params_e parameter)
{ {
cbTARGET_ConfigParams config;
switch (parameter) { switch (parameter) {
case ODIN_CFG_SET_POWER_SAVE_MODE: return cbTARGET_CFG_SET_POWER_SAVE_MODE; case ODIN_CFG_SET_POWER_SAVE_MODE: config = cbTARGET_CFG_SET_POWER_SAVE_MODE;
case ODIN_CFG_GET_POWER_SAVE_MODE: return cbTARGET_CFG_GET_POWER_SAVE_MODE; case ODIN_CFG_GET_POWER_SAVE_MODE: config = cbTARGET_CFG_GET_POWER_SAVE_MODE;
case ODIN_CFG_SET_LISTEN_INTERVAL: return cbTARGET_CFG_SET_LISTEN_INTERVAL; case ODIN_CFG_SET_LISTEN_INTERVAL: config = cbTARGET_CFG_SET_LISTEN_INTERVAL;
case ODIN_CFG_GET_LISTEN_INTERVAL: return cbTARGET_CFG_GET_LISTEN_INTERVAL; case ODIN_CFG_GET_LISTEN_INTERVAL: config = cbTARGET_CFG_GET_LISTEN_INTERVAL;
case ODIN_CFG_SET_MIN_SCAN_TIME: return cbTARGET_CFG_SET_MIN_SCAN_TIME; case ODIN_CFG_SET_MIN_SCAN_TIME: config = cbTARGET_CFG_SET_MIN_SCAN_TIME;
case ODIN_CFG_GET_MIN_SCAN_TIME: return cbTARGET_CFG_GET_MIN_SCAN_TIME; case ODIN_CFG_GET_MIN_SCAN_TIME: config = cbTARGET_CFG_GET_MIN_SCAN_TIME;
case ODIN_CFG_SET_MAX_SCAN_TIME: return cbTARGET_CFG_SET_MAX_SCAN_TIME; case ODIN_CFG_SET_MAX_SCAN_TIME: config = cbTARGET_CFG_SET_MAX_SCAN_TIME;
case ODIN_CFG_GET_MAX_SCAN_TIME: return cbTARGET_CFG_GET_MAX_SCAN_TIME; case ODIN_CFG_GET_MAX_SCAN_TIME: config = cbTARGET_CFG_GET_MAX_SCAN_TIME;
case ODIN_CFG_SET_SCAN_TYPE: return cbTARGET_CFG_SET_SCAN_TYPE; case ODIN_CFG_SET_SCAN_TYPE: config = cbTARGET_CFG_SET_SCAN_TYPE;
case ODIN_CFG_GET_SCAN_TYPE: return cbTARGET_CFG_GET_SCAN_TYPE; case ODIN_CFG_GET_SCAN_TYPE: config = cbTARGET_CFG_GET_SCAN_TYPE;
case ODIN_CFG_SET_DTIM_ENABLE: return cbTARGET_CFG_SET_DTIM_ENABLE; case ODIN_CFG_SET_DTIM_ENABLE: config = cbTARGET_CFG_SET_DTIM_ENABLE;
case ODIN_CFG_GET_DTIM_ENABLE: return cbTARGET_CFG_GET_DTIM_ENABLE; case ODIN_CFG_GET_DTIM_ENABLE: config = cbTARGET_CFG_GET_DTIM_ENABLE;
case ODIN_CFG_SET_QOS_ENABLE: return cbTARGET_CFG_SET_QOS_ENABLE; case ODIN_CFG_SET_QOS_ENABLE: config = cbTARGET_CFG_SET_QOS_ENABLE;
case ODIN_CFG_GET_QOS_ENABLE: return cbTARGET_CFG_GET_QOS_ENABLE; case ODIN_CFG_GET_QOS_ENABLE: config = cbTARGET_CFG_GET_QOS_ENABLE;
case ODIN_CFG_SET_RTS_THRESHOLD: return cbTARGET_CFG_SET_RTS_THRESHOLD; case ODIN_CFG_SET_RTS_THRESHOLD: config = cbTARGET_CFG_SET_RTS_THRESHOLD;
case ODIN_CFG_GET_RTS_THRESHOLD: return cbTARGET_CFG_GET_RTS_THRESHOLD; case ODIN_CFG_GET_RTS_THRESHOLD: config = cbTARGET_CFG_GET_RTS_THRESHOLD;
case ODIN_CFG_SET_TX_POWER: return cbTARGET_CFG_SET_TX_POWER; case ODIN_CFG_SET_TX_POWER: config = cbTARGET_CFG_SET_TX_POWER;
case ODIN_CFG_GET_TX_POWER: return cbTARGET_CFG_GET_TX_POWER; case ODIN_CFG_GET_TX_POWER: config = cbTARGET_CFG_GET_TX_POWER;
case ODIN_CFG_SET_MAX_PASSIVE_SCAN_TIME: return cbTARGET_CFG_SET_MAX_PASSIVE_SCAN_TIME; case ODIN_CFG_SET_MAX_PASSIVE_SCAN_TIME: config = cbTARGET_CFG_SET_MAX_PASSIVE_SCAN_TIME;
case ODIN_CFG_GET_MAX_PASSIVE_SCAN_TIME: return cbTARGET_CFG_GET_MAX_PASSIVE_SCAN_TIME; case ODIN_CFG_GET_MAX_PASSIVE_SCAN_TIME: config = cbTARGET_CFG_GET_MAX_PASSIVE_SCAN_TIME;
case ODIN_CFG_SET_SCAN_LISTEN_INTERVAL: return cbTARGET_CFG_SET_SCAN_LISTEN_INTERVAL; case ODIN_CFG_SET_SCAN_LISTEN_INTERVAL: config = cbTARGET_CFG_SET_SCAN_LISTEN_INTERVAL;
case ODIN_CFG_GET_SCAN_LISTEN_INTERVAL: return cbTARGET_CFG_GET_SCAN_LISTEN_INTERVAL; case ODIN_CFG_GET_SCAN_LISTEN_INTERVAL: config = cbTARGET_CFG_GET_SCAN_LISTEN_INTERVAL;
case ODIN_CFG_SET_DOT11_SHORT_RETRY_LIMIT: return cbTARGET_CFG_SET_DOT11_SHORT_RETRY_LIMIT; case ODIN_CFG_SET_DOT11_SHORT_RETRY_LIMIT: config = cbTARGET_CFG_SET_DOT11_SHORT_RETRY_LIMIT;
case ODIN_CFG_GET_DOT11_SHORT_RETRY_LIMIT: return cbTARGET_CFG_GET_DOT11_SHORT_RETRY_LIMIT; case ODIN_CFG_GET_DOT11_SHORT_RETRY_LIMIT: config = cbTARGET_CFG_GET_DOT11_SHORT_RETRY_LIMIT;
case ODIN_CFG_SET_DOT11_LONG_RETRY_LIMIT: return cbTARGET_CFG_SET_DOT11_LONG_RETRY_LIMIT; case ODIN_CFG_SET_DOT11_LONG_RETRY_LIMIT: config = cbTARGET_CFG_SET_DOT11_LONG_RETRY_LIMIT;
case ODIN_CFG_GET_DOT11_LONG_RETRY_LIMIT: return cbTARGET_CFG_GET_DOT11_LONG_RETRY_LIMIT; case ODIN_CFG_GET_DOT11_LONG_RETRY_LIMIT: config = cbTARGET_CFG_GET_DOT11_LONG_RETRY_LIMIT;
case ODIN_CFG_SET_AP_DOT11_SHORT_RETRY_LIMIT: return cbTARGET_CFG_SET_AP_DOT11_SHORT_RETRY_LIMIT; case ODIN_CFG_SET_AP_DOT11_SHORT_RETRY_LIMIT: config = cbTARGET_CFG_SET_AP_DOT11_SHORT_RETRY_LIMIT;
case ODIN_CFG_GET_AP_DOT11_SHORT_RETRY_LIMIT: return cbTARGET_CFG_GET_AP_DOT11_SHORT_RETRY_LIMIT; case ODIN_CFG_GET_AP_DOT11_SHORT_RETRY_LIMIT: config = cbTARGET_CFG_GET_AP_DOT11_SHORT_RETRY_LIMIT;
case ODIN_CFG_SET_AP_DOT11_LONG_RETRY_LIMIT: return cbTARGET_CFG_SET_AP_DOT11_LONG_RETRY_LIMIT; case ODIN_CFG_SET_AP_DOT11_LONG_RETRY_LIMIT: config = cbTARGET_CFG_SET_AP_DOT11_LONG_RETRY_LIMIT;
case ODIN_CFG_GET_AP_DOT11_LONG_RETRY_LIMIT: return cbTARGET_CFG_GET_AP_DOT11_LONG_RETRY_LIMIT; case ODIN_CFG_GET_AP_DOT11_LONG_RETRY_LIMIT: config = cbTARGET_CFG_GET_AP_DOT11_LONG_RETRY_LIMIT;
case ODIN_CFG_SET_REMAIN_ON_CHANNEL: return cbTARGET_CFG_SET_REMAIN_ON_CHANNEL; case ODIN_CFG_SET_REMAIN_ON_CHANNEL: config = cbTARGET_CFG_SET_REMAIN_ON_CHANNEL;
case ODIN_CFG_GET_REMAIN_ON_CHANNEL: return cbTARGET_CFG_GET_REMAIN_ON_CHANNEL; case ODIN_CFG_GET_REMAIN_ON_CHANNEL: config = cbTARGET_CFG_GET_REMAIN_ON_CHANNEL;
case ODIN_CFG_SET_STA_TX_RATE_MASK: return cbTARGET_CFG_SET_STA_TX_RATE_MASK; case ODIN_CFG_SET_STA_TX_RATE_MASK: config = cbTARGET_CFG_SET_STA_TX_RATE_MASK;
case ODIN_CFG_GET_STA_TX_RATE_MASK: return cbTARGET_CFG_GET_STA_TX_RATE_MASK; case ODIN_CFG_GET_STA_TX_RATE_MASK: config = cbTARGET_CFG_GET_STA_TX_RATE_MASK;
case ODIN_CFG_SET_RSSI_GOOD: return cbTARGET_CFG_SET_RSSI_GOOD; case ODIN_CFG_SET_RSSI_GOOD: config = cbTARGET_CFG_SET_RSSI_GOOD;
case ODIN_CFG_GET_RSSI_GOOD: return cbTARGET_CFG_GET_RSSI_GOOD; case ODIN_CFG_GET_RSSI_GOOD: config = cbTARGET_CFG_GET_RSSI_GOOD;
case ODIN_CFG_SET_RSSI_BAD: return cbTARGET_CFG_SET_RSSI_BAD; case ODIN_CFG_SET_RSSI_BAD: config = cbTARGET_CFG_SET_RSSI_BAD;
case ODIN_CFG_GET_RSSI_BAD: return cbTARGET_CFG_GET_RSSI_BAD; case ODIN_CFG_GET_RSSI_BAD: config = cbTARGET_CFG_GET_RSSI_BAD;
case ODIN_CFG_SET_SLEEP_TIMEOUT: return cbTARGET_CFG_SET_SLEEP_TIMEOUT; case ODIN_CFG_SET_SLEEP_TIMEOUT: config = cbTARGET_CFG_SET_SLEEP_TIMEOUT;
case ODIN_CFG_GET_SLEEP_TIMEOUT: return cbTARGET_CFG_GET_SLEEP_TIMEOUT; case ODIN_CFG_GET_SLEEP_TIMEOUT: config = cbTARGET_CFG_GET_SLEEP_TIMEOUT;
case ODIN_CFG_SET_GOOD_RSSI_YIELD_TMO: return cbTARGET_CFG_SET_GOOD_RSSI_YIELD_TMO; case ODIN_CFG_SET_GOOD_RSSI_YIELD_TMO: config = cbTARGET_CFG_SET_GOOD_RSSI_YIELD_TMO;
case ODIN_CFG_GET_GOOD_RSSI_YIELD_TMO: return cbTARGET_CFG_GET_GOOD_RSSI_YIELD_TMO; case ODIN_CFG_GET_GOOD_RSSI_YIELD_TMO: config = cbTARGET_CFG_GET_GOOD_RSSI_YIELD_TMO;
case ODIN_CFG_SET_BAD_RSSI_YIELD_TMO: return cbTARGET_CFG_SET_BAD_RSSI_YIELD_TMO; case ODIN_CFG_SET_BAD_RSSI_YIELD_TMO: config = cbTARGET_CFG_SET_BAD_RSSI_YIELD_TMO;
case ODIN_CFG_GET_BAD_RSSI_YIELD_TMO: return cbTARGET_CFG_GET_BAD_RSSI_YIELD_TMO; case ODIN_CFG_GET_BAD_RSSI_YIELD_TMO: config = cbTARGET_CFG_GET_BAD_RSSI_YIELD_TMO;
case ODIN_CFG_SET_FORCE_WORLD_MODE: return cbTARGET_CFG_SET_FORCE_WORLD_MODE; case ODIN_CFG_SET_FORCE_WORLD_MODE: config = cbTARGET_CFG_SET_FORCE_WORLD_MODE;
case ODIN_CFG_GET_FORCE_WORLD_MODE: return cbTARGET_CFG_GET_FORCE_WORLD_MODE; case ODIN_CFG_GET_FORCE_WORLD_MODE: config = cbTARGET_CFG_GET_FORCE_WORLD_MODE;
case ODIN_CFG_GET_TX_PACKET_ACK_TIMEOUT_WD: return cbTARGET_CFG_SET_TX_PACKET_ACK_TIMEOUT_WD; case ODIN_CFG_GET_TX_PACKET_ACK_TIMEOUT_WD: config = cbTARGET_CFG_SET_TX_PACKET_ACK_TIMEOUT_WD;
case ODIN_CFG_SET_TX_PACKET_ACK_TIMEOUT_WD: return cbTARGET_CFG_GET_TX_PACKET_ACK_TIMEOUT_WD; case ODIN_CFG_SET_TX_PACKET_ACK_TIMEOUT_WD: config = cbTARGET_CFG_GET_TX_PACKET_ACK_TIMEOUT_WD;
case ODIN_CFG_SET_CTS_PROTECTION: return cbTARGET_CFG_SET_CTS_PROTECTION; case ODIN_CFG_SET_CTS_PROTECTION: config = cbTARGET_CFG_SET_CTS_PROTECTION;
case ODIN_CFG_GET_CTS_PROTECTION: return cbTARGET_CFG_GET_CTS_PROTECTION; case ODIN_CFG_GET_CTS_PROTECTION: config = cbTARGET_CFG_GET_CTS_PROTECTION;
case ODIN_CFG_SET_HIDDEN_SSID: return cbTARGET_CFG_SET_HIDDEN_SSID; case ODIN_CFG_SET_HIDDEN_SSID: config = cbTARGET_CFG_SET_HIDDEN_SSID;
case ODIN_CFG_GET_HIDDEN_SSID: return cbTARGET_CFG_GET_HIDDEN_SSID; case ODIN_CFG_GET_HIDDEN_SSID: config = cbTARGET_CFG_GET_HIDDEN_SSID;
case ODIN_CFG_SET_AP_STA_INACTIVITY_TIMEOUT: return cbTARGET_CFG_SET_AP_STA_INACTIVITY_TIMEOUT; case ODIN_CFG_SET_AP_STA_INACTIVITY_TIMEOUT: config = cbTARGET_CFG_SET_AP_STA_INACTIVITY_TIMEOUT;
case ODIN_CFG_GET_AP_STA_INACTIVITY_TIMEOUT: return cbTARGET_CFG_GET_AP_STA_INACTIVITY_TIMEOUT; case ODIN_CFG_GET_AP_STA_INACTIVITY_TIMEOUT: config = cbTARGET_CFG_GET_AP_STA_INACTIVITY_TIMEOUT;
case ODIN_CFG_SET_ROAMING_AREA_HYSTERESIS: return cbTARGET_CFG_SET_ROAMING_AREA_HYSTERESIS; case ODIN_CFG_SET_ROAMING_AREA_HYSTERESIS: config = cbTARGET_CFG_SET_ROAMING_AREA_HYSTERESIS;
case ODIN_CFG_GET_ROAMING_AREA_HYSTERESIS: return cbTARGET_CFG_GET_ROAMING_AREA_HYSTERESIS; case ODIN_CFG_GET_ROAMING_AREA_HYSTERESIS: config = cbTARGET_CFG_GET_ROAMING_AREA_HYSTERESIS;
case ODIN_CFG_SET_PMF_STA: return cbTARGET_CFG_SET_PMF_STA; case ODIN_CFG_SET_PMF_STA: config = cbTARGET_CFG_SET_PMF_STA;
case ODIN_CFG_GET_PMF_STA: return cbTARGET_CFG_GET_PMF_STA; case ODIN_CFG_GET_PMF_STA: config = cbTARGET_CFG_GET_PMF_STA;
case ODIN_CFG_SET_FT_MODE: return cbTARGET_CFG_SET_FT_MODE; case ODIN_CFG_SET_FT_MODE: config = cbTARGET_CFG_SET_FT_MODE;
case ODIN_CFG_GET_FT_MODE: return cbTARGET_CFG_GET_FT_MODE; case ODIN_CFG_GET_FT_MODE: config = cbTARGET_CFG_GET_FT_MODE;
default: default:
MBED_ASSERT(false); MBED_ASSERT(false);
} }
return config;
} }
static cbTARGET_PowerSaveMode convertPowerSaveAtToIoctl(target_power_save_mode_e powerSaveMode) static cbTARGET_PowerSaveMode convertPowerSaveAtToIoctl(target_power_save_mode_e powerSaveMode)
{ {
cbTARGET_PowerSaveMode mode;
switch (powerSaveMode) { switch (powerSaveMode) {
case ODIN_POWER_SAVE_MODE_OFF: return cbTARGET_POWER_SAVE_MODE_OFF; case ODIN_POWER_SAVE_MODE_OFF: mode = cbTARGET_POWER_SAVE_MODE_OFF;
case ODIN_POWER_SAVE_MODE_SLEEP: return cbTARGET_POWER_SAVE_MODE_SLEEP; case ODIN_POWER_SAVE_MODE_SLEEP: mode = cbTARGET_POWER_SAVE_MODE_SLEEP;
case ODIN_POWER_SAVE_MODE_DEEP_SLEEP: return cbTARGET_POWER_SAVE_MODE_DEEP_SLEEP; case ODIN_POWER_SAVE_MODE_DEEP_SLEEP: mode = cbTARGET_POWER_SAVE_MODE_DEEP_SLEEP;
default: default:
MBED_ASSERT(false); MBED_ASSERT(false);
} }
return mode;
} }

View File

@ -346,6 +346,7 @@ private:
cbWLAN_MACAddress bssid[ODIN_WIFI_SCAN_CACHE_SIZE]; cbWLAN_MACAddress bssid[ODIN_WIFI_SCAN_CACHE_SIZE];
}; };
cbWLAN_Handle handle = cbWLAN_INVALID_HANDLE;
OdinWifiState entry_connect_fail_wait_disconnect(); OdinWifiState entry_connect_fail_wait_disconnect();
OdinWifiState entry_wait_connect(); OdinWifiState entry_wait_connect();
OdinWifiState entry_wait_disconnect(); OdinWifiState entry_wait_disconnect();
@ -430,10 +431,10 @@ private:
friend struct wlan_callb_s; friend struct wlan_callb_s;
Mutex _mutex; Mutex _mutex;
Queue<odin_wifi_msg_s, 6> _in_queue; Queue<odin_wifi_msg_s, 10> _in_queue;
Queue<odin_wifi_msg_s, 1> _out_queue; Queue<odin_wifi_msg_s, 1> _out_queue;
Queue<odin_wifi_msg_s, 1> _cache_queue; Queue<odin_wifi_msg_s, 1> _cache_queue;
MemoryPool<odin_wifi_msg_s, 7> *_msg_pool; MemoryPool<odin_wifi_msg_s, 11> *_msg_pool;
Thread _thread; Thread _thread;
Timer _timer; Timer _timer;

View File

@ -83,10 +83,12 @@ extern "C" {
#define cbWLAN_RSNIE_SIZE 44 #define cbWLAN_RSNIE_SIZE 44
#define cbWLAN_MDIE_SIZE 5 #define cbWLAN_MDIE_SIZE 5
#define cbWLAN_DEFAULT_HANDLE ((cbWLAN_Handle)1)
#define cbWLAN_INVALID_HANDLE (cb_UINT32_MAX)
/*=========================================================================== /*===========================================================================
* TYPES * TYPES
*=========================================================================*/ *=========================================================================*/
typedef cb_uint32 cbWLAN_Handle;
/** /**
* Start parameters passed to WLAN driver. * Start parameters passed to WLAN driver.
* *
@ -282,12 +284,13 @@ typedef enum {
* @ingroup wlan * @ingroup wlan
*/ */
typedef enum { typedef enum {
cbWLAN_STATUS_DISCONNECTED_UNKNOWN, cbWLAN_STATUS_DISCONNECTED_UNKNOWN = 0x00,
cbWLAN_STATUS_DISCONNECTED_NO_BSSID_FOUND, cbWLAN_STATUS_DISCONNECTED_NO_BSSID_FOUND,
cbWLAN_STATUS_DISCONNECTED_AUTH_TIMEOUT, cbWLAN_STATUS_DISCONNECTED_ASSOC_FAILURE,
cbWLAN_STATUS_DISCONNECTED_MIC_FAILURE, cbWLAN_STATUS_DISCONNECTED_AUTH_FAILURE,
cbWLAN_STATUS_DISCONNECTED_MIC_FAILURE,
cbWLAN_STATUS_DISCONNECTED_ROAMING, cbWLAN_STATUS_DISCONNECTED_ROAMING,
} cbWLAN_StatusDisconnectedInfo; } cbWLAN_StatusDisconnectedReason;
/** /**
* IOCTL parameters @ref cbWLAN_ioctl * IOCTL parameters @ref cbWLAN_ioctl
@ -312,14 +315,26 @@ typedef struct cbWLAN_StatusStartedInfo {
} cbWLAN_StatusStartedInfo; } cbWLAN_StatusStartedInfo;
/** /**
* Connected parameters indicated from WLAN driver for status indication * Disconnected parameters indicated from WLAN driver for status indication
* @ref cbWLAN_STATUS_DISCONNECTED.
*
* @ingroup wlan
*/
typedef struct cbWLAN_StatusDisconnectedInfo {
cbWLAN_Handle handle; /**< Handle returned by cbWLAN_connectXXX */
cbWLAN_StatusDisconnectedReason reason;
} cbWLAN_StatusDisconnectedInfo;
/**
* Connected parameters indicated from WLAN driver for status indication
* @ref cbWLAN_STATUS_CONNECTED. * @ref cbWLAN_STATUS_CONNECTED.
* *
* @ingroup wlan * @ingroup wlan
*/ */
typedef struct cbWLAN_StatusConnectedInfo { typedef struct cbWLAN_StatusConnectedInfo {
cbWLAN_MACAddress bssid; /**< BSSID of the BSS connected to. */ cbWLAN_Handle handle; /**< Handle returned by cbWLAN_connectXXX */
cbWLAN_Channel channel; /**< Operating channels of the BSS connected to. */ cbWLAN_MACAddress bssid; /**< BSSID of the BSS connected to. */
cbWLAN_Channel channel; /**< Operating channels of the BSS connected to. */
cb_uint16 mobilityDomainId; cb_uint16 mobilityDomainId;
} cbWLAN_StatusConnectedInfo; } cbWLAN_StatusConnectedInfo;
@ -385,43 +400,43 @@ cbRTSL_Status cbWLAN_init();
cbRTSL_Status cbWLAN_stop(void); cbRTSL_Status cbWLAN_stop(void);
/** /**
* Connect to access point in open mode (no encryption). * Connect to access point in open mode (no encryption).
* Connection progress is reported as @ref cbWLAN_statusIndication callbacks. * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
* *
* @param commonParams Connection parameters. * @param commonParams Connection parameters.
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbWLAN_Handle if call successful, otherwise -1.
*/ */
cbRTSL_Status cbWLAN_connectOpen(cbWLAN_CommonConnectParameters *commonParams); cbWLAN_Handle cbWLAN_connectOpen(cbWLAN_CommonConnectParameters *commonParams);
/** /**
* Connect to access point in open mode with WEP encryption. * Connect to access point in open mode with WEP encryption.
* Connection progress is reported as @ref cbWLAN_statusIndication callbacks. * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
* *
* @param commonParams Connection parameters. * @param commonParams Connection parameters.
* @param wepParams WEP specific connection parameters. * @param wepParams WEP specific connection parameters.
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbWLAN_Handle if call successful, otherwise -1.
*/ */
cbRTSL_Status cbWLAN_connectWEP(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_WEPConnectParameters *wepParams); cbWLAN_Handle cbWLAN_connectWEP(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_WEPConnectParameters *wepParams);
/** /**
* Connect to access point with WPA PSK authentication. * Connect to access point with WPA PSK authentication.
* Connection progress is reported as @ref cbWLAN_statusIndication callbacks. * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
* *
* @param commonParams Connection parameters. * @param commonParams Connection parameters.
* @param wpaParams WPA PSK specific connection parameters. * @param wpaParams WPA PSK specific connection parameters.
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbWLAN_Handle if call successful, otherwise -1.
*/ */
cbRTSL_Status cbWLAN_connectWPAPSK(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_WPAPSKConnectParameters *wpaParams); cbWLAN_Handle cbWLAN_connectWPAPSK(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_WPAPSKConnectParameters *wpaParams);
/** /**
* Connect to access point with WPA Enterprise authentication. * Connect to access point with WPA Enterprise authentication.
* Connection progress is reported as @ref cbWLAN_statusIndication callbacks. * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
* *
* @param commonParams Connection parameters. * @param commonParams Connection parameters.
* @param enterpriseParams WPA Enterprise specific connection parameters. * @param enterpriseParams WPA Enterprise specific connection parameters.
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbWLAN_Handle if call successful, otherwise -1.
*/ */
cbRTSL_Status cbWLAN_connectEnterprise(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_EnterpriseConnectParameters *enterpriseParams); cbWLAN_Handle cbWLAN_connectEnterprise(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_EnterpriseConnectParameters *enterpriseParams);
/** /**
* Disconnect from access point or stop ongoing connection attempt. * Disconnect from access point or stop ongoing connection attempt.
@ -429,7 +444,7 @@ cbRTSL_Status cbWLAN_connectEnterprise(cbWLAN_CommonConnectParameters *commonPar
* *
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
*/ */
cbRTSL_Status cbWLAN_disconnect(void); cbRTSL_Status cbWLAN_disconnect(cbWLAN_Handle handle);
/** /**
* Initiate BSS scan. * Initiate BSS scan.
@ -459,13 +474,13 @@ cbRTSL_Status cbWLAN_scan(cbWLAN_ScanParameters *params, cbWLAN_scanIndication s
cb_int16 cbWLAN_STA_getRSSI(); cb_int16 cbWLAN_STA_getRSSI();
/** /**
* Start access point in open mode (no encryption). * Start access point in open mode (no encryption).
* Connection progress is reported as @ref cbWLAN_statusIndication callbacks. * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
* *
* @param commonParams Common Accesspoint parameters. * @param commonParams Common Accesspoint parameters.
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbWLAN_Handle if call successful, otherwise -1.
*/ */
cbRTSL_Status cbWLAN_apStartOpen(cbWLAN_CommonApParameters *commonParams); cbWLAN_Handle cbWLAN_apStartOpen(cbWLAN_CommonApParameters *commonParams);
/** /**
* Start access point with WPA PSK authentication. * Start access point with WPA PSK authentication.
@ -473,16 +488,16 @@ cbRTSL_Status cbWLAN_apStartOpen(cbWLAN_CommonApParameters *commonParams);
* *
* @param commonParams Common Accesspoint parameters. * @param commonParams Common Accesspoint parameters.
* @param wpaParams WPA PSK specific parameters. * @param wpaParams WPA PSK specific parameters.
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbWLAN_Handle if call successful, otherwise -1.
*/ */
cbRTSL_Status cbWLAN_apStartWPAPSK(cbWLAN_CommonApParameters *commonParams, cbWLAN_WPAPSKApParameters *wpaParams); cbWLAN_Handle cbWLAN_apStartWPAPSK(cbWLAN_CommonApParameters *commonParams, cbWLAN_WPAPSKApParameters *wpaParams);
/** /**
* Stop access point. * Stop access point.
* *
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
*/ */
cbRTSL_Status cbWLAN_apStop(void); cbRTSL_Status cbWLAN_apStop(cbWLAN_Handle handle);
/** /**
* Send an Ethernet data packet. * Send an Ethernet data packet.
@ -490,7 +505,7 @@ cbRTSL_Status cbWLAN_apStop(void);
* *
* @param txData Pointer to the port specific Ethernet data type containing transmit data * @param txData Pointer to the port specific Ethernet data type containing transmit data
*/ */
void cbWLAN_sendPacket(void *txData); void cbWLAN_sendPacket(cbWLAN_Handle handle, void *txData);
/** /**
* Register a status indication callback. * Register a status indication callback.
@ -510,7 +525,7 @@ cbRTSL_Status cbWLAN_registerStatusCallback(cbWLAN_statusIndication statusIndica
* @param callbackContext Context pointer, will be sent back in callback. * @param callbackContext Context pointer, will be sent back in callback.
* @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR. * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
*/ */
cbRTSL_Status cbWLAN_registerPacketIndicationCallback(cbWLAN_packetIndication packetIndication, void *callbackContext); cbRTSL_Status cbWLAN_registerPacketIndicationCallback(cbWLAN_Handle handle, cbWLAN_packetIndication packetIndication, void *callbackContext);
/** /**
* Deregister the specified status indication callback. * Deregister the specified status indication callback.

View File

@ -62,7 +62,7 @@ extern "C" {
* @param enterpriseParams Enterprise parameters. * @param enterpriseParams Enterprise parameters.
* @return 0 on success, or error code on failure * @return 0 on success, or error code on failure
*/ */
cbRTSL_Status cb_eap_conn_handler(cb_char const* cert, cb_char const* pvt_key, cbWLAN_CommonConnectParameters *commonParams, cbWLAN_EnterpriseConnectParameters *enterpriseParams); cbWLAN_Handle cb_eap_conn_handler(cb_char const* cert, cb_char const* pvt_key, cbWLAN_CommonConnectParameters *commonParams, cbWLAN_EnterpriseConnectParameters *enterpriseParams);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -4647,6 +4647,7 @@
"WLAN_ENABLED", "WLAN_ENABLED",
"CB_FEATURE_802DOT11W", "CB_FEATURE_802DOT11W",
"CB_FEATURE_802DOT11R", "CB_FEATURE_802DOT11R",
"CB_FEATURE_PMKCACHING",
"MBEDTLS_ARC4_C", "MBEDTLS_ARC4_C",
"MBEDTLS_DES_C", "MBEDTLS_DES_C",
"MBEDTLS_MD4_C", "MBEDTLS_MD4_C",