audio/audio.c: Add message type to support audio trigger.
This commit is contained in:
parent
eb0d0c764e
commit
9e3bafc7c6
@ -760,6 +760,39 @@ static inline void audio_complete(FAR struct audio_upperhalf_s *upper,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: audio_message
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Send an custom message to the client to indicate that the
|
||||||
|
* active message has delivered. The lower-half driver initiates this
|
||||||
|
* call via its callback pointer to our upper-half driver.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_AUDIO_MULTI_SESSION
|
||||||
|
static inline void audio_message(FAR struct audio_upperhalf_s *upper,
|
||||||
|
FAR struct ap_buffer_s *apb, uint16_t status,
|
||||||
|
FAR void *session)
|
||||||
|
#else
|
||||||
|
static inline void audio_message(FAR struct audio_upperhalf_s *upper,
|
||||||
|
FAR struct ap_buffer_s *apb, uint16_t status)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
struct audio_msg_s *msg = (FAR struct audio_msg_s *)apb;
|
||||||
|
|
||||||
|
/* Send a message to the user if a message queue is registered */
|
||||||
|
|
||||||
|
if (upper->usermq != NULL)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_AUDIO_MULTI_SESSION
|
||||||
|
msg.session = session;
|
||||||
|
#endif
|
||||||
|
(void)nxmq_send(upper->usermq, (FAR const char *)msg, sizeof(*msg),
|
||||||
|
CONFIG_AUDIO_BUFFER_DEQUEUE_PRIO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: audio_callback
|
* Name: audio_callback
|
||||||
*
|
*
|
||||||
@ -831,6 +864,16 @@ static void audio_callback(FAR void *handle, uint16_t reason,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AUDIO_CALLBACK_MESSAGE:
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_AUDIO_MULTI_SESSION
|
||||||
|
audio_message(upper, apb, status, session);
|
||||||
|
#else
|
||||||
|
audio_message(upper, apb, status);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
auderr("ERROR: Unknown callback reason code %d\n", reason);
|
auderr("ERROR: Unknown callback reason code %d\n", reason);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/audio/audio.h
|
* include/nuttx/audio/audio.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2017, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Copyright (C) 2013 Ken Pettit. All rights reserved.
|
* Copyright (C) 2013 Ken Pettit. All rights reserved.
|
||||||
* Author: Ken Pettit <pettitkd@gmail.com>
|
* Author: Ken Pettit <pettitkd@gmail.com>
|
||||||
*
|
*
|
||||||
@ -283,6 +283,7 @@
|
|||||||
/* Extension Unit controls **************************************************/
|
/* Extension Unit controls **************************************************/
|
||||||
|
|
||||||
#define AUDIO_EU_HW_FORMAT 0x0001
|
#define AUDIO_EU_HW_FORMAT 0x0001
|
||||||
|
#define AUDIO_EU_LOAD_MODULE 0x0002
|
||||||
|
|
||||||
/* Audio Callback Reasons ***************************************************/
|
/* Audio Callback Reasons ***************************************************/
|
||||||
|
|
||||||
@ -290,6 +291,7 @@
|
|||||||
#define AUDIO_CALLBACK_DEQUEUE 0x01
|
#define AUDIO_CALLBACK_DEQUEUE 0x01
|
||||||
#define AUDIO_CALLBACK_IOERR 0x02
|
#define AUDIO_CALLBACK_IOERR 0x02
|
||||||
#define AUDIO_CALLBACK_COMPLETE 0x03
|
#define AUDIO_CALLBACK_COMPLETE 0x03
|
||||||
|
#define AUDIO_CALLBACK_MESSAGE 0x04
|
||||||
|
|
||||||
/* Audio Pipeline Buffer (AP Buffer) flags **********************************/
|
/* Audio Pipeline Buffer (AP Buffer) flags **********************************/
|
||||||
|
|
||||||
@ -316,6 +318,9 @@
|
|||||||
#define AUDIO_MSG_DATA_REQUEST 6
|
#define AUDIO_MSG_DATA_REQUEST 6
|
||||||
#define AUDIO_MSG_ENQUEUE 7
|
#define AUDIO_MSG_ENQUEUE 7
|
||||||
#define AUDIO_MSG_COMPLETE 8
|
#define AUDIO_MSG_COMPLETE 8
|
||||||
|
#define AUDIO_MSG_WAKEUP 9
|
||||||
|
#define AUDIO_MSG_COMMAND 10
|
||||||
|
#define AUDIO_MSG_SLIENCE 11
|
||||||
#define AUDIO_MSG_USER 64
|
#define AUDIO_MSG_USER 64
|
||||||
|
|
||||||
/* Audio Pipeline Buffer flags */
|
/* Audio Pipeline Buffer flags */
|
||||||
@ -357,6 +362,9 @@ struct audio_caps_s
|
|||||||
uint8_t b[4]; /* by this lower-half driver. */
|
uint8_t b[4]; /* by this lower-half driver. */
|
||||||
uint16_t hw[2];
|
uint16_t hw[2];
|
||||||
uint32_t w;
|
uint32_t w;
|
||||||
|
ifdef CONFIG_HAVE_LONG_LONG
|
||||||
|
uint64_t qw;
|
||||||
|
endif
|
||||||
} ac_controls;
|
} ac_controls;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user