Пример #1
0
rtems_task Init(rtems_task_argument argument)
{
#if BSP_SMALL_MEMORY
  printf("NO NETWORKING. MEMORY TOO SMALL");
#else
  rtems_test_begin();

  /* initialize network */
  rtems_bsdnet_initialize_network();
  rtems_pppd_initialize();
  pppdapp_initialize();
#endif
  rtems_task_delete(RTEMS_SELF);
}
Пример #2
0
int main( void )
#endif
{
#if __rtems__
  rtems_test_begin();
#endif

  domath();

#if __rtems__
  rtems_test_end();
#endif
  exit( 0 );
}
Пример #3
0
int main( void )
#endif
{
#if __rtems__
  rtems_test_begin();
#endif

  docomplex();
  docomplexf();  
  docomplexl();
#if __rtems__
  rtems_test_end();
#endif
  exit( 0 );
}
Пример #4
0
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 );
}
Пример #5
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 );
}
Пример #6
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);
}
Пример #7
0
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 );
}
Пример #8
0
rtems_task Init(
  rtems_task_argument argument
)
{
  uint32_t           i;
  char               ch;
  uint32_t           cpu_num;
  rtems_id           id;
  rtems_status_code  status;

  locked_print_initialize();
  rtems_test_begin();

  if ( rtems_get_processor_count() == 1 ) {
    success();
  }

  for ( i=0; i<rtems_get_processor_count() ; i++ ) {
    ch = '1' + i;

    status = rtems_task_create(
      rtems_build_name( 'T', 'A', ch, ' ' ),
      1,
      RTEMS_MINIMUM_STACK_SIZE,
      RTEMS_DEFAULT_MODES,
      RTEMS_DEFAULT_ATTRIBUTES,
      &id
    );
    directive_failed( status, "task create" );

    cpu_num = rtems_get_current_processor();
    locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);

    status = rtems_task_start( id, Test_task, i+1 );
    directive_failed( status, "task start" );
  }

  while (1)
    ;
}
Пример #9
0
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);
}
Пример #10
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 );
}
Пример #11
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 );
}