当前位置: 首页>>代码示例>>C++>>正文


C++ rtems_clock_get_ticks_per_second函数代码示例

本文整理汇总了C++中rtems_clock_get_ticks_per_second函数的典型用法代码示例。如果您正苦于以下问题:C++ rtems_clock_get_ticks_per_second函数的具体用法?C++ rtems_clock_get_ticks_per_second怎么用?C++ rtems_clock_get_ticks_per_second使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rtems_clock_get_ticks_per_second函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tms570_sci_interrupt_last_close

/**
 * @brief closes sci peripheral of interrupt driven driver
 *
 * calls tms570_sci_poll_last_close and disables interrupts
 *
 * @param[in] tty Termios control
 * @param[in] base context of the driver
 * @param[in] args
 * @retval false Error occured during initialization
 * @retval true Driver is open and ready
 */
static void tms570_sci_interrupt_last_close(
  rtems_termios_tty             *tty,
  rtems_termios_device_context  *base,
  rtems_libio_open_close_args_t *args
)
{
  tms570_sci_context *ctx = (tms570_sci_context *) base;
  rtems_interrupt_lock_context lock_context;
  rtems_interval tw;
  int32_t baudrate;

  /* Turn off RX interrupts */
  rtems_termios_device_lock_acquire(base, &lock_context);
  tms570_sci_disable_interrupts(ctx);
  rtems_termios_device_lock_release(base, &lock_context);

  tw = rtems_clock_get_ticks_per_second();
  baudrate = rtems_termios_baud_to_number(cfgetospeed(&tty->termios));
  tw = tw * 10 / baudrate + 1;
  while ( ( ctx->regs->FLR & TMS570_SCI_FLR_TX_EMPTY ) == 0 ) {
     rtems_task_wake_after(tw);
  }

  /* uninstall ISR */
  rtems_interrupt_handler_remove(ctx->irq, tms570_sci_interrupt_handler, tty);

  tms570_sci_poll_last_close(tty, base, args);
}
开发者ID:deval-maker,项目名称:rtems,代码行数:39,代码来源:tms570-sci.c

示例2: Task_1

rtems_task Task_1(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id          tid;
  rtems_time_of_day time;
  uint32_t    task_index;
  INTEGER_DECLARE;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  directive_failed( status, "rtems_task_ident" );

  task_index = task_number( tid );

  INTEGER_LOAD( INTEGER_factors[ task_index ] );

  put_name( Task_name[ task_index ], FALSE );
  printf( " - integer base = (0x%" PRIx32 ")\n", INTEGER_factors[ task_index ] );

  while( FOREVER ) {
    status = rtems_clock_get_tod( &time );
    directive_failed( status, "rtems_clock_get_tod" );

    put_name( Task_name[ task_number( tid ) ], FALSE );
    print_time( " - rtems_clock_get_tod - ", &time, "\n" );

    INTEGER_CHECK( INTEGER_factors[ task_index ] );

    status = rtems_task_wake_after(
      ( task_number( tid ) ) * 5 * rtems_clock_get_ticks_per_second()
    );
    directive_failed( status, "rtems_task_wake_after" );
  }
}
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:35,代码来源:task1.c

示例3: Shm_Print_statistics

void
Shm_Print_statistics(void)
{
  uint32_t    ticks;
  uint32_t    ticks_per_second;
  uint32_t    seconds;
  int         packets_per_second;

  ticks            = rtems_clock_get_ticks_since_boot();
  ticks_per_second = rtems_clock_get_ticks_per_second();

  seconds = ticks / ticks_per_second;
  if ( seconds == 0 )
    seconds = 1;

  packets_per_second = Shm_Receive_message_count / seconds;
  if ( (Shm_Receive_message_count % seconds) >= (seconds / 2) )
    packets_per_second++;

  printk( "\n\nSHMDR STATISTICS (NODE %" PRId32 ")\n",
    Multiprocessing_configuration.node );
  printk( "TICKS SINCE BOOT = %" PRId32 "\n", ticks );
  printk( "TICKS PER SECOND = %" PRId32 "\n", ticks_per_second );
  printk( "ISRs=%" PRId32 "\n",     Shm_Interrupt_count );
  printk( "RECV=%" PRId32 "\n",     Shm_Receive_message_count );
  printk( "NULL=%" PRId32 "\n",     Shm_Null_message_count );
  printk( "PKTS/SEC=%" PRId32 "\n", packets_per_second );
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:28,代码来源:dump.c

示例4: Test_task

rtems_task Test_task(
  rtems_task_argument unused
)
{
  rtems_id          tid;
  rtems_time_of_day time;
  uint32_t          task_index;
  rtems_status_code status;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  directive_failed( status, "task ident" ); 

  task_index = task_number( tid );
  for ( ; ; ) {
    status = rtems_clock_get_tod( &time );
    if ( time.second >= 35 ) {
      puts( "*** END OF CLOCK TICK TEST ***" );
      rtems_test_exit( 0 );
    }
    put_name( Task_name[ task_index ], FALSE );
    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
    status = rtems_task_wake_after(
      task_index * 5 * rtems_clock_get_ticks_per_second()
    );
    directive_failed( status, "wake after" ); 
  }
}
开发者ID:aniwang2013,项目名称:leon-rtems,代码行数:27,代码来源:tasks.c

示例5: Test_task

rtems_task Test_task(
  rtems_task_argument unused
)
{
  rtems_status_code status;

  for ( ; ; ) {

    /* Semaphore not available, ensured to block */
    status = rtems_semaphore_obtain(
      Sem_id,
      RTEMS_DEFAULT_OPTIONS,
      RTEMS_NO_TIMEOUT
    );
    if ( status != RTEMS_SUCCESSFUL )
      fputs( "Task - obtain did not work\n", stderr );

    LED_ON();

    status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
    assert( status == RTEMS_SUCCESSFUL );

    /* Transfers semaphore to Init task */
    status = rtems_semaphore_release( Sem_id );
    if ( status != RTEMS_SUCCESSFUL )
      fputs( "Task - release did not work\n", stderr );
  }
}
开发者ID:BlueFireworks,项目名称:examples-v2,代码行数:28,代码来源:init.c

示例6: Test_task

rtems_task Test_task(
  rtems_task_argument unused
)
{
  rtems_id          tid;
  rtems_time_of_day time;
  uint32_t    task_index;
  rtems_status_code status;
  char              name[5];
  char             *p;

  /* Get the task name */
  p = rtems_object_get_name( RTEMS_SELF, 5, name );
  rtems_test_assert( p != NULL );

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  rtems_test_assert( status == RTEMS_SUCCESSFUL );
  task_index = task_number( tid );
  for ( ; ; ) {
    status = rtems_clock_get_tod( &time );
    rtems_test_assert( status == RTEMS_SUCCESSFUL );
    if ( time.second >= 35 ) {
      TEST_END();
      rtems_test_exit( 0 );
    }

    PrintTaskInfo( p, &time );
    status = rtems_task_wake_after(
      task_index * 5 * rtems_clock_get_ticks_per_second() );
    rtems_test_assert( status == RTEMS_SUCCESSFUL );
  }
}
开发者ID:gedare,项目名称:rtems,代码行数:32,代码来源:tasks.c

示例7: Receive_messages

void Receive_messages()
{
 rtems_status_code status;
 uint32_t          index;
 size_t            size;
 char              receive_buffer[16];

 for ( index=1 ; index <=3 ; index++ ) {
   puts( "Receiving message ..." );
   status = rtems_message_queue_receive(
     Queue_id[ 1 ],
     receive_buffer,
     &size,
     RTEMS_DEFAULT_OPTIONS,
     RTEMS_NO_TIMEOUT
   );
   directive_failed( status, "rtems_message_queue_receive" );
   puts_nocr( "Received : ");
   puts( receive_buffer );
 }

  puts( "Receiver delaying for a second" );
  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
  directive_failed( status, "rtems_task_wake_after" );
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:25,代码来源:recvmsg.c

示例8: Init

rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id          period_id;
  rtems_interval    ticks;
  uint32_t          count;

  puts( "\n\n*** LED BLINKER -- single period ***" );

  LED_INIT();

  status = rtems_rate_monotonic_create(
    rtems_build_name( 'P', 'E', 'R', '1' ),
    &period_id
  );

  ticks = rtems_clock_get_ticks_per_second();

  for (count=0; ; count++) {
    status = rtems_rate_monotonic_period( period_id, ticks );
    if ( (count % 2) == 0 )
      LED_OFF();
    else
      LED_ON();
  }

  status = rtems_task_delete( RTEMS_SELF );
}
开发者ID:BlueFireworks,项目名称:examples-v2,代码行数:30,代码来源:init.c

示例9: rtems_bsd_initialize

rtems_status_code
rtems_bsd_initialize(void)
{
	rtems_status_code sc = RTEMS_SUCCESSFUL;

	hz = (int) rtems_clock_get_ticks_per_second();
	tick = 1000000 / hz;
	maxusers = 1;

	gettimeofday(&boottime, NULL);
	timeval2bintime(&boottime, &boottimebin);

	mkdir("/etc", S_IRWXU | S_IRWXG | S_IRWXO);

	sc =  rtems_timer_initiate_server(
		BSD_TASK_PRIORITY_TIMER,
		BSD_MINIMUM_TASK_STACK_SIZE,
		RTEMS_DEFAULT_ATTRIBUTES
	);
	if (sc != RTEMS_SUCCESSFUL) {
		return RTEMS_UNSATISFIED;
	}

	mutex_init();
	mi_startup();

	return RTEMS_SUCCESSFUL;
}
开发者ID:scclancy,项目名称:rtems-libbsd,代码行数:28,代码来源:rtems-bsd-init.c

示例10: Init

rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  puts( "\n\n*** LED BLINKER -- timer_server ***" );

  LED_INIT();

  status = rtems_timer_initiate_server(
    1, 
    RTEMS_MINIMUM_STACK_SIZE * 2,
    RTEMS_DEFAULT_ATTRIBUTES
  );

  if ( status != RTEMS_SUCCESSFUL )
    fputs( "timer create server failed\n", stderr );

  status = rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '1' ), &Timer1);
  if ( status != RTEMS_SUCCESSFUL )
    fputs( "Timer1 create failed\n", stderr );

  status = rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '2' ), &Timer2);
  if ( status != RTEMS_SUCCESSFUL )
    fputs( "Timer2 create failed\n", stderr );

  Timer_Routine(Timer1, NULL);

  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );

  Timer_Routine(Timer2, NULL);

  status = rtems_task_delete( RTEMS_SELF );
}
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:35,代码来源:init.c

示例11: Test_task

rtems_task Test_task(
  rtems_task_argument arg
)
{
  rtems_time_of_day time;
  uint32_t          task_index;
  rtems_status_code status;

  task_index = arg;
  for ( ; ; ) {
    status = rtems_clock_get_tod( &time );
    directive_failed( status, "get tod" );

    if ( time.second >= 15 ) {
      puts( "*** END OF SP73 (YIELD) TEST ***" );
      rtems_test_exit( 0 );
    }
    put_name( Task_name[ task_index ], FALSE );
    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
    status = rtems_task_wake_after(
      task_index * 5 * rtems_clock_get_ticks_per_second()
    );
    directive_failed( status, "wake after" );
  }
}
开发者ID:0871087123,项目名称:rtems,代码行数:25,代码来源:init.c

示例12: Task_2_through_4

void Task_2_through_4(void)
{
  ID                tid;
  int               tid_index;
  rtems_time_of_day time;
  ER                status;
  char              name[30];

  status = get_tid( &tid );
  directive_failed( status, "get_tid");

  tid_index = tid - 1;  /* account for init tasks */

  sprintf(name, "TA%d", tid_index);

  while( FOREVER ) {
    status = rtems_clock_get_tod( &time );
    directive_failed( status, "rtems_clock_get_tod" );

    if ( time.second >= 35 ) {
      puts( "*** END OF ITRON TASK TEST 1 ***" );
      rtems_test_exit( 0 );
    }

    printf(name);
    print_time( " - rtems_clock_get_tod - ", &time, "\n" );

    status = rtems_task_wake_after(
      tid_index * 5 * rtems_clock_get_ticks_per_second() );
    directive_failed( status, "rtems_task_wake_after" );
  }
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:32,代码来源:task1.c

示例13: Task_2

void Task_2()
{
  rtems_status_code status;

  puts( "TA2 - rtems_task_wake_after - sleep 1 minute" );
  status = rtems_task_wake_after( 60*rtems_clock_get_ticks_per_second() );
  directive_failed( status, "rtems_task_wake_after in TA2" );
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:8,代码来源:task2.c

示例14: gyroscope_task

rtems_task gyroscope_task(rtems_task_argument arg)
{
  printf("gyroscope task started\n");

  for (;;) {
    rtems_task_wake_after(5 * rtems_clock_get_ticks_per_second());
  }
}
开发者ID:eugmes,项目名称:rtems-test,代码行数:8,代码来源:gyroscope.c

示例15: OS_TicksToUsecs

/******************************************************************************
 **  Function:  OS_TicksToUsec
 **
 **  Purpose:  Convert a number of Ticks to microseconds
 **
 */
void  OS_TicksToUsecs(rtems_interval ticks, uint32 *usecs)
{
   rtems_interval ticks_per_sec = rtems_clock_get_ticks_per_second(); 
   uint32         usecs_per_tick;
   
   usecs_per_tick = (1000000)/ticks_per_sec;

   *usecs = ticks * usecs_per_tick;
}
开发者ID:gpgreen,项目名称:osal-beagleboard,代码行数:15,代码来源:ostimer.c


注:本文中的rtems_clock_get_ticks_per_second函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。