• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ rtems_clock_get_ticks_per_second函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Init

rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id          task_id;
  rtems_name        task_name;

  puts( "\n\n*** LED BLINKER -- semaphore ping/pong ***" );

  LED_INIT();

  status = rtems_semaphore_create(
    rtems_build_name( 'S', 'E', 'M', ' ' ),
    0,  /* created locked */
    RTEMS_DEFAULT_ATTRIBUTES,
    0,
    &Sem_id
  );
  assert( status == RTEMS_SUCCESSFUL );

  task_name = rtems_build_name( 'T', 'A', '1', ' ' );

  status = rtems_task_create(
    task_name, 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES, &task_id
  );
  assert( status == RTEMS_SUCCESSFUL );

  status = rtems_task_start( task_id, Test_task, 1 );
  assert( status == RTEMS_SUCCESSFUL );

  while (1) {

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

    /* Transfers semaphore to TA1 */
    status = rtems_semaphore_release( Sem_id );
    if ( status != RTEMS_SUCCESSFUL )
      fputs( "init - release did not work\n", stderr );

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

  }

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


示例17: Test_task

rtems_task Test_task(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id          tid;
  rtems_time_of_day time;

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

  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" );

  status = rtems_task_wake_after( task_number( tid ) * 1 * rtems_clock_get_ticks_per_second() );
  directive_failed( status, "rtems_task_wake_after" );

  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" );

  if ( task_number(tid) == 1 ) {          /* TASK 1 */
    put_name( Task_name[ 1 ], FALSE );
    printf( " - deleting self\n" );
    status = rtems_task_delete( RTEMS_SELF );
    directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
  }
  else if ( task_number(tid) == 2 ) {     /* TASK 2 */
    put_name( Task_name[ 2 ], FALSE );
    printf( " - waiting to be deleted by " );
    put_name( Task_name[ 3 ], TRUE );
    while ( FOREVER );
  }
  else {                                  /* TASK 3 */
    put_name( Task_name[ 3 ], FALSE );
    printf( " - getting TID of " );
    put_name( Task_name[ 2 ], TRUE );
    do {
      status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid );
    } while ( status != RTEMS_SUCCESSFUL );
    directive_failed( status, "rtems_task_ident" );

    put_name( Task_name[ 3 ], FALSE );
    printf( " - deleting " );
    put_name( Task_name[ 2 ], TRUE );
    status = rtems_task_delete( tid );
    directive_failed( status, "rtems_task_delete of Task 2" );

    puts( "*** END OF TEST 1 ***" );
    rtems_test_exit(0);
  }
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:56,代码来源:task1.c


示例18: Non_Dormant_task

void Non_Dormant_task(void)
{
  ER       status;

  while (TRUE) {
    puts( "NON-DORMANT - Sleep for 2 minutes" );
    status = rtems_task_wake_after( 120*rtems_clock_get_ticks_per_second() );
    directive_failed( status, "rtems_task_wake_after" );
  }
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:10,代码来源:dormant.c


示例19: Task_1_through_5

rtems_task Task_1_through_5(
  rtems_task_argument argument
)
{
  int i;
  unsigned int passes = 0;
  rtems_id          tid;
  rtems_time_of_day time;
  rtems_status_code status;
  unsigned char *mem_ptr;
  int mem_amt;

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

  while (TRUE)
  {
    bool malloc_walk_ok;

    if ( passes++ > NUM_PASSES ) {
	TEST_END();
        rtems_test_exit(0);
    }

    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" );

    mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX));
    while (!(mem_ptr = malloc ( mem_amt))) {
	printf("out of memory... trying again.\n");
	mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX));
    }
    printf("mallocing %d bytes\n",mem_amt);
    memset( mem_ptr, mem_amt, mem_amt );
    malloc_report_statistics();
    malloc_walk_ok = malloc_walk( 1, false );
    rtems_test_assert( malloc_walk_ok );
    status = rtems_task_wake_after(
      task_number( tid ) * 1 * rtems_clock_get_ticks_per_second()/4 );
    for (i=0; i < mem_amt; i++)
    {
       if ( mem_ptr[i] != (mem_amt & 0xff))
       {
          printf("failed %d, %d, 0x%x, 0x%x\n",i,mem_amt,mem_ptr[i],mem_amt&0xff);
          rtems_test_exit(1);
       }
    }
    directive_failed( status, "rtems_task_wake_after" );
    free( mem_ptr );
  }
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:54,代码来源:task1.c


示例20: Task_3

rtems_task Task_3(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  puts( "TA3 - rtems_task_wake_after - sleep 5 seconds" );
  status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() );
  directive_failed( status, "rtems_task_wake_after in TA3" );

  puts( "TA3 - rtems_task_delete - delete self" );
  status = rtems_task_delete( RTEMS_SELF );
  directive_failed( status, "rtems_task_delete of TA3" );
}
开发者ID:aniwang2013,项目名称:leon-rtems,代码行数:14,代码来源:task3.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rtems_event_receive函数代码示例发布时间:2022-05-30
下一篇:
C++ rtems_build_name函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap