MCPcopy Create free account
hub / github.com/apache/nuttx / netdev_register

Function netdev_register

net/netdev/netdev_register.c:278–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276 ****************************************************************************/
277
278int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
279{
280 FAR struct net_driver_s **last;
281 FAR char devfmt_str[IFNAMSIZ];
282 FAR const char *devfmt;
283 uint32_t flags = 0;
284 uint16_t pktsize = 0;
285 uint8_t llhdrlen = 0;
286 int devnum;
287#ifdef CONFIG_NETDEV_IFINDEX
288 int ifindex;
289#endif
290
291 if (dev != NULL)
292 {
293 /* Set the protocol used by the device and the size of the link
294 * header used by this protocol.
295 */
296
297 switch (lltype)
298 {
299#ifdef CONFIG_NET_LOOPBACK
300 case NET_LL_LOOPBACK: /* Local loopback */
301 llhdrlen = 0;
302 pktsize = NET_LO_PKTSIZE;
303 devfmt = NETDEV_LO_FORMAT;
304 flags = IFF_LOOPBACK;
305 break;
306#endif
307
308#ifdef CONFIG_NET_ETHERNET
309 case NET_LL_ETHERNET: /* Ethernet */
310 llhdrlen = ETH_HDRLEN;
311 pktsize = CONFIG_NET_ETH_PKTSIZE;
312 devfmt = NETDEV_ETH_FORMAT;
313 flags = IFF_BROADCAST | IFF_MULTICAST;
314 break;
315#endif
316
317#ifdef CONFIG_DRIVERS_IEEE80211
318 case NET_LL_IEEE80211: /* IEEE 802.11 */
319 llhdrlen = ETH_HDRLEN;
320 pktsize = CONFIG_NET_ETH_PKTSIZE;
321 devfmt = NETDEV_WLAN_FORMAT;
322 flags = IFF_BROADCAST | IFF_MULTICAST;
323 break;
324#endif
325
326#ifdef CONFIG_NET_CAN
327 case NET_LL_CAN: /* CAN bus */
328 dev->d_llhdrlen = 0;
329 dev->d_pktsize = NET_CAN_PKTSIZE;
330 devfmt = NETDEV_CAN_FORMAT;
331 flags = IFF_NOARP;
332 break;
333#endif
334
335#ifdef CONFIG_NET_BLUETOOTH

Callers 15

emac_initializeFunction · 0.85
misoc_net_initializeFunction · 0.85
sim_cansock_initializeFunction · 0.85
bl602_net_initializeFunction · 0.85
mpfs_ethinitializeFunction · 0.85
litex_ethinitializeFunction · 0.85
esp32c3_net_initializeFunction · 0.85
pic32mx_ethinitializeFunction · 0.85
pic32mz_ethinitializeFunction · 0.85
z80_netinitializeFunction · 0.85
esp32_emac_initFunction · 0.85
pktradio_espnowFunction · 0.85

Calls 10

nxrmutex_initFunction · 0.85
netdev_list_lockFunction · 0.85
get_ifindexFunction · 0.85
netdev_list_unlockFunction · 0.85
find_devnumFunction · 0.85
igmp_devinitFunction · 0.85
mld_devinitFunction · 0.85
icmpv6_devinitFunction · 0.85
strlcpyFunction · 0.50
snprintfFunction · 0.50

Tested by

no test coverage detected