From bb685fc703755d325dfb8d17f0abc55eeeb38c27 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Wed, 21 Sep 2016 00:40:54 +0200 Subject: [PATCH] appnet: add more variants of driver setup. The FXP driver has been successfully tested with Intel i82557b network card emulated by QEMU. Signed-off-by: Pavel Pisa --- rtems-omk-template/appnet/init.c | 7 ++- rtems-omk-template/appnet/networkconfig.h | 63 +++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/rtems-omk-template/appnet/init.c b/rtems-omk-template/appnet/init.c index e25d49d..181e43c 100644 --- a/rtems-omk-template/appnet/init.c +++ b/rtems-omk-template/appnet/init.c @@ -106,8 +106,11 @@ rtems_task Init( printf( "\n\nRTEMS v " BUILD_VERSION_STRING(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__) - "\n"); - + "\n"); + + printf("RTEMS_BSP_NETWORK_DRIVER_NAME = %s\n", __XSTRING(RTEMS_BSP_NETWORK_DRIVER_NAME)); + printf("RTEMS_BSP_NETWORK_DRIVER_ATTACH = %s\n", __XSTRING(RTEMS_BSP_NETWORK_DRIVER_ATTACH)); + rtems_monitor_init(RTEMS_MONITOR_SUSPEND|RTEMS_MONITOR_GLOBAL); /*rtems_capture_cli_init (0);*/ diff --git a/rtems-omk-template/appnet/networkconfig.h b/rtems-omk-template/appnet/networkconfig.h index e5158eb..191076f 100644 --- a/rtems-omk-template/appnet/networkconfig.h +++ b/rtems-omk-template/appnet/networkconfig.h @@ -7,6 +7,10 @@ static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 }; +int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching); +int rtems_vtnet_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching); + +#if 1 static struct rtems_bsdnet_ifconfig netdriver_config = { .name = RTEMS_BSP_NETWORK_DRIVER_NAME, .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH, @@ -23,15 +27,74 @@ static struct rtems_bsdnet_ifconfig netdriver_config = { .bpar = 0, .drv_ctrl = NULL }; +#elif 1 +static struct rtems_bsdnet_ifconfig netdriver_config = { + .name = "fxp1" /*RTEMS_BSP_NETWORK_DRIVER_NAME*/, + .attach = rtems_fxp_attach /*RTEMS_BSP_NETWORK_DRIVER_ATTACH*/, + .next = NULL, + .ip_address = "192.168.3.66", + .ip_netmask = "255.255.255.0", + .hardware_address = ethernet_address, + .ignore_broadcast = 0, + .mtu = 0, + .rbuf_count = 0, + .xbuf_count = 0, + .port = 0, + .irno = 0, + .bpar = 0, + .drv_ctrl = NULL +}; +#elif 1 +static struct rtems_bsdnet_ifconfig netdriver_config = { + .name = "vio0" /*RTEMS_BSP_NETWORK_DRIVER_NAME*/, + .attach = rtems_vtnet_driver_attach /*RTEMS_BSP_NETWORK_DRIVER_ATTACH*/, + .next = NULL, + .ip_address = "192.168.3.66", + .ip_netmask = "255.255.255.0", + .hardware_address = ethernet_address, + .ignore_broadcast = 0, + .mtu = 0, + .rbuf_count = 0, + .xbuf_count = 0, + .port = 0, + .irno = 0, + .bpar = 0, + .drv_ctrl = NULL +}; +#else +static struct rtems_bsdnet_ifconfig netdriver_config = { + .name = (char *)BSP_NE2000_NETWORK_DRIVER_NAME, + .attach = BSP_NE2000_NETWORK_DRIVER_ATTACH, + .next = NULL, + .ip_address = "192.168.3.66", + .ip_netmask = "255.255.255.0", + .hardware_address = ethernet_address, + .ignore_broadcast = 0, + .mtu = 0, + .rbuf_count = 0, + .xbuf_count = 0, + .port = 0x300, + .irno = 9, + .bpar = 0, + .drv_ctrl = NULL +}; +#endif struct rtems_bsdnet_config rtems_bsdnet_config = { .ifconfig = &netdriver_config, /* .bootp = rtems_bsdnet_do_bootp,*/ /* .bootp = rtems_bsdnet_do_dhcp,*/ +#if 1 .bootp = rtems_bsdnet_do_dhcp_failsafe, +#endif .network_task_priority = 0, /* 100 */ +#if 1 .mbuf_bytecount = 256 * 1024, /* 64 kbytes */ .mbuf_cluster_bytecount = 256 * 1024, /* 128 kbytes */ +#else + .mbuf_bytecount = 2048 * 1024, /* 2 MB */ + .mbuf_cluster_bytecount = 2048 * 1024, /* 2 MB */ +#endif .hostname = NULL, .domainname = NULL, .gateway = "192.168.3.1", -- 2.39.2