예제 #1
0
파일: init.c 프로젝트: AlexShiLucky/rtems
int main( void )
#endif
{
#if __rtems__
  rtems_test_begin();
#endif

  domath();

#if __rtems__
  rtems_test_end();
#endif
  exit( 0 );
}
예제 #2
0
파일: init.c 프로젝트: AlexShiLucky/rtems
int main( void )
#endif
{
#if __rtems__
  rtems_test_begin();
#endif

  docomplex();
  docomplexf();  
  docomplexl();
#if __rtems__
  rtems_test_end();
#endif
  exit( 0 );
}
예제 #3
0
파일: init.c 프로젝트: greenmeent/rtems
int main( void )
#endif
{
#if __rtems__
  rtems_print_printer_printf(&rtems_test_printer);
  rtems_test_begin();
#endif

  domathf();

#if __rtems__
  rtems_test_end();
#endif
  exit( 0 );
}
예제 #4
0
/*
 * RTEMS Startup Task
 */
rtems_task
Init (rtems_task_argument ignored)
{
    rtems_status_code sc;

    rtems_print_printer_printf(&rtems_test_printer);

    rtems_test_begin();

    sc = rtems_semaphore_create(rtems_build_name('P','m','t','x'),
                                1,
                                RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY|
                                RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL,
                                0,
                                &printMutex);
    if (sc != RTEMS_SUCCESSFUL)
        rtems_panic("Can't create printf mutex:", rtems_status_text(sc));
    printf("\"Network\" initializing!\n");
    rtems_bsdnet_initialize_network();
    printf("\"Network\" initialized!\n");

    printf("Try running client with no server present.\n");
    printf("Should fail with `connection refused'.\n");
    clientWorker(0);

    printf("\nStart server.\n");
    spawnTask(serverTask, 150, 0);

    printf("\nTry running client with server present.\n");
    spawnTask(clientTask, 120, 1);
    rtems_task_wake_after(500);

    printf("\nTry running two clients.\n");
    spawnTask(clientTask, 120, 2);
    spawnTask(clientTask, 120, 3);
    rtems_task_wake_after(500);

    printf("\nTry running three clients.\n");
    spawnTask(clientTask, 120, 4);
    spawnTask(clientTask, 120, 5);
    spawnTask(clientTask, 120, 6);

    rtems_task_wake_after(500);
    rtems_test_end();
    exit( 0 );
}
예제 #5
0
rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code sc;
  int val;

  rtems_test_begin();

  /* Initializes the GPIO API */
  sc = rtems_gpio_initialize();
  assert(sc == RTEMS_SUCCESSFUL);

  sc = rtems_gpio_multi_select(test, 4);
  assert(sc == RTEMS_SUCCESSFUL);

  /* Polls the two switches. */
  while ( 1 ) {
    val = rtems_gpio_get_value(sw1_pin);

     if ( val == 0 ) {
      sc = rtems_gpio_set(led2_pin);
      assert(sc == RTEMS_SUCCESSFUL);
    }

    else {
      sc = rtems_gpio_clear(led2_pin);
      assert(sc == RTEMS_SUCCESSFUL);
    }

     val = rtems_gpio_get_value(sw2_pin);

    if ( val == 0 ) {
      sc = rtems_gpio_set(led1_pin);
      assert(sc == RTEMS_SUCCESSFUL);
    }

    else {
      sc = rtems_gpio_clear(led1_pin);
      assert(sc == RTEMS_SUCCESSFUL);
    }
  }

  rtems_test_end();
  exit(0);
}
예제 #6
0
파일: init.c 프로젝트: greenmeent/rtems
rtems_task Init(
  rtems_task_argument ignored
)
{
  /*
   *  Install whatever optional floating point assistance package
   *  is required by this CPU.
   */

#if (defined (m68040))
  M68KFPSPInstallExceptionHandlers ();
#endif

  rtems_print_printer_printf(&rtems_test_printer);
  rtems_test_begin();
  paranoia(1, args);
  rtems_test_end();
  exit( 0 );
}
예제 #7
0
파일: init.c 프로젝트: AlexShiLucky/rtems
rtems_task Init(rtems_task_argument argument)
{
  rtems_status_code status;

  rtems_test_begin();

  status = rtems_shell_wait_for_input(
    STDIN_FILENO,
    10,
    notification,
    NULL
  );
  if (status != RTEMS_SUCCESSFUL) {
    rtems_test_end();
    exit( 0 );
  }

  /* initialize network */
  rtems_bsdnet_initialize_network();
  rtems_pppd_initialize();
  pppdapp_initialize();
  rtems_task_delete(RTEMS_SELF);
}
예제 #8
0
rtems_task Init(rtems_task_argument ignored)
{
  int spi_bus;
  int rv = 0;
  int fd;

  char buf[32];

  rtems_test_begin ();

  spi_bus = rpi_spi_init(false);
  assert ( spi_bus >= 0 );

  rv = spi_libi2c_register_23k256(spi_bus);
  assert ( rv > 0 );

  fd = open("/dev/spi.23k256", O_RDWR);
  RTEMS_CHECK_RV(fd, "Open /dev/spi.23k256");

  rv = write(fd, "This message confirms that RTEMS can send and receive data using the SPI bus to the 23k256 SRAM device!", 104);
  assert ( rv > 0 );

  printf("\nWrote %d chars\n", rv);

  rv = read(fd, buf, 104);
  assert ( rv > 0 );

  printf("\nRead %d chars\n", rv);

  printf("\nRead data -> %s\n\n", buf);

  rv = close(fd);
  RTEMS_CHECK_RV(rv, "Close /dev/spi.23k256");

  rtems_test_end ();
  exit ( 0 );
}
예제 #9
0
파일: init.c 프로젝트: greenmeent/rtems
static void success(void)
{
  rtems_test_end();
  rtems_test_exit( 0 );
}
예제 #10
0
rtems_task Init(rtems_task_argument ignored)
{
  int rv = 0;
  int val;
  int fd;

  rtems_test_begin ();

  rv = rpi_setup_i2c_bus();
  assert ( rv == 0 );

  rv = i2c_dev_register_mcp23008(
         "/dev/i2c",
         "/dev/i2c.mcp23008",
         MCP23008_ADDR
       );

  assert ( rv == 0 );

  /* Open the mcp23008 device file */
  fd = open("/dev/i2c.mcp23008", O_RDWR);
  RTEMS_CHECK_RV(rv, "Open /dev/i2c.mcp23008");

  /* Set the mcp23008 gpio pin 4 as an output */
  rv = ioctl(fd, MCP23008_CONF_OUTPUT, (void *)(uintptr_t) 4);
  RTEMS_CHECK_RV(rv, "mcp23008 gpio conf output");

  /* Set the LED connected to the mcp23008 gpio pin 4 off */
  rv = ioctl(fd, MCP23008_CLEAR_OUTPUT, (void *)(uintptr_t)4);
  RTEMS_CHECK_RV(rv, "mcp23008 gpio clear output");

  /* Set the mcp23008 gpio pin 2 as an input */
  rv = ioctl(fd, MCP23008_CONF_INPUT, (void *)(uintptr_t) 2);
  RTEMS_CHECK_RV(rv, "mcp23008 gpio conf input");

  /* Enable the mcp23008 gpio pin 2 pull up */
  rv = ioctl(fd, MCP23008_SET_PULLUP, (void *)(uintptr_t) 2);
  RTEMS_CHECK_RV(rv, "mcp23008 gpio set pullup");

  /* Polls forever the buton conected to the mcp23008 gpio pin 2,
   * and lights the LED connected to the mcp23008 gpio pin 4 when the button is pressed.
   */
  while ( 1 ) {
    val = ioctl(fd, MCP23008_READ_INPUT, (void *)(uintptr_t) 2);

    if ( val == 0 ) {
      rv = ioctl(fd, MCP23008_SET_OUTPUT, (void *)(uintptr_t) 4);
      RTEMS_CHECK_RV(rv, "mcp23008 gpio set output");
    }
    else {
      rv = ioctl(fd, MCP23008_CLEAR_OUTPUT, (void *)(uintptr_t) 4);
      RTEMS_CHECK_RV(rv, "mcp23008 gpio clear output");
    }
  }

  rv = close(fd);
  RTEMS_CHECK_RV(rv, "Close /dev/i2c.mcp23008");

  rtems_test_end();
  exit ( 0 );
}