コード例 #1
0
ファイル: main.c プロジェクト: BackupTheBerlios/elua-svn
// ****************************************************************************
//  Program entry point
int main (void)
{
  // Initialize platform first
  if( platform_init() != PLATFORM_OK )
  {
    // This should never happen
    while( 1 );
  }
    
  // Initialize device manager
  dm_init();
  
  // And register the ROM filesystem
  dm_register( fs_init() );  
  
  // Initialize XMODEM
  xmodem_init( xmodem_send, xmodem_recv );    
  
  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 shell!\n" );
  else
    shell_start();
    
  while( 1 );
}
コード例 #2
0
ファイル: telnetd.c プロジェクト: EDAyele/ptunes
/*---------------------------------------------------------------------------*/
void
telnetd_appcall(void *ts)
{
  if(uip_connected()) {
    tcp_markconn(uip_conn, &s);
    buf_init(&buf);
    s.bufptr = 0;
    s.state = STATE_NORMAL;
    shell_start();
  }

  if(s.state == STATE_CLOSE) {
    s.state = STATE_NORMAL;
    uip_close();
    return;
  }
  if(uip_closed() ||
     uip_aborted() ||
     uip_timedout()) {
    closed();
  }
  if(uip_acked()) {
    acked();
  }
  if(uip_newdata()) {
    newdata();
  }
  if(uip_rexmit() ||
     uip_newdata() ||
     uip_acked() ||
     uip_connected() ||
     uip_poll()) {
    senddata();
  }
}
コード例 #3
0
ファイル: shell.c プロジェクト: uoaerg/wise
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_process, ev, data)
{
  static struct process *started_process;
  struct shell_input *input;
  int ret;
  PROCESS_BEGIN();

  /* Let the system start up before showing the prompt. */
  PROCESS_PAUSE();
 
  shell_start();
 
  while(1) {
    
    PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
    {
      input = data;
      ret = shell_start_command(input->data1, input->len1, NULL,
				&started_process);

      if(started_process != NULL &&
	 ret == SHELL_FOREGROUND &&
	 process_is_running(started_process)) {
	front_process = started_process;
	PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXITED &&
				 data == started_process);
      }
      front_process = &shell_process;
    }
    shell_prompt(shell_prompt_text);
  }
  
  PROCESS_END();
}
コード例 #4
0
ファイル: main.c プロジェクト: SteveMaddison/focus
void main( void )
{
	errno = 0;

	intr_disable();
	intr_init();
	hw_init();

	/* print a banner */
	printf( "%s %s\n", os_name, os_version );

	memory_init();
	device_init();
	vfs_init();

	/* new line after all initialisation messages */
	printf("\n");

	kb_init();
    console_init();

    intr_enable();

	/* fire up the shell! */
	for(;;) {
		shell_start();
		printf("Respawning shell\n");
	}
}
コード例 #5
0
ファイル: main.cpp プロジェクト: smeenka/scmRTOS
 OS_PROCESS void TProcShell::exec()
 {
     for(;;) {
         scmprintf("Starting shell on channel 0: \n","");
     	shell_start();
         LED1::Cpl();
     }
 }
コード例 #6
0
ファイル: main.c プロジェクト: zebMcCorkle/bluebox
void kernel_main(uint32_t r0 __attribute__((unused)), uint32_t r1 __attribute__((unused)), uint32_t atags __attribute__((unused))) {
  uart_init();

  shell_start();

  while (true)
    uart_putc(uart_getc());
}
コード例 #7
0
ファイル: shell_test.c プロジェクト: ryochack/emkit
TEST(shell, destroy)
{
	s_handle = shell_create(s_pool, POOL_SIZE,
			stub_putc, stub_getc, stub_exec, NULL);
	TEST_ASSERT_NOT_NULL( s_handle );
	TEST_ASSERT_UNLESS( shell_destroy(s_handle) );
	TEST_ASSERT( shell_start(s_handle) );
}
コード例 #8
0
ファイル: telnetd.c プロジェクト: Abdellazizhammami/contiki
/*---------------------------------------------------------------------------*/
void
telnetd_appcall(void *ts)
{
  if(uip_connected()) {
    if(!connected) {
      buf_init(&buf);
      s.bufptr = 0;
      s.state = STATE_NORMAL;
      connected = 1;
      shell_start();
      timer_set(&s.silence_timer, MAX_SILENCE_TIME);
      ts = (char *)0;
    } else {
      uip_send(telnetd_reject_text, strlen(telnetd_reject_text));
      ts = (char *)1;
    }
    tcp_markconn(uip_conn, ts);
  }

  if(!ts) {
    if(s.state == STATE_CLOSE) {
      s.state = STATE_NORMAL;
      uip_close();
      return;
    }
    if(uip_closed() ||
       uip_aborted() ||
       uip_timedout()) {
      shell_stop();
      connected = 0;
    }
    if(uip_acked()) {
      timer_set(&s.silence_timer, MAX_SILENCE_TIME);
      acked();
    }
    if(uip_newdata()) {
      timer_set(&s.silence_timer, MAX_SILENCE_TIME);
      newdata();
    }
    if(uip_rexmit() ||
       uip_newdata() ||
       uip_acked() ||
       uip_connected() ||
       uip_poll()) {
      senddata();
      if(s.numsent > 0) {
	timer_set(&s.silence_timer, MAX_SILENCE_TIME);
      }
    }
    if(uip_poll()) {
      if(timer_expired(&s.silence_timer)) {
        uip_close();
        tcp_markconn(uip_conn, NULL);
      }
    }
  }
}
コード例 #9
0
ファイル: main.c プロジェクト: BackupTheBerlios/elua-svn
int main( void )
{
  FILE* fp;

  // 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() );

  // Register the MMC filesystem
  dm_register( mmcfs_init() );

  // Register the remote filesystem
  dm_register( remotefs_init() );

  // Autorun: if "autorun.lua" is found in the file system, run it first
  if( ( fp = fopen( FS_AUTORUN, "r" ) ) != NULL )
  {
    fclose( fp );
    char* lua_argv[] = { "lua", FS_AUTORUN, NULL };
    lua_main( 2, lua_argv );
  }
  
#ifdef ELUA_BOOT_RPC
  boot_rpc();
#else
  
  // Run the shell
  if( shell_init() == 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();
#endif // #ifdef ELUA_BOOT_RPC

#ifdef ELUA_SIMULATOR
  hostif_exit(0);
  return 0;
#else
  while( 1 );
#endif
}
コード例 #10
0
ファイル: main.c プロジェクト: fjrti/remix
int main( void )
{
    int i;
    FILE* fp;

    // 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() );

    // Register the MMC filesystem
    dm_register( mmcfs_init() );

    // Register the Semihosting filesystem
    dm_register( semifs_init() );

    // Search for autorun files in the defined order and execute the 1st if found
    for( i = 0; i < sizeof( boot_order ) / sizeof( *boot_order ); i++ )
    {
        if( ( fp = fopen( boot_order[ i ], "r" ) ) != NULL )
        {
            fclose( fp );
            char* picoc_argv[] = { "picoc", boot_order[i], NULL };
            picoc_main( 2, picoc_argv );
            break; // autoruns only the first found
        }
    }

    // Run the shell
    if( shell_init() == 0 )
    {
        // Start picoc directly
        char* picoc_argv[] = { "picoc", NULL };
        picoc_main( 1, picoc_argv );
    }
    else
        shell_start();

    while( 1 );
}
コード例 #11
0
ファイル: main.c プロジェクト: mounikamunipalli/hempl
int main( void )
{
  int i;
  FILE* fp;

  // Initialize platform first
  if( platform_init() != PLATFORM_OK )
  {
    // This should never happen
    while( 1 );
  }

  // Initialize device manager
  dm_init();

  // Register the ROM filesystem
  romfs_init();

  // Register the MMC filesystem
  mmcfs_init();

  // Search for autorun files in the defined order and execute the 1st if found
  for( i = 0; i < sizeof( boot_order ) / sizeof( *boot_order ); i++ )
  {
    if( ( fp = fopen( boot_order[ i ], "r" ) ) != NULL )
    {
      fclose( fp );
      // The entry point for PicoLisp.
      char* picolisp_argv[] = { "picolisp", boot_order[i], NULL };

      picolisp_main( 2, picolisp_argv );
      break; // autoruns only the first found
    }
  }
  
  // Run the shell
  if( shell_init() == 0 )
  {
    char* picolisp_argv[] = { "picolisp", NULL };
    picolisp_main( 1, picolisp_argv );
  }
  else
  {
    shell_start();
  }

  while( 1 );
}
コード例 #12
0
ファイル: main.c プロジェクト: BackupTheBerlios/elua-svn
int main( void )
{
    FILE* fp;

    // 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() );

#ifdef BUILD_XMODEM
    // Initialize XMODEM
    xmodem_init( xmodem_send, xmodem_recv );
#endif

#ifdef BUILD_TERM
    // Initialize terminal
    term_init( TERM_LINES, TERM_COLS, term_out, term_in, term_translate );
#endif

    // Autorun: if "autorun.lua" is found in the ROM file system, run it first
    if( ( fp = fopen( "/rom/autorun.lua", "r" ) ) != NULL )
    {
        fclose( fp );
        char* lua_argv[] = { "lua", "/rom/autorun.lua", NULL };
        lua_main( 2, lua_argv );
    }

    // Run the shell
    if( shell_init() == 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 );
}
コード例 #13
0
/*---------------------------------------------------------------------------*/
void
telnetd_appcall(void)
{
  static unsigned int i;
  if(uip_connected()) {
    /*    tcp_markconn(uip_conn, &s);*/
    for(i = 0; i < TELNETD_CONF_NUMLINES; ++i) {
      s.lines[i] = NULL;
    }
    s.bufptr = 0;
    s.state = STATE_NORMAL;

    shell_start();
  }

  if(s.state == STATE_CLOSE) {
    s.state = STATE_NORMAL;
    uip_close();
    return;
  }
  
  if(uip_closed() ||
     uip_aborted() ||
     uip_timedout()) {
    closed();
  }
  
  if(uip_acked()) {
    acked();
  }
  
  if(uip_newdata()) {
    newdata();
  }
  
  if(uip_rexmit() ||
     uip_newdata() ||
     uip_acked() ||
     uip_connected() ||
     uip_poll()) {
    senddata();
  }
}
コード例 #14
0
ファイル: main.c プロジェクト: ryochack/lpc812_usbgpio
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 ;
}
コード例 #15
0
ファイル: main.c プロジェクト: BackupTheBerlios/elua-svn
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 );
}
コード例 #16
0
ファイル: shell_app.c プロジェクト: ryochack/emkit
int main(int argc, char **argv) {
	handle_t sh_hdl;

	command_init(myputc);
	sh_hdl = shell_create(shell_work_memory, sizeof(shell_work_memory),
			myputc, mygetc, myexecute, myhook);
	if (!sh_hdl) {
		fprintf(stderr, "Shell Handle is NULL!\n");
		return -1;
	}
	cmd_hdl = command_create(command_work_memory, sizeof(command_work_memory));
	if (!cmd_hdl) {
		fprintf(stderr, "Command Handle is NULL!\n");
		return -1;
	}

	command_add(cmd_hdl, "hello", cmd_hello, NULL);
	command_add(cmd_hdl, "goodbye", cmd_goodbye, NULL);

	shell_start(sh_hdl);

	return 0;
}
コード例 #17
0
ファイル: main.c プロジェクト: BackupTheBerlios/elua-svn
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 );
}
コード例 #18
0
ファイル: init.c プロジェクト: Sambeet161616/examples-v2
rtems_task Init(
  rtems_task_argument ignored
)
{
  int ret;

  puts( "\n\n*** ramdisk/fat example ***" );

  printf("Unpacking tar filesystem\nThis may take awhile...\n");
  if(Untar_FromMemory((char*) FilesystemImage, FilesystemImage_size) != 0) {
    printf("Can't unpack tar filesystem\n");
    exit(1);
  }

  ret = setup_ramdisk ("/mnt/ramdisk");
  if (ret)
    exit (ret);

  shell_init_script();
  shell_start();

  printf( "*** end of demonstration ***\n" );
  exit( 0 );
}
コード例 #19
0
ファイル: shell_test.c プロジェクト: ryochack/emkit
static void* thread_shell(void* args)
{
	TEST_ASSERT_UNLESS( shell_start(s_handle) );
	return NULL;
}
コード例 #20
0
ファイル: main.c プロジェクト: ramangopalan/elua
int main( void )
{
  int i;
  FILE* fp;

  // Initialize platform first
  if( platform_init() != PLATFORM_OK )
  {
    // This should never happen
    while( 1 );
  }

  // Initialize device manager
  dm_init();

  // Register the ROM filesystem
  romfs_init();

  // Register the MMC filesystem
  mmcfs_init();

  // Register the Semihosting filesystem
  semifs_init();

  // Register the remote filesystem
  remotefs_init();

  // Register NIFFS
  nffs_init();

  // Search for autorun files in the defined order and execute the 1st if found
  for( i = 0; i < sizeof( boot_order ) / sizeof( *boot_order ); i++ )
  {
    if( ( fp = fopen( boot_order[ i ], "r" ) ) != NULL )
    {
      fclose( fp );
      char* lua_argv[] = { (char *)"lua", (char *)boot_order[i], NULL };
      lua_main( 2, lua_argv );
      break; // autoruns only the first found
    }
  }

#ifdef ELUA_BOOT_RPC
  boot_rpc();
#else
  
  // Run the shell
  if( shell_init() == 0 )
  {
    // Start Lua directly
    char* lua_argv[] = { (char *)"lua", NULL };
    lua_main( 1, lua_argv );
  }
  else
    shell_start();
#endif // #ifdef ELUA_BOOT_RPC

#ifdef ELUA_SIMULATOR
  hostif_exit(0);
  return 0;
#else
  while( 1 );
#endif
}