Exemple #1
0
int main(void)
{
    shell_t shell;
    LED_RED_OFF;

    /* initialize (and run) the brain */
    puts("initializing the brain");
    brain_init();

    /* run the shell for debugging purposes */
    puts("running the shell");
    shell_init(&shell, _commands, SHELL_BUFSIZE, _readc, _putc);
    shell_run(&shell);

    /* should never be reached */
    return 0;
}
Exemple #2
0
int main(void)
{
    puts("Sensor Token Up");

    /* we assume the transceiver is started! */
    netsetup_set_channel(CONFIG_CHANNEL);
    netsetup_set_address(CONFIG_OWN_ADDRESS);
    netsetup_register_ondata(net_receive);
    printf("CHANNEL: %d\tADDRESS: %d\n", CONFIG_CHANNEL, CONFIG_OWN_ADDRESS);
    netsetup_start();

    /* start shell */
    posix_open(uart0_handler_pid, 0);
    shell_t shell;
    shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
    shell_run(&shell);
}
Exemple #3
0
/*-----------------------------------------------------------------------------------*/
PROCESS_THREAD(shell_gui_process, ev, data)
{
  PROCESS_BEGIN();

  ctk_window_new(&window, SHELL_GUI_XSIZE,
		 SHELL_GUI_YSIZE + 1, "Command shell");
  CTK_WIDGET_ADD(&window, &loglabel);
  /*    CTK_WIDGET_SET_FLAG(&loglabel, CTK_WIDGET_FLAG_MONOSPACE);*/
  CTK_WIDGET_ADD(&window, &commandentry);
  /*    CTK_WIDGET_SET_FLAG(&commandentry, CTK_WIDGET_FLAG_MONOSPACE);*/
  CTK_WIDGET_FOCUS(&window, &commandentry);

  shell_init();
  shell_file_init();
  shell_ps_init();
  shell_run_init();
  shell_text_init();
  shell_time_init();
  shell_wget_init();

  ctk_window_open(&window);

  while(1) {
    PROCESS_WAIT_EVENT();

    if(ev == ctk_signal_widget_activate &&
       data == (process_data_t)&commandentry) {
      int command_len = (int)strlen(command);
      shell_default_output("> ", 2, command, command_len);
      shell_input(command, command_len);
      if(shell_gui_process.state) {
        CTK_TEXTENTRY_CLEAR(&commandentry);
        CTK_WIDGET_REDRAW(&commandentry);
      }
    } else if(ev == ctk_signal_window_close ||
	      ev == PROCESS_EVENT_EXIT) {
      shell_quit();
      ctk_window_close(&window);
      process_exit(&shell_gui_process);
      LOADER_UNLOAD();
    }
  }
  PROCESS_END();
}
Exemple #4
0
int main(void) {
    printf("6LoWPAN\n");
    vtimer_init();
    
    posix_open(uart0_handler_pid, 0);
    //struct tm now;
    //rtc_get_localtime(&now);
    
    //srand((unsigned int)now.tm_sec);
    //uint8_t random = rand() % 256;
    //printf("address: %d\n", random);

    shell_t shell;
    shell_init(&shell, shell_commands, uart0_readc, uart0_putc);

    shell_run(&shell);

    return 0;
}
Exemple #5
0
init(void)
{
	int             secs;

	mem_init();
	trap_init();
	kstdio_init();
	stdio_init();
	tty_init();
	timer_init();
	kern_init();
	enable_intrs();
#ifdef MV134_TIMER_TEST
	/* for testing only, XXX */
	timer_test_init();
#endif
	/* gdb_init(); XXX if enabled never returns */
	shell_init();
}
Exemple #6
0
int main(void)
{
    shell_t shell;
    (void) posix_open(uart0_handler_pid, 0);

#ifdef MODULE_LTC4150
    ltc4150_start();
#endif

#ifdef MODULE_TRANSCEIVER
    init_transceiver();
#endif

    (void) puts("Welcome to RIOT!");

    shell_init(&shell, NULL, UART0_BUFSIZE, shell_readc, shell_putchar);

    shell_run(&shell);
    return 0;
}
Exemple #7
0
int main(void) {
#if defined (__USE_LPCOPEN)
    // Read clock settings and update SystemCoreClock variable
    SystemCoreClockUpdate();
#endif

    SwitchMatrix_Init();
    IOCON_Init();
    uart_init();
    uart_setup();
    shell_init(uart_get_char, uart_put_char);
    gpio_init();
    if (!shell_add_command("version", command_version)) {
        uart_put_line("shell_add_command(version) error\n");
    }

    shell_set_prompt("\n$>");
    shell_start(); /* no return */

    return 0 ;
}
Exemple #8
0
int main(void)
{
    shell_t shell;
    gnrc_netreg_entry_t dump;

    puts("KW2XRF device driver test");

    /* register the pktdump thread */
    puts("Register the packet dump thread for GNRC_NETTYPE_UNDEF packets");
    dump.pid = gnrc_pktdump_getpid();
    dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
    gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);

    /* start the shell */
    puts("Initialization successful - starting the shell now");
    (void) posix_open(uart0_handler_pid, 0);
    shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
    shell_run(&shell);

    return 0;
}
Exemple #9
0
int main(void)
{
    puts("CCN!");

    if (msg_init_queue(msg_buffer_shell, SHELL_MSG_BUFFER_SIZE) != 0) {
        DEBUG("msg init queue failed...abording\n");
        return -1;
    }

    riot_ccn_relay_start();

    puts("starting shell...");
    puts("  posix open");
    posix_open(uart0_handler_pid, 0);
    puts("  shell init");
    shell_init(&shell, sc, UART0_BUFSIZE, uart0_readc, uart0_putc);
    puts("  shell run");
    shell_run(&shell);

    return 0;
}
Exemple #10
0
int main(void)
{
    shell_t shell;
    const char *disco_addr = DISCO_ADDR;

    port[0] = (uint8_t)DISCO_PORT;
    port[1] = (uint8_t)(DISCO_PORT >> 8);
    ng_ipv6_addr_from_str(&addr, disco_addr);

    char buf[100];
    ng_ipv6_addr_to_str(buf, &addr, 100);
    printf("got address: %s\n", buf);


    set_chan(DISCO_CHANNEL);

    shell_init(&shell, shell_commands, STDIO_RX_BUFSIZE, getchar, putchar);
    shell_run(&shell);

    return 0;
}
Exemple #11
0
int main( void )
{
    // Initialize platform first
    if( platform_init() != PLATFORM_OK )
    {
        // This should never happen
        while( 1 );
    }

    // Initialize the TLSF allocator
    // (if TLSF is not used, the next function does nothing)
    tlsf_elua_init();

    // Initialize device manager
    dm_init();

    // Register the ROM filesystem
    dm_register( romfs_init() );

    // Initialize XMODEM
    xmodem_init( xmodem_send, xmodem_recv );

    // Initialize terminal
    term_init( TERMINAL_LINES, TERMINAL_COLS, term_out, term_in, term_translate );

    printf( ".text ends at %p\n", etext );

    // Run the shell
    if( shell_init( XMODEM_MAX_FILE_SIZE ) == 0 )
    {
        printf( "Unable to initialize the eLua shell!\n" );
        // Start Lua directly
        char* lua_argv[] = { "lua", NULL };
        lua_main( 1, lua_argv );
    }
    else
        shell_start();

    while( 1 );
}
Exemple #12
0
int main()
{
    uint32_t mask;

    init();

    /* Spawn the shell. */
    shell_init(&shell, &uart.chin, &uart.chout, NULL, NULL, NULL, NULL);
    thrd_spawn(shell_main,
               &shell,
               0,
               shell_stack,
               sizeof(shell_stack));

    while (1) {
        mask = (EVENT_BUTTON_PLAY
                | EVENT_BUTTON_NEXT
                | EVENT_BUTTON_PREV
                | EVENT_BUTTON_STOP);
        event_read(&event, &mask, sizeof(mask));

        if (mask & EVENT_BUTTON_PLAY) {
            handle_event_play();
        }

        if (mask & EVENT_BUTTON_NEXT) {
            handle_event_next();
        }

        if (mask & EVENT_BUTTON_PREV) {
            handle_event_prev();
        }

        if (mask & EVENT_BUTTON_STOP) {
            handle_event_stop();
        }
    }

    return (0);
}
Exemple #13
0
static bsp_init (void)
{
	rg_led_init ();

	g_led (0);

	#if FS_EN == 1
		fs_init ();
	#endif

	#if SHELL_EN == 1
 		shell_init ();
	#endif

	

	#if TCP_EN == 1
		init_TcpNet ();
	#endif
				
	#if KEY_EN == 1
 		key_init ();
	#endif
	
	#if RESET_KEY_EN == 1
		reset_key_init ();
	#endif

	#if GUI_EN == 1
		lcd_init (); 
		lcd_write_led (0);	  
		widget_init ();
	#endif

	I2CInit(0);

	#if RTC_EN == 1
		pcf8563_init ();
	#endif
}
Exemple #14
0
void kernel_main() {
  gdt_install();
  idt_install();
  isrs_install();
  irq_install();
  terminal_initialize();
  memory_manager_init();
  enable_interrupts();
  timer_install();
  keyboard_install();
  shell_init();

  terminal_writestring("Hello, kernel World!\n");
  terminal_writestring("Here is some text in a new line\n");
  terminal_writestring("Here is some more text\n");
  terminal_writestring("Here is a new line\n");
  terminal_writestring("Here is some text after terminal scroll\n");
  char str[] = "A string";
  char ch = 'c';
  int integer = 45;
  printf("This is a test for printf.\nThis is a char %c and this a string %s\n", ch, str);
  printf("This is an int %d. This is the same in hex %x\n", integer, integer);

  for (size_t i = 0; i < 5; i++) {
    printf("This is line number %d\n", i);
  }

  puts("waiting for 2 sec\n");
  timer_wait(2);
  puts("waiting complete\n");

  char buffer[200];
  gets(buffer);
  printf("%s\n", buffer);
  while(1) {
    shell();
  }

}
Exemple #15
0
/**
 * @brief   Maybe you are a golfer?!
 */
int main(void)
{
    shell_t shell;
    ng_netreg_entry_t dump;

    puts("RIOT sniffer application");

    /* start and register rawdump thread */
    puts("Run the rawdump thread and register it");
    dump.pid = thread_create(rawdmp_stack, sizeof(rawdmp_stack), RAWDUMP_PRIO,
                             CREATE_STACKTEST, rawdump, NULL, "rawdump");
    dump.demux_ctx = NG_NETREG_DEMUX_CTX_ALL;
    ng_netreg_register(NG_NETTYPE_UNDEF, &dump);

    /* start the shell */
    puts("All ok, starting the shell now");
    (void) posix_open(uart0_handler_pid, 0);
    shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
    shell_run(&shell);

    return 0;
}
Exemple #16
0
void main (void)
{
  printf ("Jerry Compilation " __DATE__ " " __TIME__ "\n");
  jerry_init (JERRY_INIT_EMPTY);
  jerry_value_t global_obj_val = jerry_get_global_object ();

  jerry_value_t print_func_name_val = jerry_create_string ((jerry_char_t *) "print");
  print_function = jerry_get_property (global_obj_val, print_func_name_val);
  jerry_release_value (print_func_name_val);
  jerry_release_value (global_obj_val);
  if (jerry_value_has_error_flag (print_function))
  {
    printf ("Error: could not look up print function, expression results won't be printed\n");
  }

  shell_register_app_cmd_handler (shell_cmd_handler);
  shell_init ("js> ", commands);
  /* Don't call jerry_cleanup() here, as shell_init() returns after setting
     up background task to process shell input, and that task calls
     shell_cmd_handler(), etc. as callbacks. This processing happens in
     the infinite loop, so JerryScript doesn't need to be de-initialized. */
} /* main */
Exemple #17
0
//==========================================================| MAIN
int main( int argc, char *argv[] ) {
	DEBUG_LEVEL = 0;

	logger log = { debug_function };
	log.debug( INFO(1), "SHELL START" );
	
	int status;
	char* new_line;
	line* parsed_line;
	
    shell_init();
    while( ! is_end_of_file() ) {
        print_prompt();
        new_line = get_line();
        if( !new_line ) continue;
        parsed_line = parseline( new_line );
        execute_line( parsed_line );   
    }
    
    log.debug( INFO(1), "SHELL STOP" );
    exit( EXIT_SUCCESS );
}
void user_init( void )
{
	positiondebut = 0;
	positionfin = 1; 


	positiondebutUDP = 0;
	positionfinUDP = 0;

    static struct station_config config;
    uart_div_modify( 0, UART_CLK_FREQ / ( 115200 ) );
    os_printf( "%s\n", __FUNCTION__ );
    uart_init(115200,9600);
    spi_slave_init(HSPI,SPI_BUFF);
    wifi_station_set_hostname( HOSTNAME );
    wifi_set_opmode_current( STATIONAP_MODE );
    gpio_init();
    spi_gpio_init();
//os_printf sur Uart0
 espconn_init() ;
    uart0_tx_buffer("init\n", 5);
    config.bssid_set = 1;
    os_memcpy( &config.ssid, SSID, 14 );
    os_memcpy( &config.password, PASSWORD, 41);
    wifi_station_set_config( &config );
    wifi_station_connect();
   // wifi_set_event_handler_cb( wifi_callback );
   shell_init();
//Démarage du client UDP
   user_set_station_config_udp();

   MessageUDP.Status = E_ID;
 MessageSPi.Status = E_ID;
    system_os_task(all_recvTask,PRIO_SPI,  all_recvTaskQueue, TASK_LENGHT);  ///demo with a task to process the uart data
    system_os_task(uart_recvTask,PRIO_UART,  uart_recvTaskQueue, TASK_LENGHT); // //demo with a task to process the spi 


}
Exemple #19
0
int main(void)
{
    puts("IETF90 - BnB - UDP server");

    if (msg_init_queue(msg_buffer_shell, SHELL_MSG_BUFFER_SIZE) != 0) {
        DEBUG("msg init queue failed...abording\n");
        return -1;
    }
    
    /* fill neighbor cache */
    fill_nc();

    id = 1;
    helper_ignore(3);
    rpl_ex_init('r');
    udp_server(1, NULL);
    posix_open(uart0_handler_pid, 0);
    net_if_set_src_address_mode(0, NET_IF_TRANS_ADDR_M_SHORT);
    shell_init(&shell, sc, UART0_BUFSIZE, uart0_readc, uart0_putc);
    shell_run(&shell);

    return 0;
}
Exemple #20
0
int main(void)
{
    shell_t shell;
    kernel_pid_t radio;

    /* initialize the radio */
    radio = comm_init();
    if (radio == KERNEL_PID_UNDEF) {
        puts("ERROR initializing the radio, aborting");
        return 1;
    }

    /* initialize the sensing module */
    sense_init(radio);

    /* run the shell */
    (void) posix_open(uart0_handler_pid, 0);
    shell_init(&shell, _commands, SHELL_BUFSIZE, _readc, _putc);
    shell_run(&shell);

    /* never reached */
    return 0;
}
Exemple #21
0
int main()
{
#ifdef EMULATION
	emu_init();
#endif
	irq_setmask(0);
	irq_enable(1);
	uart_async_init();
	banner();
	brd_init();
	cpustats_init();
	time_init();
	mem_init();
	vga_init();
	snd_init();
	pfpu_init();
	tmu_init();
	renderer_init();
	apipe_init();
	rpipe_init();
	slowout_init();
	hdlcd_init();
	ui_init();
	shell_init();
	
	while(1) {
		if(readchar_nonblock())
			shell_input(readchar());
		apipe_service();
		rpipe_service();
#ifdef EMULATION
		emu_service();
#endif
	}
	
	return 0;
}
Exemple #22
0
int main (int argc, char *argv[]) {

    char cmd[256];
    int ret;

    ret = shell_init() ;

    if (ret < 0) {
        return -1;
    }

    while (printf("$ "), fgets (cmd, 256, stdin) != NULL) {
        ret = create_job (cmd);
        if (IS_SYNTAX_ERROR (ret)) {
            puts ("Syntax Error!");
        }
        else if (IS_CMD_LINE_OK (ret))
            run_fg_job();
    }



    return EXIT_SUCCESS;
}
Exemple #23
0
int main(void)
{

    printf("test_shell.\n");

    board_uart0_init();

    posix_open(uart0_handler_pid, 0);

    /* define own shell commands */
    shell_t shell;
    shell_init(&shell, shell_commands, SHELL_BUFSIZE, shell_readc,
               shell_putchar);
    shell_run(&shell);

    /* or use only system shell commands */
    /*
    shell_t sys_shell;
    shell_init(&sys_shell, NULL, SHELL_BUFSIZE, shell_readc, shell_putchar);
    shell_run(&sys_shell);
    */

    return 0;
}
Exemple #24
0
int main( void )
{
  // Initialize platform first
  if( platform_init() != PLATFORM_OK )
  {
    // This should never happen
    while( 1 );
  }
    
  // Initialize device manager
  dm_init();
  
  // Register the ROM filesystem
  dm_register( romfs_init() );  
  
  // Initialize XMODEM
  xmodem_init( xmodem_send, xmodem_recv );    
  
  // Initialize terminal
  term_init( TERMINAL_LINES, TERMINAL_COLS, term_out, term_in, term_translate );
  
  printf( ".text ends at %p, first free RAM is at %p, last free ram is at %p\r\n", etext, platform_get_first_free_ram(), platform_get_last_free_ram() );
  
  // Run the shell
  if( shell_init( XMODEM_MAX_FILE_SIZE ) == 0 )
  {
    printf( "Unable to initialize the eLua shell!\n" );
    // Start Lua directly
    char* lua_argv[] = { "lua", NULL };
    lua_main( 1, lua_argv );
  }
  else
    shell_start();

  while( 1 );
}
Exemple #25
0
int shell(void)
{
	shell_init();

	while (1) {
		int argc;
		char *argv[MAX_ARGC];
		char line[MAX_ARG_LEN];

		command_read_line(line);

		argc = command_translate(line, argv);
		if (argc < 0) {
			printf("Invalid command line: \"%s\"\n", line);
			continue;
		}

		exec(argc, argv);

		putchar('\n');
	}

	return 0;
}
Exemple #26
0
void shell_runner(void) {
    shell_init(&shell, sc, UART0_BUFSIZE, uart0_readc, uart0_putc);
    posix_open(uart0_handler_pid, 0);
    shell_run(&shell);
}
Exemple #27
0
int main(int argc, char **argv)
{
    GSList *modules;

    DEBUG("HardInfo version " VERSION ". Debug version.");

    DEBUG("g_thread_init()");
    if (!g_thread_supported())
	g_thread_init(NULL);

    /* parse all command line parameters */
    parameters_init(&argc, &argv, &params);

    /* show version information and quit */
    if (params.show_version) {
	g_print("HardInfo version " VERSION "\n");
	g_print
	    ("Copyright (C) 2003-2009 Leandro A. F. Pereira. See COPYING for details.\n\n");

	g_print("Compile-time options:\n"
		"  Release version:   %s (%s)\n"
		"  BinReloc enabled:  %s\n"
		"  Data prefix:       %s\n"
		"  Library prefix:    %s\n"
		"  Compiled on:       %s %s (%s)\n",
		RELEASE ? "Yes" : "No (" VERSION ")", ARCH,
		ENABLE_BINRELOC ? "Yes" : "No",
		PREFIX, LIBPREFIX, PLATFORM, KERNEL, HOSTNAME);

	DEBUG("  Debugging is enabled.");

	/* show also available modules */
	params.list_modules = TRUE;
    }

    /* initialize the binreloc library, so we can load program data */
    if (!binreloc_init(FALSE))
	g_error("Failed to find runtime data.\n\n"
		"\342\200\242 Is HardInfo correctly installed?\n"
		"\342\200\242 See if %s and %s exists and you have read permision.",
		PREFIX, LIBPREFIX);

    /* list all module names */
    if (params.list_modules) {
	g_print("Modules:\n"
		"%-20s%-15s%-12s\n", "File Name", "Name", "Version");

	for (modules = modules_load_all(); modules;
	     modules = modules->next) {
	    ShellModule *module = (ShellModule *) modules->data;
	    ModuleAbout *ma = module_get_about(module);
	    gchar *name = g_path_get_basename(g_module_name(module->dll));

	    g_print("%-20s%-15s%-12s\n", name, module->name, ma->version);

	    g_free(name);
	}

	return 0;
    }

    if (!params.create_report && !params.run_benchmark && !params.run_xmlrpc_server) {
	/* we only try to open the UI if the user didn't asked for a 
	   report. */
	params.gui_running = ui_init(&argc, &argv);

	/* as a fallback, if GTK+ initialization failed, run in report
	   generation mode. */
	if (!params.gui_running)
	    params.create_report = TRUE;
    }

    if (params.use_modules) {
	/* load only selected modules */
	DEBUG("loading user-selected modules");
	modules = modules_load_selected();
    } else {
	/* load all modules */
	DEBUG("loading all modules");
	modules = modules_load_all();
    }

    /* initialize vendor database */
    vendor_init();
    
    if (params.run_xmlrpc_server) {
        g_type_init();
    
        xmlrpc_server_init();
        xmlrpc_server_start();
    } else if (params.run_benchmark) {
        gchar *result;
        
        result = module_call_method_param("benchmark::runBenchmark", params.run_benchmark);
        if (!result) {
          g_error("Unknown benchmark ``%s'' or benchmark.so not loaded", params.run_benchmark);
        } else {
          g_print("Benchmark result: %s\n", result);
          g_free(result);
        }
    } else if (params.gui_running) {
	/* initialize gui and start gtk+ main loop */
	icon_cache_init();
	stock_icons_init();

	shell_init(modules);

	DEBUG("entering gtk+ main loop");

	gtk_main();
    } else if (params.create_report) {
	/* generate report */
	gchar *report;

	DEBUG("generating report");

	report = report_create_from_module_list_format(modules,
						       params.
						       report_format);
	g_print("%s", report);

	g_free(report);
    } else {
        g_error("Don't know what to do. Exiting.");
    }

    DEBUG("finished");
    return 0;
}
Exemple #28
0
void module_shell_init()
{
    shell_init();
}
Exemple #29
0
int main(int argc, char *argv[]){
  shell_init();
  return EXIT_SUCCESS;
}
Exemple #30
0
static void
init_netifs(void)
{
#if PPP_SUPPORT
  pppInit();
#if PPP_PTY_TEST
  ppp_sio = sio_open(2);
#else
  ppp_sio = sio_open(0);
#endif
  if(!ppp_sio)
  {
      perror("Error opening device: ");
      exit(1);
  }

#ifdef LWIP_PPP_CHAP_TEST
  pppSetAuth(PPPAUTHTYPE_CHAP, "lwip", "mysecret");
#endif

  pppOpen(ppp_sio, pppLinkStatusCallback, NULL);
#endif /* PPP_SUPPORT */
  
#if LWIP_DHCP
  {
    IP4_ADDR(&gw, 0,0,0,0);
    IP4_ADDR(&ipaddr, 0,0,0,0);
    IP4_ADDR(&netmask, 0,0,0,0);

    netif_add(&netif, &ipaddr, &netmask, &gw, NULL, tapif_init,
              tcpip_input);
    netif_set_default(&netif);
    dhcp_start(&netif);
  }
#else
  
  netif_set_default(netif_add(&netif,&ipaddr, &netmask, &gw, NULL, tapif_init,
                  tcpip_input));
  netif_set_up(&netif);

#endif
#if LWIP_IPV6
  netif_create_ip6_linklocal_address(&netif, 1);
#endif

#if 0
  /* Only used for testing purposes: */
  netif_add(&ipaddr, &netmask, &gw, NULL, pcapif_init, tcpip_input);
#endif
  
#if LWIP_TCP  
  tcpecho_init();
  shell_init();
  my_http_server_netconn_init();
  //  httpd_init();
#endif
#if LWIP_UDP  
  udpecho_init();
#endif  
  /*  sys_timeout(5000, tcp_debug_timeout, NULL);*/
}