-
Notifications
You must be signed in to change notification settings - Fork 3k
Port ethernet to EMAC #4918
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
Port ethernet to EMAC #4918
Conversation
Updating EMAC to enable multiple interfaces Untangling networking classes, making the abstractions a bit clearer to follow, etc General refactoring Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI
Remove lwip depencies
cc @bulislaw @geky @kjbracey-arm @hasnainvirk |
ipstack_lwip.c renamed as mbed_ipstack.c
features/netsocket/mbed_ipstack.c
Outdated
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
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.
Does this file compile without LWIP?
@KariHaapalehto, @bulislaw |
mbed_ipstac.c renamed back to ipstack_lwip.c and moved to back \FEATURE_LWIP\lwip-interface
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.
Looks ok to me, although this should really be reviewed by @bulislaw on our side
doxyfile_options
Outdated
@@ -2061,7 +2061,7 @@ PREDEFINED = DOXYGEN_ONLY \ | |||
DEVICE_ANALOGOUT \ | |||
DEVICE_CAN \ | |||
DEVICE_ETHERNET \ | |||
DEVICE_EMAC \ |
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.
Don't we need to keep DEVICE_EMAC around for backwards compatibility until all devices are ported over to DEVICE_ETH?
strncpy(_gateway, gateway ? gateway : "", sizeof(_gateway)); | ||
_gateway[sizeof(_gateway) - 1] = '\0'; |
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.
Why were these removed? strncpy doesn't garuntee a null-terminator:
http://www.cplusplus.com/reference/cstring/strncpy/
return mbed_lwip_bringup_2(_dhcp, false, | ||
nsapi_error_t err; | ||
if (_stack.emac == NULL) | ||
return NSAPI_ERROR_UNSUPPORTED; |
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.
nit: style should have brackets for all if statements:
if (_stack.emac == NULL) {
return NSAPI_ERROR_UNSUPPORTED;
}
mbed_ipstack_init(); | ||
err = mbed_ipstack_add_netif(_stack.emac, true); | ||
if (err != NSAPI_ERROR_OK) | ||
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.
nit: brackets on if statements
features/netsocket/mbed_ipstack.h
Outdated
* | ||
* @return NSAPI_ERROR_OK on success, or error code | ||
*/ | ||
void mbed_ipstack_init(void); |
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.
Documentation doesn't seem to match return type, should this return nsapi_error_t?
features/netsocket/mbed_ipstack.h
Outdated
* @param default_if true if the interface should be treated as the default one | ||
* @return NSAPI_ERROR_OK on success, or error code | ||
*/ | ||
nsapi_error_t mbed_ipstack_add_netif(emac_interface_t *emac, bool default_if); |
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.
Should this be "add_netif" still? netif is the lwip term, maybe "add_interface"?
hal/emac_api.h
Outdated
* @param emac Emac interface | ||
* @param address An multicast group IPv4 address | ||
*/ | ||
typedef void (*emac_add_multicast_group)(emac_interface_t *emac, uint8_t *address); |
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.
Is this taking in a string representation of an IP address or a byte representation? Should it actually be taking in the nsapi_addr_t struct?
… at K64F Change "uint8_t *addr" to "uint8_t addr[ETH_HWADDR_LEN]" at the emac_api.h Correct reset at emac_lwip.c
Changes has been compiled with gcc_arm compiler targeting for k64f with following configurations: |
sys_sem_* replaced with osSemaphore* so that \arch\sys_arch.h can be removed from emac_api.h
@KariHaapalehto It looks like you broke doxygen. Could you fix that error (it's in travis)? |
without lwip Doxygen warning corrected
|
@KariHaapalehto A general comment, I think you should squash one-liners into previous commits. Maybe its worth a try to actually go through your commits and squash them together if necessary. |
Please look at CI failures (both uvisor and jenkins CI report similar failures with includes not found) |
Move emac_interface_t from emac_api.h to mbed_ipstack_lwip.h and rename it to mbed_ipstack_interface emac_interface_ops_t, mbed_ipstack_interface_t and _hw added to EthernetInterface.h and _stack removed. ipstack_lwip.c renamed as mbed_ipstack_lwip.c
Work picked up in #5202 - I think this can be closed? |
Work picked up by Kari Haapalehto in ARMmbed#4918, from Bartek Szatkowsi's branch at ARMmbed#4079, commit 8c28917. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Refactor k64f_emac * Remove lwip depencies * Correct doxygen warnings * Add weak definitions for mbed_ipstack.h functions. * Remove emac_interface_t - drivers register with emac_interface_ops_t and void *, and get an mbed_ipstack_interface_t to pass to stack. * Reinstate use of EthInterface abstraction * ipstack_lwip.c renamed as mbed_ipstack_lwip.c * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with mbed_ipstack_lwip.cpp
I'll close this, please reopen if should not be. |
Updating EMAC to enable multiple interfaces
Untangling networking classes, making the abstractions a bit clearer to follow, etc
General refactoring
Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI
Status
IN DEVELOPMENT