Пример #1
0
void system_init(void)
{

#ifdef CONFIGURE_DRIVER_PCI_GR_RASTA_IO
	/* Register GR-RASTA-IO driver resources for the AMBA PnP bus available
	 * on the GR-RASTA-IO board.
	 */
	system_init_rastaio();
#endif

#if (defined(ENABLE_NETWORK_SMC_LEON2) && defined(LEON2)) ||  \
    (defined(ENABLE_NETWORK_SMC_LEON3) && defined(LEON3))
	/* Registering SMC driver first, this way the first entry in
	 * interface_configs will reflect the SMC network settings.
	 */
	smcconfig.name = "smc1";
	smcconfig.drv_ctrl = NULL;
	smcconfig.attach = (void *)RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111;
	network_interface_add(&smcconfig);
#endif

	/* CPU/SYSTEM specific Init */
	system_init2();

#ifndef RTEMS_DRVMGR_STARTUP
	/* Initializing Driver Manager if not alread performed by BSP */
	printf("Initializing manager\n");
	if ( rtems_drvmgr_init() ) {
		printf("Driver manager Failed to initialize\n");
		exit(-1);
	}
#endif

	/* Print Driver manager drivers and their assigned devices */
	/*rtems_drvmgr_print_drvs(1);*/

#ifdef ENABLE_NETWORK
	/* Init network */
	printf("Initializing network\n");
	rtems_bsdnet_initialize_network ();
	printf("Initializing network DONE\n\n");
	rtems_bsdnet_show_inet_routes();
	printf("\n");
	rtems_bsdnet_show_if_stats();
	printf("\n\n");
#endif

}
Пример #2
0
static int init()
{
    struct inet_ip_addr_t ipaddr;
    struct inet_ip_addr_t netmask;
    struct inet_ip_addr_t gw;

    sys_start();

    std_printf(sys_get_info());

    uart_init(&ipuart, &uart_device[1], 115200, iprxbuf, sizeof(iprxbuf));
    uart_start(&ipuart);

    inet_module_init();
    socket_module_init();
    network_interface_slip_module_init();

    inet_aton("169.254.1.2", &ipaddr);
    inet_aton("255.255.255.0", &netmask);
    inet_aton("0.0.0.0", &gw);

    network_interface_slip_init(&slip,
                                &ipaddr,
                                &netmask,
                                &gw,
                                &ipuart.chout);
    network_interface_add(&slip.network_interface);
    network_interface_start(&slip.network_interface);

    thrd_spawn(slip_reader,
               NULL,
               0,
               stack,
               sizeof(stack));

    http_server_init(&server,
                     &listener,
                     connections,
                     NULL,
                     routes,
                     no_route);

    http_server_start(&server);

    return (0);
}