diff --git a/kernel/init.c b/kernel/init.c index 4d54b4d4..ff83c477 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -71,6 +71,9 @@ int lowlevel_init(void) #if defined(CONFIG_LWIP) && (defined(CONFIG_PCI) || defined(CONFIG_ROCKCREEK)) static struct netif default_netif; +#ifdef CONFIG_ROCKCREEK +static struct netif mmnif_netif; +#endif static int init_netifs(void) { @@ -83,8 +86,9 @@ static int init_netifs(void) // Set up the lwIP network interface memset(&default_netif, 0x00, sizeof(struct netif)); - #ifdef CONFIG_ROCKCREEK + memset(&mmnif_netif, 0x00, sizeof(struct netif)); + /* Set network address variables */ IP4_ADDR(&gw, 192,168,28,254); IP4_ADDR(&ipaddr, 192,168,28,RCCE_ue()+1); @@ -92,12 +96,38 @@ static int init_netifs(void) /* Bring up the network interface */ if ((err = netifapi_netif_add(&default_netif, &ipaddr, &netmask, &gw, NULL, rckemacif_init, tcpip_input)) != ERR_OK) { - kprintf("Unable to add network interface: err = %d\n", err); + kprintf("Unable to add the network interface: err = %d\n", err); return -ENODEV; } netifapi_netif_set_default(&default_netif); netifapi_netif_set_up(&default_netif); + + /* Bring up the intra network interface */ + struct ip_addr intra_ipaddr; + struct ip_addr intra_netmask; + struct ip_addr intra_gw; + + IP4_ADDR(&intra_gw, 0,0,0,0); + IP4_ADDR(&intra_ipaddr, 192,168,0,RCCE_ue()+1); + IP4_ADDR(&intra_netmask, 255,255,255,0); + + /* register our Memory Mapped Virtual IP interface in the lwip stack + * and tell him how to use the interface: + * - mmnif_dev : the device data storage + * - ipaddr : the ip address wich should be used + * - gw : the gateway wicht should be used + * - mmnif_init : the initialization which has to be done in order to use our interface + * - ethernet_input : tells him that he should get ethernet input (inclusice ARP) + */ + if ((err = netifapi_netif_add(&mmnif_netif, &intra_ipaddr, &intra_netmask, &intra_gw, NULL, mmnif_init, tcpip_input)) != ERR_OK) + { + kprintf("Unable to add the intra network interface: err = %d\n", err); + return -ENODEV; + } + + /* tell lwip all initialization is done and we want to set it ab */ + netifapi_netif_set_up(&mmnif_netif); #else /* Clear network address because we use DHCP to get an ip address */ IP4_ADDR(&gw, 0,0,0,0); @@ -106,7 +136,7 @@ static int init_netifs(void) /* Bring up the network interface */ if ((err = netifapi_netif_add(&default_netif, &ipaddr, &netmask, &gw, NULL, rtl8139if_init, tcpip_input)) != ERR_OK) { - kprintf("Unable to add network interface: err = %d\n", err); + kprintf("Unable to add the network interface: err = %d\n", err); return -ENODEV; } @@ -144,11 +174,10 @@ static void tcpip_init_done(void* arg) static int network_shutdown(void) { #if defined(CONFIG_LWIP) && defined(CONFIG_ROCKCREEK) + mmnif_shutdown(); netifapi_netif_set_down(&default_netif); - memset(&default_netif, 0x00, sizeof(struct netif)); #elif defined(CONFIG_LWIP) && defined(CONFIG_PCI) netifapi_dhcp_stop(&default_netif); - memset(&default_netif, 0x00, sizeof(struct netif)); #endif return 0; @@ -209,6 +238,7 @@ int initd(void* arg) { #ifdef CONFIG_LWIP sys_sem_t sem; + tid_t id; char* argv[] = {"/bin/rlogind ", NULL}; // Initialize lwIP modules @@ -230,9 +260,10 @@ int initd(void* arg) #endif // start echo, netio and rlogind - echo_init(); - netio_init(); - create_user_task(NULL, "/bin/rlogind", argv); + //echo_init(); + //create_user_task(&id, "/bin/rlogind", argv); + //kprintf("Create rlogind with id %u\n", id); + //netio_init(); #endif list_root(); diff --git a/kernel/main.c b/kernel/main.c index c458c3aa..62753e41 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -60,6 +60,8 @@ int smp_main(void) int main(void) { + tid_t id; + lowlevel_init(); pushbg(COL_BLUE); @@ -91,7 +93,8 @@ int main(void) kprintf("Current available memory: %u MBytes\n", atomic_int32_read(&total_available_pages)/((1024*1024)/PAGE_SIZE)); sleep(5); - create_kernel_task(NULL, initd, NULL, NORMAL_PRIO); + create_kernel_task(&id, initd, NULL, NORMAL_PRIO); + kprintf("Create initd with id %u\n", id); reschedule(); while(1) {