Ejemplo n.º 1
0
/****************************************************************************
 * Name: board_initialize
 *
 * Description:
 *   If CONFIG_BOARD_INITIALIZE is selected, then an additional
 *   initialization call will be performed in the boot-up sequence to a
 *   function called board_initialize().  board_initialize() will be
 *   called immediately after up_initialize() is called and just before the
 *   initial application is started.  This additional initialization phase
 *   may be used, for example, to initialize board-specific device drivers.
 *
 ****************************************************************************/
void board_initialize(void)
{
	artik05x_clear_bootcount();

	/* Perform app-specific initialization here instaed of from the TASH. */
	board_app_initialize();

#ifdef CONFIG_SCSC_WLAN
	slsi_driver_initialize();
#endif

#ifdef CONFIG_S5J_PWM
	board_pwm_setup();
#endif

	board_gpio_initialize();
	board_i2c_initialize();
	board_audio_initialize();
	board_sensor_initialize();
	board_wdt_initialize();

#ifdef CONFIG_S5J_SSS
	/* verify ARTIK Key */
	sssro_verify();
#endif
}
Ejemplo n.º 2
0
int usbmsc_archinitialize(void)
{
#if defined(CONFIG_LIB_BOARDCTL)
  return OK;
#else
  return board_app_initialize();
#endif
}
Ejemplo n.º 3
0
void board_initialize(void)
{
  /* Perform NSH initialization here instead of from the NSH.  This
   * alternative NSH initialization is necessary when NSH is ran in user-space
   * but the initialization function must run in kernel space.
   */

#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_NSH_ARCHINIT)
  (void)board_app_initialize();
#endif
}
Ejemplo n.º 4
0
int uavcannode_start(int argc, char *argv[])
{
	resources("Before board_app_initialize");

	board_app_initialize(NULL);

	resources("After board_app_initialize");

	// CAN bitrate
	int32_t bitrate = 0;
	// Node ID
	int32_t node_id = 0;

	// Did the bootloader auto baud and get a node ID Allocated

	bootloader_app_shared_t shared;
	int valid  = bootloader_app_shared_read(&shared, BootLoader);

	if (valid == 0) {

		bitrate = shared.bus_speed;
		node_id = shared.node_id;

		// Invalidate to prevent deja vu

		bootloader_app_shared_invalidate();

	} else {

		// Node ID
		(void)param_get(param_find("CANNODE_NODE_ID"), &node_id);
		(void)param_get(param_find("CANNODE_BITRATE"), &bitrate);
	}

	if (node_id < 0 || node_id > uavcan::NodeID::Max || !uavcan::NodeID(node_id).isUnicast()) {
		warnx("Invalid Node ID %i", node_id);
		::exit(1);
	}

	// Start
	warnx("Node ID %u, bitrate %u", node_id, bitrate);
	int rv = UavcanNode::start(node_id, bitrate);
	resources("After UavcanNode::start");
	::sleep(1);
	return rv;
}
Ejemplo n.º 5
0
void board_initialize(void)
{
  /* Perform NSH initialization here instead of from the NSH.  This
   * alternative NSH initialization is necessary when NSH is ran in user-space
   * but the initialization function must run in kernel space.
   */

#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_LIB_BOARDCTL)
  board_app_initialize();
#endif

  /* CC3000 wireless initialization */

#ifdef CONFIG_WL_CC3000
  wireless_archinitialize(0);
#endif
}
Ejemplo n.º 6
0
static int board_initthread(int argc, char *argv[])
{
  int ret;

  /* Perform NSH initialization here instead of from the NSH.  This
   * alternative NSH initialization is necessary when NSH is ran in user-space
   * but the initialization function must run in kernel space.
   */

#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_NSH_ARCHINIT)
  ret = board_app_initialize();
  if (ret < 0)
    {
      gdbg("ERROR: board_app_initialize failed: %d\n", ret);
    }
#endif

  /* Initialize the NX server */

#ifdef HAVE_NXSTART
  ret = nx_start();
  if (ret < 0)
    {
      gdbg("ERROR: nx_start failed: %d\n", ret);
    }
#endif

  /* Initialize the touchscreen */

#ifdef HAVE_TCINIT
  ret = board_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO);
  if (ret < 0)
    {
      gdbg("ERROR: board_tsc_setup failed: %d\n", ret);
    }
#endif

  return EXIT_SUCCESS;
}
Ejemplo n.º 7
0
static int uavcannode_start()
{
        board_app_initialize();

	// CAN bitrate
	int32_t bitrate = 0;
	// Node ID
	int32_t node_id = 0;

	// Did the bootloader auto baud and get a node ID Allocated

	bootloader_app_shared_t shared;
	int valid  = bootloader_app_shared_read(&shared, BootLoader);

	if (valid == 0) {

		bitrate = shared.bus_speed;
		node_id = shared.node_id;

		// Invalidate to prevent deja vu

		bootloader_app_shared_invalidate();

	} else {
TODO(Need non vol Paramter sotrage)
		// Node ID
		node_id = 123;
		bitrate = 1000000;
	}

	if (node_id < 0 || node_id > uavcan::NodeID::Max || !uavcan::NodeID(node_id).isUnicast()) {
		PX4_INFO("Invalid Node ID %li", node_id);
		return 1;
	}

	// Start
	PX4_INFO("Node ID %lu, bitrate %lu", node_id, bitrate);
	return UavcanNode::start(node_id, bitrate);
}
Ejemplo n.º 8
0
int board_usbmsc_initialize(int port)
{
  return board_app_initialize();
}
Ejemplo n.º 9
0
int boardctl(unsigned int cmd, uintptr_t arg)
{
  int ret;

  switch (cmd)
    {
      /* CMD:           BOARDIOC_INIT
       * DESCRIPTION:   Perform one-time application initialization.
       * ARG:           None
       * CONFIGURATION: CONFIG_LIB_BOARDCTL
       * DEPENDENCIES:  Board logic must provide board_app_initialization
       */

      case BOARDIOC_INIT:
        {
          ret = board_app_initialize();
        }
        break;

#ifdef CONFIG_BOARDCTL_POWEROFF
      /* CMD:           BOARDIOC_POWEROFF
       * DESCRIPTION:   Power off the board
       * ARG:           Integer value providing power off status information
       * CONFIGURATION: CONFIG_BOARDCTL_POWEROFF
       * DEPENDENCIES:  Board logic must provide board_power_off
       */

      case BOARDIOC_POWEROFF:
        {
          ret = board_power_off((int)arg);
        }
        break;
#endif

#ifdef CONFIG_BOARDCTL_RESET
      /* CMD:           BOARDIOC_RESET
       * DESCRIPTION:   Reset the board
       * ARG:           Integer value providing power off status information
       * CONFIGURATION: CONFIG_BOARDCTL_RESET
       * DEPENDENCIES:  Board logic must provide board_reset
       */

      case BOARDIOC_RESET:
        {
          ret = board_reset((int)arg);
        }
        break;
#endif

#ifdef CONFIG_BOARDCTL_TSCTEST
      /* CMD:           BOARDIOC_TSCTEST_SETUP
       * DESCRIPTION:   Touchscreen controller test configuration
       * ARG:           Touch controller device minor number
       * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST
       * DEPENDENCIES:  Board logic must provide board_tsc_setup()
       */

      case BOARDIOC_TSCTEST_SETUP:
        {
          ret = board_tsc_setup((int)arg);
        }
        break;

      /* CMD:           BOARDIOC_TSCTEST_TEARDOWN
       * DESCRIPTION:   Touchscreen controller test configuration
       * ARG:           None
       * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST
       * DEPENDENCIES:  Board logic must provide board_tsc_teardown()
       */

      case BOARDIOC_TSCTEST_TEARDOWN:
        {
          board_tsc_teardown();
          ret = OK;
        }
        break;
#endif

#ifdef CONFIG_BOARDCTL_ADCTEST
      /* CMD:           BOARDIOC_ADCTEST_SETUP
       * DESCRIPTION:   ADC controller test configuration
       * ARG:           None
       * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_ADCTEST
       * DEPENDENCIES:  Board logic must provide board_adc_setup()
       */

      case BOARDIOC_ADCTEST_SETUP:
        {
          ret = board_adc_setup();
        }
        break;
#endif

#ifdef CONFIG_BOARDCTL_PWMTEST
      /* CMD:           BOARDIOC_PWMTEST_SETUP
       * DESCRIPTION:   PWM controller test configuration
       * ARG:           None
       * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_PWMTEST
       * DEPENDENCIES:  Board logic must provide board_pwm_setup()
       */

      case BOARDIOC_PWMTEST_SETUP:
        {
          ret = board_pwm_setup();
        }
        break;
#endif

#ifdef CONFIG_BOARDCTL_GRAPHICS
      /* CMD:           BOARDIOC_GRAPHICS_SETUP
       * DESCRIPTION:   Configure graphics that require special initialization
       *                procedures
       * ARG:           A pointer to an instance of struct boardioc_graphics_s
       * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_GRAPHICS
       * DEPENDENCIES:  Board logic must provide board_adc_setup()
       */

      case BOARDIOC_GRAPHICS_SETUP:
        {
          FAR struct boardioc_graphics_s *setup = 
            ( FAR struct boardioc_graphics_s *)arg;

          setup->dev = board_graphics_setup(setup->devno);
          ret = setup->dev ? OK : -ENODEV;
        }
        break;
#endif

       default:
         {
#ifdef CONFIG_BOARDCTL_IOCTL
           /* Boards may also select CONFIG_BOARDCTL_IOCTL=y to enable board-
            * specific commands.  In this case, all commands not recognized
            * by boardctl() will be forwarded to the board-provided board_ioctl()
            * function.
            */

           ret = board_ioctl(cmd, arg);
#else
           ret = -ENOTTY;
#endif
         }
         break;
    }

  /* Set the errno value on any errors */

  if (ret < 0)
    {
      set_errno(-ret);
      return ERROR;
    }

  return OK;
}