Пример #1
0
static void audio_callback(FAR void *handle, uint16_t reason,
        FAR struct ap_buffer_s *apb, uint16_t status)
{
  FAR struct audio_upperhalf_s *upper = (FAR struct audio_upperhalf_s *)handle;

  audllvdbg("Entry\n");

  /* Perform operation based on reason code */

  switch (reason)
    {
      case AUDIO_CALLBACK_DEQUEUE:
        {
          /* Call the dequeue routine */

          audio_dequeuebuffer(upper, apb, status);
          break;
        }

      case AUDIO_CALLBACK_IOERR:
        {
        }
        break;

      default:
        {
          auddbg("Unknown callback reason code %d\n", reason);
          break;
        }
    }
}
Пример #2
0
static inline void audio_dequeuebuffer(FAR struct audio_upperhalf_s *upper,
                    FAR struct ap_buffer_s *apb, uint16_t status)
{
  audllvdbg("Entry\n");

  /* TODO:  Implement the logic */

}
Пример #3
0
static void audio_callback(FAR void *handle, uint16_t reason,
        FAR struct ap_buffer_s *apb, uint16_t status)
#endif
{
  FAR struct audio_upperhalf_s *upper = (FAR struct audio_upperhalf_s *)handle;

  audllvdbg("Entry\n");

  /* Perform operation based on reason code */

  switch (reason)
    {
      case AUDIO_CALLBACK_DEQUEUE:
        {
          /* Call the dequeue routine */

#ifdef CONFIG_AUDIO_MULTI_SESSION
          audio_dequeuebuffer(upper, apb, status, session);
#else
          audio_dequeuebuffer(upper, apb, status);
#endif
          break;
        }

      /* Lower-half I/O error occurred */

      case AUDIO_CALLBACK_IOERR:
        {
        }
        break;

      /* Lower-half driver has completed a playback */

      case AUDIO_CALLBACK_COMPLETE:
        {
          /* Send a complete message to the user if a message queue is registered */

#ifdef CONFIG_AUDIO_MULTI_SESSION
          audio_complete(upper, apb, status, session);
#else
          audio_complete(upper, apb, status);
#endif
        }
        break;

      default:
        {
          auddbg("Unknown callback reason code %d\n", reason);
          break;
        }
    }
}
Пример #4
0
static inline void audio_complete(FAR struct audio_upperhalf_s *upper,
                    FAR struct ap_buffer_s *apb, uint16_t status)
#endif
{
  struct audio_msg_s    msg;

  audllvdbg("Entry\n");

  /* Send a dequeue message to the user if a message queue is registered */

  upper->started = false;
  if (upper->usermq != NULL)
    {
      msg.msgId = AUDIO_MSG_COMPLETE;
      msg.u.pPtr = NULL;
#ifdef CONFIG_AUDIO_MULTI_SESSION
      msg.session = session;
#endif
      mq_send(upper->usermq, &msg, sizeof(msg),
              CONFIG_AUDIO_BUFFER_DEQUEUE_PRIO);
    }
}
Пример #5
0
static inline void audio_dequeuebuffer(FAR struct audio_upperhalf_s *upper,
                    FAR struct ap_buffer_s *apb, uint16_t status)
#endif
{
  struct audio_msg_s    msg;

  audllvdbg("Entry\n");

  /* Send a dequeue message to the user if a message queue is registered */

  if (upper->usermq != NULL)
    {
      msg.msgId = AUDIO_MSG_DEQUEUE;
      msg.u.pPtr = apb;
#ifdef CONFIG_AUDIO_MULTI_SESSION
      msg.session = session;
#endif
      apb->flags |= AUDIO_APB_DEQUEUED;
      mq_send(upper->usermq, &msg, sizeof(msg),
              CONFIG_AUDIO_BUFFER_DEQUEUE_PRIO);
    }
}