Пример #1
0
void board_boot_order(u32 *spl_boot_list)
{
	/* Default boot sequence SPI -> MMC */
	spl_boot_list[0] = spl_boot_device();
	spl_boot_list[1] = BOOT_DEVICE_MMC1;
	spl_boot_list[2] = BOOT_DEVICE_UART;
	spl_boot_list[3] = BOOT_DEVICE_NONE;

	/*
	 * In case of emergency PAD pressed, we always boot
	 * to proper u-boot and perform recovery tasks there.
	 */
	if (board_check_emergency_pad())
		return;

#ifdef CONFIG_SPL_ENV_SUPPORT
	/* 'fastboot' */
	const char *s;

	if (env_init() || env_load())
		return;

	s = env_get("BOOT_FROM");
	if (s && !bootcount_error() && strcmp(s, "ACTIVE") == 0) {
		spl_boot_list[0] = BOOT_DEVICE_MMC1;
		spl_boot_list[1] = spl_boot_device();
	}
#endif
}
Пример #2
0
void __attribute__((noreturn)) mainloop (void)
{
  prvSetupHardware ();
  vLedInit ();

  /* If no previous environment exists - create a new, but don't store it */
  env_init ();
  if(!env_load ()) {
    debug_printf ("unable to load environment, resetting to defaults\n");
    bzero (&env, sizeof (env));
  }

  if (env.e.n_lamps > MAX_LAMPS)
    env.e.n_lamps = 0;

  vRndInit ((((u_int32_t) env.e.mac_h) << 8) | env.e.mac_l);
  vNetworkInit ();

  xTaskCreate (vUSBCDCTask, (signed portCHAR *) "USB", TASK_USB_STACK,
	       NULL, TASK_USB_PRIORITY, NULL);

  PtInitProtocol ();
  vUSBShellInit ();
  vTaskStartScheduler ();

  while(1);
}
void ob_init( unsigned char power, unsigned char rate, unsigned char channel, unsigned char* nid ) {
	char i;
	ob_int_mgmt.Mode 			= 0;
	ob_int_mgmt.Pipes			= 0;

    /* Inititalize nRF24L01 */
    if(!nRFAPI_Init(DEFAULT_CHANNEL, nid, NETID_SIZE ))
    	HaltBlinking();

    ob_setNetID( nid );
    ob_setRate( rate );
    ob_setPower( power );
    ob_setChannel( channel );
    nRFAPI_SetPipeSizeRX(0, sizeof(ob_data) );
    ob_switchRXMode();
    nRFLL_CE(1);

    /* initialize environment variables */
    env_init();
    if(!env_load())
    {
    	env.e.speed=2;
    	env.e.mode=4;
    	env.e.tag_id=666;
    	env_store();
    }

    /* Statistik */
    for(i=0; i<4; i++) {
    	ob_int_mgmt.rx_beacons[i] 		= 0;
    	ob_int_mgmt.fail_rx_beacons[i] 	= 0;
    	ob_int_mgmt.tx_beacons[i] 		= 0;
    	ob_int_mgmt.fail_tx_beacons[i] 	= 0;
    }

	#ifdef OPENBEACON_STATS_AUTO_SEND_TIME
		ob_int_mgmt.stat_time 		= xTaskGetTickCount()+OPENBEACON_STATS_AUTO_SEND_TIME/2;
	#else
		ob_int_mgmt.stat_time 		= xTaskGetTickCount()+1000/2;
	#endif

	#ifdef OPENBEACON_TEST_AUTO_SEND
		#ifdef OPENBEACON_TEST_AUTO_SEND_TIME
			ob_int_mgmt.test_hw_diff=OPENBEACON_TEST_AUTO_SEND_TIME;
		#else
			ob_int_mgmt.test_hw_diff=1000;
		#endif
	#endif
}
Пример #4
0
int spl_start_uboot(void)
{
	/* break into full u-boot on 'c' */
	if (serial_tstc() && serial_getc() == 'c')
		return 1;

#ifdef CONFIG_SPL_ENV_SUPPORT
	env_init();
	env_load();
	if (env_get_yesno("boot_os") != 1)
		return 1;
#endif

	return 0;
}
Пример #5
0
void env_relocate(void)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
	env_reloc();
	env_htab.change_ok += gd->reloc_off;
#endif
	if (gd->env_valid == ENV_INVALID) {
#if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)
		/* Environment not changable */
		set_default_env(NULL);
#else
		bootstage_error(BOOTSTAGE_ID_NET_CHECKSUM);
		set_default_env("!bad CRC");
#endif
	} else {
		env_load();
	}
}
Пример #6
0
static inline void prvSetupHardware (void)
{
    /*	When using the JTAG debugger the hardware is not always initialised to
	the correct default state.  This line just ensures that this does not
	cause all interrupts to be masked at the start. */
    AT91C_BASE_AIC->AIC_EOICR = 0;

    /*	Enable the peripheral clock. */
    AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_PIOA;
    AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_PIOB;    

    /* initialize environment variables */
    AT91F_DBGU_Init();
    env_init();
    if(!env_load())
    {
	env.e.mode=0;
	env.e.reader_id=1;
	env_store();
    }
}
Пример #7
0
static inline void
prvSetupHardware (void)
{
  /*  When using the JTAG debugger the hardware is not always initialised to
     the correct default state.  This line just ensures that this does not
     cause all interrupts to be masked at the start. */
  AT91C_BASE_AIC->AIC_EOICR = 0;

  /*  Enable the peripheral clock. */
  AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_PIOA) | (1 << AT91C_ID_PIOB);

  /*  Init LEDs */
  vLedInit ();

  /* If no previous environment exists - create a new, but don't store it */
  env_init ();
  if (!env_load ()) {
    vResetEnv();
  }

}
Пример #8
0
int			main(int ac, char **av)
{
  t_core		core;
  struct termios	term;
  int			ret;

  init_core(&core, &term);
  if ((core.env = env_load()) == NULL)
    my_puterr(ERR_ENV);
  core.prompt = get_prompt(&core);
  init_term(&core, ac, av);
  core_config_file(&core);
  if (core.is_tcaps)
    enable_row_mode(core.term);
  if (core.is_tcaps && !(ret = core_run_termcap(&core)))
    return (ret);
  if (!core.is_tcaps && !(ret = core_run_no_termcap(&core)))
    return (ret);
  if (core.shutdown != ERR_SD_PIPE && core.is_tcaps)
    disable_row_mode(core.term);
  core_free(&core);
  return (core.shutdown == 1 ? 0 : core.shutdown);
}