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

C++ rtems_event_receive函数代码示例

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

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



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

示例1: task_1

rtems_task task_1(rtems_task_argument argument){
	while(1){
		rtems_status_code returning;
		rtems_event_set out;

		printf("Waiting Task is now started... \nWaiting for event to be received...\n");

		returning = rtems_event_receive(
		RTEMS_EVENT_1,
		RTEMS_EVENT_ALL | RTEMS_WAIT,
		RTEMS_NO_TIMEOUT,
		&out
		);

		switch(returning){
		case RTEMS_SUCCESSFUL: printf("Received Event Successfully..."); break;
		default: printf("Event NOT received successfully...\n"); break;
		};


		rtems_task_wake_after(500);

		printf("Quitting current task... \n");
		rtems_task_delete ( RTEMS_SELF );
		exit(1);
	}
}
开发者ID:cassioiks,项目名称:RTEMS-Testing,代码行数:27,代码来源:init.c


示例2: Init

rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code     sc;
  rtems_event_set       out;
  int                   resets;

  puts( "\n\n*** TEST INTERRUPT CRITICAL SECTION 10 ***" );

  puts( "Init - Test may not be able to detect case is hit reliably" );
  puts( "Init - Trying to generate timeout while blocking on event" );

  Main_task = rtems_task_self();

  interrupt_critical_section_test_support_initialize( NULL );

  for (resets=0 ; resets< 2 ;) {
    if ( interrupt_critical_section_test_support_delay() )
      resets++;

    sc = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 1, &out );
    fatal_directive_status( sc, RTEMS_TIMEOUT, "event_receive timeout" );
  }

  puts( "*** END OF TEST INTERRUPT CRITICAL SECTION 10 ***" );
  rtems_test_exit(0);
}
开发者ID:0871087123,项目名称:rtems,代码行数:28,代码来源:init.c


示例3: bsp_interrupt_server_task

static void bsp_interrupt_server_task(rtems_task_argument arg)
{
  rtems_status_code sc = RTEMS_SUCCESSFUL;

  while (true) {
    rtems_event_set events = 0;
    bsp_interrupt_server_entry *e = NULL;

    sc = rtems_event_receive(
      BSP_INTERRUPT_EVENT,
      RTEMS_EVENT_ALL | RTEMS_WAIT,
      RTEMS_NO_TIMEOUT,
      &events
    );
    if (sc != RTEMS_SUCCESSFUL) {
      break;
    }

    while ((e = bsp_interrupt_server_get_entry()) != NULL) {
      (*e->handler)(e->arg);

      bsp_interrupt_vector_enable(e->vector);
    }
  }

  rtems_task_delete(RTEMS_SELF);
}
开发者ID:AndroidMarv,项目名称:rtems,代码行数:27,代码来源:irq-server.c


示例4: rtems_termios_txdaemon

/*
 * this task actually processes any transmit events
 */
static rtems_task rtems_termios_txdaemon(rtems_task_argument argument)
{
	struct rtems_termios_tty *tty = (struct rtems_termios_tty *)argument;
	rtems_event_set the_event;

	while (1) {
		/*
		 * wait for rtems event
		 */
		rtems_event_receive((TERMIOS_TX_START_EVENT |
				     TERMIOS_TX_TERMINATE_EVENT),
				    RTEMS_EVENT_ANY | RTEMS_WAIT,
				    RTEMS_NO_TIMEOUT,
				    &the_event);
		if ((the_event & TERMIOS_TX_TERMINATE_EVENT) != 0) {
			tty->txTaskId = 0;
			rtems_task_delete(RTEMS_SELF);
		}
		else {
			/*
			 * call any line discipline start function
			 */
			if (rtems_termios_linesw[tty->t_line].l_start != NULL) {
				rtems_termios_linesw[tty->t_line].l_start(tty);
			}
			/*
			 * try to push further characters to device
			 */
			rtems_termios_refill_transmitter(tty);
		}
	}
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:35,代码来源:termios.c


示例5: rtems_termios_rxdaemon

/*
 * this task actually processes any receive events
 */
static rtems_task rtems_termios_rxdaemon(rtems_task_argument argument)
{
	struct rtems_termios_tty *tty = (struct rtems_termios_tty *)argument;
	rtems_event_set the_event;
	int c;
	char c_buf;
	while (1) {
		/*
		 * wait for rtems event
		 */
		rtems_event_receive((TERMIOS_RX_PROC_EVENT |
				     TERMIOS_RX_TERMINATE_EVENT),
				    RTEMS_EVENT_ANY | RTEMS_WAIT,
				    RTEMS_NO_TIMEOUT,
				    &the_event);
		if ((the_event & TERMIOS_RX_TERMINATE_EVENT) != 0) {
			tty->rxTaskId = 0;
			rtems_task_delete(RTEMS_SELF);
		}
		else {
			/*
			 * do something
			 */
			c = tty->device.pollRead(tty->minor);
			if (c != EOF) {
				/*
				 * pollRead did call enqueue on its own
				 */
				c_buf = c;
				rtems_termios_enqueue_raw_characters (
				      tty,&c_buf,1);
			}
		}
	}
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:38,代码来源:termios.c


示例6: printer_task

static void printer_task( rtems_task_argument arg )
{
  rtems_printer_task_context *ctx;
  int                         fd;

  ctx = (rtems_printer_task_context *) arg;
  fd = ctx->fd;

  while ( true ) {
    rtems_event_set      unused;
    printer_task_buffer *buffer;

    rtems_event_receive(
      PRINT_TASK_WAKE_UP,
      RTEMS_EVENT_ALL | RTEMS_WAIT,
      RTEMS_NO_TIMEOUT,
      &unused
    );

    while (
      ( buffer = printer_task_get_buffer( ctx, &ctx->todo_buffers ) ) != NULL
    ) {
      switch ( buffer->action_kind ) {
        case ACTION_WRITE:
          write( fd, &buffer->data[ 0 ], buffer->action_data.size );
          printer_task_append_buffer( ctx, &ctx->free_buffers, buffer );
          break;
        case ACTION_DRAIN:
          fsync(fd);
          rtems_event_transient_send( buffer->action_data.task );
          break;
      }
    }
  }
}
开发者ID:deval-maker,项目名称:rtems,代码行数:35,代码来源:printertask.c


示例7: test_body_timeout_before_all_satisfy

static bool test_body_timeout_before_all_satisfy(void *arg)
{
  test_context *ctx = arg;
  rtems_event_set out;
  rtems_status_code sc;

  out = DEADBEEF;
  sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ALL | RTEMS_WAIT, 1, &out);
  rtems_test_assert(sc == RTEMS_TIMEOUT);
  rtems_test_assert(out == DEADBEEF);

  out = DEADBEEF;
  sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ALL | RTEMS_NO_WAIT, 0, &out);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
  rtems_test_assert(out == EVENTS);

  return ctx->hit;
}
开发者ID:Dipupo,项目名称:rtems,代码行数:18,代码来源:init.c


示例8: test_body_any_satisfy_before_timeout

static bool test_body_any_satisfy_before_timeout(void *arg)
{
  test_context *ctx = arg;
  rtems_status_code sc;
  rtems_event_set out;

  out = DEADBEEF;
  sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ANY | RTEMS_WAIT, 1, &out);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
  rtems_test_assert(out == GREEN);

  out = DEADBEEF;
  sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ANY | RTEMS_NO_WAIT, 0, &out);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
  rtems_test_assert(out == RED);

  return ctx->hit;
}
开发者ID:Dipupo,项目名称:rtems,代码行数:18,代码来源:init.c


示例9: ppp_rxdaemon

static rtems_task ppp_rxdaemon(rtems_task_argument arg)
{
  rtems_event_set             events;
  rtems_interrupt_level       level;
  struct ppp_softc           *sc = (struct ppp_softc *)arg;
  struct mbuf                *mp = (struct mbuf      *)0;
  struct mbuf                *m;

  /* enter processing loop */
  while ( 1 ) {
    /* wait for event */
    rtems_event_receive(RX_PACKET|RX_MBUF|RX_EMPTY,RTEMS_WAIT|RTEMS_EVENT_ANY,RTEMS_NO_TIMEOUT,&events);
    if ( events & RX_EMPTY ) {
      printf("RX: QUEUE is EMPTY\n");
      events &= ~RX_EMPTY;
    }

    if ( events ) {
      /* get the network semaphore */
      rtems_bsdnet_semaphore_obtain();

      /* check to see if new packet was received */
      if ( events & RX_PACKET ) {
        /* get received packet mbuf chain */
        rtems_interrupt_disable(level);
        IF_DEQUEUE(&sc->sc_rawq, m);
        rtems_interrupt_enable(level);

        /* ensure packet was retrieved */
        if ( m != (struct mbuf *)0 ) {
          /* process the received packet */
          mp = ppp_inproc(sc, m);
        }
      }

      /* allocate a new mbuf to replace one */
      if ( mp == NULL ) {
        pppallocmbuf(sc, &mp);
      }

      /* place mbuf on freeq */
      rtems_interrupt_disable(level);
      IF_ENQUEUE(&sc->sc_freeq, mp);
      rtems_interrupt_enable(level);
      mp = (struct mbuf *)0;

      /* release the network semaphore */
      rtems_bsdnet_semaphore_release();

      /* check to see if queue is empty */
      if ( sc->sc_rawq.ifq_head ) {
        /* queue is not empty - post another event */
        rtems_event_send(sc->sc_rxtask, RX_PACKET);
      }
    }
  }
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:57,代码来源:if_ppp.c


示例10: session

/*PAGE
 *
 * session
 *
 * This task handles single session.  It is waked up when the FTP daemon gets a
 * service request from a remote machine.  Here, we watch for commands that
 * will come through the control connection.  These commands are then parsed
 * and executed until the connection is closed, either unintentionally or
 * intentionally with the "QUIT" command.
 *
 * Input parameters:
 *   arg - pointer to corresponding SessionInfo.
 *
 * Output parameters:
 *   NONE
 */
static void
session(rtems_task_argument arg)
{
  FTPD_SessionInfo_t  *const info = (FTPD_SessionInfo_t  *)arg;
  int chroot_made = 0;

  rtems_libio_set_private_env();

  /* chroot() can fail here because the directory may not exist yet. */
  chroot_made = chroot(ftpd_root) == 0;

  while(1)
  {
    rtems_event_set set;

    rtems_event_receive(FTPD_RTEMS_EVENT, RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT,
      &set);

    chroot_made = chroot_made || chroot(ftpd_root) == 0;
    chdir("/");

    errno = 0;

    send_reply(info, 220, FTPD_SERVER_MESSAGE);

    while (1)
    {
      char buf[FTPD_BUFSIZE];
      char *cmd, *opts, *args;

      if (fgets(buf, FTPD_BUFSIZE, info->ctrl_fp) == NULL)
      {
        syslog(LOG_INFO, "ftpd: Connection aborted.");
        break;
      }

      split_command(buf, &cmd, &opts, &args);

      if (!strcmp("QUIT", cmd))
      {
        send_reply(info, 221, "Goodbye.");
        break;
      }
      else
      {
        exec_command(info, cmd, args);
      }
    }

    /* Close connection and put ourselves back into the task pool. */
    close_data_socket(info);
    close_stream(info);
    task_pool_release(info);
  }
}
开发者ID:epicsdeb,项目名称:rtems,代码行数:71,代码来源:ftpd.c


示例11: rtems_monitor_suspend

rtems_status_code
rtems_monitor_suspend(rtems_interval timeout)
{
    rtems_event_set event_set;
    rtems_status_code status;

    status = rtems_event_receive(MONITOR_WAKEUP_EVENT,
                                 RTEMS_DEFAULT_OPTIONS,
                                 timeout,
                                 &event_set);
    return status;
}
开发者ID:rtemss,项目名称:rtems,代码行数:12,代码来源:mon-monitor.c


示例12: test_body_event_from_isr

static bool test_body_event_from_isr( void *arg )
{
  rtems_status_code status;
  rtems_event_set   out;

  (void) arg;

  status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 0, &out );
  rtems_test_assert( status == RTEMS_SUCCESSFUL );

  return case_hit;
}
开发者ID:Avanznow,项目名称:rtems,代码行数:12,代码来源:init.c


示例13: obtain_callback

static void obtain_callback(rtems_id timer_id, void *arg)
{
  rtems_status_code sc = RTEMS_SUCCESSFUL;
  char buf [1];
  size_t size = sizeof(buf);
  void *new_region_item = NULL;
  rtems_event_set events = 0;

  assert_time(T1);

  rtems_test_assert(
    !release_happened
      && !interrupt_happened
      && !delayed_happened
      && !interrupt_triggered_happened
      && !server_triggered_happened
  );

  obtain_try = true;

  switch (resource_type) {
    case SEMAPHORE:
      sc = rtems_semaphore_obtain(semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
      break;
    case MUTEX:
      sc = rtems_semaphore_obtain(mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
      break;
    case MESSAGE_QUEUE:
      sc = rtems_message_queue_receive(
        message_queue, buf, &size, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
      break;
    case REGION:
      sc = rtems_region_get_segment(
        region, 1, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &new_region_item);
      break;
    case EVENT:
      sc = rtems_event_receive(
        RTEMS_EVENT_0, RTEMS_EVENT_ALL | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events);
      break;
    case BARRIER:
      sc = rtems_barrier_wait(barrier, RTEMS_NO_TIMEOUT);
      break;
    case TASK_WAKE_AFTER:
      sc = rtems_task_wake_after(T4 - T1);
      break;
    default:
      rtems_test_assert(false);
      break;
  }
  directive_failed(sc, "obtain");

  obtain_done = true;
}
开发者ID:chch1028,项目名称:rtems,代码行数:53,代码来源:init.c


示例14: test_isr_level_for_new_threads

static void test_isr_level_for_new_threads( ISR_Level last_proper_level )
{
  ISR_Level mask = CPU_MODES_INTERRUPT_MASK;
  ISR_Level current;
  test_isr_level_context ctx = {
    .master_task_id = rtems_task_self()
  };

  for ( current = 0 ; current <= mask ; ++current ) {
    rtems_mode initial_modes = RTEMS_INTERRUPT_LEVEL(current);
    rtems_id id;
    rtems_status_code sc;
    rtems_event_set events;

    ctx.actual_level = 0xffffffff;

    sc = rtems_task_create(
      rtems_build_name('I', 'S', 'R', 'L'),
      RTEMS_MINIMUM_PRIORITY,
      RTEMS_MINIMUM_STACK_SIZE,
      initial_modes,
      RTEMS_DEFAULT_ATTRIBUTES,
      &id
    );
    rtems_test_assert( sc == RTEMS_SUCCESSFUL );

    sc = rtems_task_start(
      id,
      isr_level_check_task,
      (rtems_task_argument) &ctx
    );
    rtems_test_assert( sc == RTEMS_SUCCESSFUL );

    sc = rtems_event_receive(
      TEST_ISR_EVENT,
      RTEMS_EVENT_ALL | RTEMS_WAIT,
      RTEMS_NO_TIMEOUT,
      &events
    );
    rtems_test_assert( sc == RTEMS_SUCCESSFUL );
    rtems_test_assert( events == TEST_ISR_EVENT );

    if ( current <= last_proper_level ) {
      rtems_test_assert( ctx.actual_level == current );
    } else {
      rtems_test_assert( ctx.actual_level == last_proper_level );
    }

    sc = rtems_task_delete( id ) ;
    rtems_test_assert( sc == RTEMS_SUCCESSFUL );
  }
}
开发者ID:lanzhongheng,项目名称:rtems,代码行数:52,代码来源:init.c


示例15: fec_wait_for_event

static void fec_wait_for_event(struct mcf548x_enet_struct *sc)
{
  rtems_event_set out;

  FEC_UNLOCK(sc);
  rtems_event_receive(
    FEC_EVENT,
    RTEMS_EVENT_ANY | RTEMS_WAIT,
    RTEMS_NO_TIMEOUT,
    &out
  );
  FEC_LOCK(sc);
}
开发者ID:ragunath3252,项目名称:patch-rtems,代码行数:13,代码来源:if_ffec_mcf548x.c


示例16: test_with_normal_and_system_event

static void test_with_normal_and_system_event(void)
{
  rtems_status_code sc;
  rtems_event_set out;

  /* Assert no events pending */

  sc = rtems_event_receive(EVENT, RTEMS_NO_WAIT, 0, &out);
  rtems_test_assert(sc == RTEMS_UNSATISFIED);

  sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, &out);
  rtems_test_assert(sc == RTEMS_UNSATISFIED);

  /* Send system event */

  sc = rtems_event_system_send(rtems_task_self(), EVENT);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  sc = rtems_event_receive(EVENT, RTEMS_NO_WAIT, 0, &out);
  rtems_test_assert(sc == RTEMS_UNSATISFIED);

  out = 0;
  sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, &out);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
  rtems_test_assert(out == EVENT);

  /* Send normal event */

  sc = rtems_event_send(rtems_task_self(), EVENT);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  out = 0;
  sc = rtems_event_receive(EVENT, RTEMS_NO_WAIT, 0, &out);
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
  rtems_test_assert(out == EVENT);

  sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, &out);
  rtems_test_assert(sc == RTEMS_UNSATISFIED);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:39,代码来源:init.c


示例17: unmount

int unmount( const char *path )
{
  int rv = 0;
  rtems_filesystem_eval_path_context_t ctx;
  int eval_flags = RTEMS_FS_FOLLOW_LINK;
  const rtems_filesystem_location_info_t *currentloc =
    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
  rtems_filesystem_mount_table_entry_t *mt_entry = currentloc->mt_entry;

  if ( rtems_filesystem_location_is_root( currentloc ) ) {
    if ( !contains_root_or_current_directory( mt_entry ) ) {
      const rtems_filesystem_operations_table *mt_point_ops =
        mt_entry->mt_point_node->location.mt_entry->ops;

      rv = (*mt_point_ops->unmount_h)( mt_entry );
      if ( rv == 0 ) {
        rtems_id self_task_id = rtems_task_self();
        rtems_filesystem_mt_entry_declare_lock_context( lock_context );

        rtems_filesystem_mt_entry_lock( lock_context );
        mt_entry->unmount_task = self_task_id;
        mt_entry->mounted = false;
        rtems_filesystem_mt_entry_unlock( lock_context );
      }
    } else {
      errno = EBUSY;
      rv = -1;
    }
  } else {
    errno = EACCES;
    rv = -1;
  }

  rtems_filesystem_eval_path_cleanup( &ctx );

  if ( rv == 0 ) {
    rtems_event_set out;
    rtems_status_code sc = rtems_event_receive(
      RTEMS_FILESYSTEM_UNMOUNT_EVENT,
      RTEMS_EVENT_ALL | RTEMS_WAIT,
      RTEMS_NO_TIMEOUT,
      &out
    );

    if ( sc != RTEMS_SUCCESSFUL ) {
      rtems_fatal_error_occurred( 0xdeadbeef );
    }
  }

  return rv;
}
开发者ID:0871087123,项目名称:rtems,代码行数:51,代码来源:unmount.c


示例18: High_tasks

rtems_task High_tasks(
  rtems_task_argument argument
)
{
  if ( time_set )
    (void) rtems_event_receive(
      RTEMS_EVENT_16,
      RTEMS_DEFAULT_OPTIONS,
      RTEMS_NO_TIMEOUT,
      &eventout
    );
  else {
    time_set = true;
    /* start blocking rtems_event_receive time */
    benchmark_timer_initialize();
    (void) rtems_event_receive(
      RTEMS_EVENT_16,
      RTEMS_DEFAULT_OPTIONS,
      RTEMS_NO_TIMEOUT,
      &eventout
    );
  }
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:23,代码来源:task1.c


示例19: wait_for_finish

static void wait_for_finish(void)
{
  rtems_status_code sc;
  rtems_event_set out;

  sc = rtems_event_receive(
    FINISH_EVENT,
    RTEMS_WAIT | RTEMS_EVENT_ALL,
    RTEMS_NO_TIMEOUT,
    &out
  );
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
  rtems_test_assert(out == FINISH_EVENT);
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:14,代码来源:init.c


示例20: wait_for_events

static rtems_event_set wait_for_events(void)
{
  rtems_event_set events;
  rtems_status_code sc;

  sc = rtems_event_receive(
    RTEMS_ALL_EVENTS,
    RTEMS_EVENT_ANY | RTEMS_WAIT,
    RTEMS_NO_TIMEOUT,
    &events
  );
  rtems_test_assert(sc == RTEMS_SUCCESSFUL);

  return events;
}
开发者ID:WattTech,项目名称:rtems,代码行数:15,代码来源:init.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ rtems_fatal_error_occurred函数代码示例发布时间:2022-05-30
下一篇:
C++ rtems_clock_get_ticks_per_second函数代码示例发布时间: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