コード例 #1
0
ファイル: igmp_poll.c プロジェクト: FreddieChopin/NuttX
void igmp_poll(FAR struct net_driver_s *dev)
{
  FAR struct igmp_group_s *group;

  nllvdbg("Entry\n");

  /* Setup the poll operation */

  dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPIGMP_HDRLEN];
  dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPIGMP_HDRLEN];

  dev->d_len     = 0;
  dev->d_sndlen  = 0;

  /* Check each member of the group */

  for (group = (FAR struct igmp_group_s *)dev->grplist.head;
       group;
       group = group->next)
    {
      /* Does this member have a pending outgoing message? */

      if (IS_SCHEDMSG(group->flags))
        {
          /* Yes, create the IGMP message in the driver buffer */

          igmp_sched_send(dev, group);

          /* Mark the message as sent and break out */

          CLR_SCHEDMSG(group->flags);
          break;
        }
    }
}
コード例 #2
0
ファイル: igmp_msg.c プロジェクト: justdoitding/Nuttx_PSoC4
void igmp_waitmsg(FAR struct igmp_group_s *group, uint8_t msgid)
{
  net_lock_t flags;

  /* Schedule to send the message */

  flags = net_lock();
  DEBUGASSERT(!IS_WAITMSG(group->flags));
  SET_WAITMSG(group->flags);
  igmp_schedmsg(group, msgid);

  /* Then wait for the message to be sent */

  while (IS_SCHEDMSG(group->flags))
    {
      /* Wait for the semaphore to be posted */

      while (net_lockedwait(&group->sem) != 0)
        {
          /* The only error that should occur from net_lockedwait() is if
           * the wait is awakened by a signal.
           */

          ASSERT(get_errno() == EINTR);
        }
    }

  /* The message has been sent and we are no longer waiting */

  CLR_WAITMSG(group->flags);
  net_unlock(flags);
}
コード例 #3
0
ファイル: igmp_msg.c プロジェクト: justdoitding/Nuttx_PSoC4
void igmp_schedmsg(FAR struct igmp_group_s *group, uint8_t msgid)
{
  net_lock_t flags;

  /* The following should be atomic */

  flags = net_lock();
  DEBUGASSERT(!IS_SCHEDMSG(group->flags));
  group->msgid = msgid;
  SET_SCHEDMSG(group->flags);
  net_unlock(flags);
}