-
Notifications
You must be signed in to change notification settings - Fork 3k
add-rtl8195am-feature-emac #6904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add-rtl8195am-feature-emac #6904
Conversation
rtl8195am feature emac implementation. coding style fix. Updated emac greentea tests ARMmbed#6851.
Looks like you've got a local copy of #6851 included - please rebase and tidy up. |
@kjbracey-arm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're in the process of merging feature-emac now, so we'll need fixes as soon as possible if this driver is going to make it to 5.9.0.
@@ -9,7 +9,7 @@ | |||
}, | |||
"connect-statement" : { | |||
"help" : "Disabled until EMAC updated", | |||
"value" : null | |||
"value" : "((RTWInterface *)net)->connect(WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY, WIFI_CHANNEL)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hadn't you needed an alternate version of this (net->wiFiInterface()->connect
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It should be net->wiFiInterface()->connect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some review comments
|
||
#define LWIP 0x11991199 | ||
#if MBED_CONF_NSAPI_DEFAULT_STACK == LWIP | ||
rtw_emac.wlan_emac_link_change(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rtw_emac.wlan_emac_link_change() calls can be removed from here and link status call can be made on emac power up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikaleppanen
the add_ethernet_interface
will run emac_if_init
to set the callback and then power up
. Logic here is correct.
However, the netif->flags
will be set by the following code. It is still cause the "connection error" from bringup()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The netif->flags setting before power up was a bug in the lwip. I made a pull request to fix that: #6926.
You can remove the callback from there and take my pull request into your test build. It should work now correctly and trigger the link up from power up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it seems that for second connect after disconnect, the callback is needed. It could be unconditional before the interface check e.g. like this:
rtw_emac.wlan_emac_link_change(true);
if (!rtw_interface) {
nsapi_error_t err = rtw_obn_stack.add_ethernet_interface(rtw_emac, true, &rtw_interface);
if (err != NSAPI_ERROR_OK) {
rtw_interface = NULL;
return err;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Will add rtw_emac.wlan_emac_link_change(true);
after wifi_connect
.
#define TEST 0x33254234 | ||
#if MBED_CONF_NSAPI_DEFAULT_STACK == TEST | ||
if (rtw_if_bringup == NSAPI_ERROR_OK) { | ||
rtw_emac.wlan_emac_link_change(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this can be removed.
free(sg_list); | ||
return ret; | ||
} | ||
|
||
static bool wlan_power_up(emac_interface_t *emac) | ||
bool RTW_EMAC::power_up() | ||
{ | ||
wifi_on(RTW_MODE_STA); | ||
wait_ms(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link up can be made here. e.g.
if (emac_link_state_cb) {
emac_link_state_cb(true);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emac_link_state_cb is the callback set by the stack, so it can be called here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed to use wlan_emac_link_change(true);
wlan_emac_link_change(true);
and
if (emac_link_state_cb) {
emac_link_state_cb(true);
}
actually are same. Thank you.
void *emac_link_state_data; | ||
emac_link_input_cb_t emac_link_input_cb; | ||
emac_link_state_change_cb_t emac_link_state_cb; | ||
LWIPMemoryManager *memory_manager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be EMACMemoryManager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Confirmed, should use EMACMemoryManager
.
fix the conflicts with ARMmbed#6851.
Expecting the ARMmbed#6926 Corrected lwip netif flags to be set before power up
@@ -9,7 +9,7 @@ | |||
}, | |||
"connect-statement" : { | |||
"help" : "Disabled until EMAC updated", | |||
"value" : "((RTWInterface *)net)->connect(WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY, WIFI_CHANNEL)" | |||
"value" : "(net->wifiInterface()->connect(WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY, WIFI_CHANNEL)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm mistaken, this has an excess '(' at the front.
Could you put back the original help from master too:
"help": "Must use 'net' variable name, replace WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY, WIFI_CHANNEL with your WiFi settings",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
{ | ||
return RTW_EMAC_MTU_SIZE; | ||
} | ||
|
||
static void wlan_get_ifname(emac_interface_t *emac, char *name, uint8_t size) | ||
uint32_t RTW_EMAC::get_align_preference() const | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to return something. 1
is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Confirmed to add return true;
for RTW_EMAC::get_align_preference()
.
|
||
#include "LWIPStack.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't be including LWIPStack.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Confirmed to delete LWIPStack.h
.
uint8_t pscan_config = PSCAN_ENABLE; | ||
wifi_set_pscan_chan(&_channel, &pscan_config, 1); | ||
} | ||
|
||
ret = wifi_connect(_ssid, sec, _pass, strlen(_ssid), strlen(_pass), 0, (void *)NULL); | ||
if (ret != RTW_SUCCESS) { | ||
printf("failed: %d\r\n", ret); | ||
return NSAPI_ERROR_NO_CONNECTION; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Mika mentioned, you will still need a "link up" callback here after the "wifi_connect", to ensure the upcall occurs if this is the second connect, and the stack is already bound to you. That's the direct mirror of the "link down" callback from "disconnect".
The callback in "power_up" then handles the case of the first connect, when the stack wasn't attached to hear this link-up callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Will add rtw_emac.wlan_emac_link_change(true);
after wifi_connect
.
add link call back after wifi_connect add return for get_align_preference delete LWIPStack.h from RTWInterface.cpp coding style fix
"help" : "Disabled until EMAC updated", | ||
"value" : null | ||
"help" : "Must use 'net' variable name, replace WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY, WIFI_CHANNEL with your WiFi settings", | ||
"value" : "(net->wifiInterface()->connect(WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY, WIFI_CHANNEL)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still has a stray opening '(
at the front. I can edit this myself - going to need to rebase and tidy this commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but I'll rebase to tidy up and remove the opening '('.
It's passing tests here.
/morph build |
Build : FAILUREBuild number : 2053 |
@M-ichae-l Looks like all three compilers failed with a missing header against the REALTEK_RTL8195AM
|
@cmonr the actual files is all in lowercase. Need to change all the |
Change all the#include "Rtw_emac.h" and #include "Rtw_emac.cpp" become #include "rtw_emac.h" and #include "rtw_emac.cpp" coding style fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/morph build |
Build : SUCCESSBuild number : 2059 Triggering tests/morph test |
I had been trying to accelerate CI by combining the PRs here #6936 - the case fix is already made on that PR. I've stuck the "do not merge" label on the ones I've combined, so they don't need to be dealt with. Unfortunately the CI has mostly been down within my working hours, so this hasn't really been working out. |
Exporter Build : SUCCESSBuild number : 1703 |
Test : SUCCESSBuild number : 1871 |
* feature-emac: (61 commits) recompiled driver against NetworkInterface changes on latest feature-emac WiFi EMAC class name reflected in WiFi drivers binaries WIFI_EMAC class renamed to OdinWiFiEMAC, Formatting Revert "in ODIN emac initialization required before connection" LPC546XX: Correct Ethernet length calculations LPC546XX: Correct Ethernet MAC address write Removed EMAC get default instance from EMAC tests Add memory configuration for LPC546XX LPC546XX: Add ENET support in ODIN emac initialization required before connection EMAC adaption added, updated ODIN drivers to v2.5.0 RC1 Updated ublox odin greentea test configuration file connect statement add-rtl8195am-feature-emac (#6904) Corrected lwip netif flags to be set before power up Add NetworkInterface::get_default_instance() Build mbed-os-example-lora only for lora targets Added memory manager set to add_ethernet_interface() of test stack Changed mutexes, delete and DNS call in callback set Corrected more defects Corrected defects - Changed call_in/call methods of the stack to callback provided by the stack - Specified what are limitations for operations that are made in callback - Added pure virtual class DNS that defines DNS operations - Added cancel operation and unique ID to DNS request used in cancel - Added DNS configuration options to netsocket/mbed_lib.json for retries, response wait time and cache size - Changed host name to use dynamic memory in DNS query list and cache, set maximum length for the name to 255 bytes. - Added mutex to asynchronous DNS - Reworked retries: there is now total retry count and a server specific count - Ignores invalid incoming UDP socket messages (DNS header is not valid), and retries DNS query - Reworked DNS module asynchronous operation functions - Corrected other review issues (nothrow new, missing free, missing mutex unlock etc.) Added non-blocking DNS functionality to network interface ...
rtl8195am feature emac implementation.
rtl8195am feature emac implementation.
Description
rtl8195am feature emac implementation.
coding style fix.
Updated emac greentea tests #6851.
Pull request type