Audio devices of the emulators.
More...
Audio devices of the emulators.
The QEMU audio device plays mono through the host. The host microphone records mono audio the host sends over the QEMU channel, and silence when it sends none, paced by a timer; it also runs on native builds.
#define PBL_AUDIO_QEMU_DEFINE(sym, _name, _base, _irq)
Define the QEMU audio device, a playback device.
Definition qemu.h:62
#define PBL_AUDIO_HOST_MIC_DEFINE(sym, _name)
Define the host microphone, a capture device.
Definition qemu.h:110
void pbl_audio_qemu_irq_handler(const struct pbl_audio_qemu *dev)
QEMU audio device interrupt handler, to connect with PBL_IRQ_CONNECT().
#define PBL_IRQN(line)
Number of a SoC interrupt line from soc_irqs.h.
Definition irq.h:93
#define PBL_IRQ_CONNECT(line, prio, isr, arg, flags)
Bind a SoC interrupt line to a handler at build time.
Definition irq.h:117
◆ pbl_audio_qemu
| Data Fields |
|
struct pbl_audio |
audio |
Audio device. |
|
uintptr_t |
base |
Base address of the registers. |
|
pbl_irq_t |
irq |
Interrupt. |
|
struct pbl_audio_qemu_state * |
state |
Driver runtime state. |
◆ pbl_audio_host_mic
| struct pbl_audio_host_mic |
| Data Fields |
|
struct pbl_audio |
audio |
Audio device. |
|
struct pbl_audio_host_mic_state * |
state |
Driver runtime state. |
◆ PBL_AUDIO_HOST_MIC_DEFINE
| #define PBL_AUDIO_HOST_MIC_DEFINE |
( |
|
sym, |
|
|
|
_name |
|
) |
| |
Value:
static struct pbl_audio_host_mic_state sym##_host_mic_state; \
PBL_AUDIO_INIT(sym, _name,
PBL_AUDIO_CAPTURE, &pbl_audio_host_mic_ops,
nullptr,
nullptr), \
.
state = &sym##_host_mic_state, \
}; \
PBL_DEVICE_REGISTER(sym, &sym.
audio.
dev)
struct pbl_audio audio
Audio device.
Definition qemu.h:95
Host microphone.
Definition qemu.h:93
struct pbl_audio_state * state
Runtime state.
Definition audio.h:308
struct pbl_device dev
Device.
Definition audio.h:304
#define PBL_AUDIO_STATE_DEFINE(sym)
Define the class state of an audio device.
Definition audio.h:331
@ PBL_AUDIO_CAPTURE
From the hardware to memory.
Definition audio.h:90
Define the host microphone, a capture device.
- Parameters
-
| sym | Symbol of the device. |
| _name | Device name. |
◆ PBL_AUDIO_QEMU_DEFINE
| #define PBL_AUDIO_QEMU_DEFINE |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_base, |
|
|
|
_irq |
|
) |
| |
Value:
static struct pbl_audio_qemu_state sym##_qemu_state; \
.base = (_base), \
.
state = &sym##_qemu_state, \
}; \
PBL_DEVICE_REGISTER(sym, &sym.
audio.
dev)
struct pbl_audio audio
Audio device.
Definition qemu.h:41
pbl_irq_t irq
Interrupt.
Definition qemu.h:45
QEMU audio device.
Definition qemu.h:39
@ PBL_AUDIO_PLAYBACK
From memory to the hardware.
Definition audio.h:88
Define the QEMU audio device, a playback device.
- Parameters
-
| sym | Symbol of the device. |
| _name | Device name. |
| _base | Base address of the registers. |
| _irq | Interrupt; the board connects pbl_audio_qemu_irq_handler() to it. |
◆ pbl_audio_qemu_irq_handler()
◆ qemu_mic_msg_callback()
| void qemu_mic_msg_callback |
( |
const uint8_t * |
data, |
|
|
uint32_t |
len |
|
) |
| |
Handle a QemuProtocol_MicAudio message from the host.
Queues the samples for the recording host microphone, dropping the oldest once the queue is full. Ignored while it is not recording.
- Parameters
-
| data | 16 kHz mono signed 16-bit little-endian PCM. |
| len | Length of data in bytes. |