PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches
driver.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <pbl/device.h>
#include <pbl/drivers/audio.h>
#include <pbl/kernel/mutex.h>
#include <pbl/util/bits.h>

Data Structures

struct  pbl_audio_dai_ops
 DAI driver operations. More...
 
struct  pbl_audio_codec_cfg
 Codec configuration for a stream. More...
 
struct  pbl_audio_codec_ops
 Codec driver operations, called with the lock of the card held. More...
 
struct  pbl_audio_codec
 A codec: a separate chip converting between the link and the analog side. More...
 
struct  pbl_audio_amp_ops
 Amplifier driver operations, called with the lock of the card held. More...
 
struct  pbl_audio_amp
 An amplifier between the output and the speaker, on while playing. More...
 
struct  pbl_audio_dai
 A digital audio interface of the SoC, streaming one direction or both. More...
 
struct  pbl_audio
 An audio device: a card, a DAI and what it is wired to, streaming both directions. More...
 

Macros

#define PBL_AUDIO_CODEC_INIT(sym, _name, _init, _parent, _ops)
 Initializer of a struct pbl_audio_codec.
 
#define PBL_AUDIO_AMP_INIT(sym, _name, _init, _parent, _ops)
 Initializer of a struct pbl_audio_amp.
 
#define PBL_AUDIO_DAI_STATE_DEFINE(sym)
 Define the class state of a DAI.
 
#define PBL_AUDIO_DAI_INIT(sym, _name, _parent, _ops)
 Initializer for a struct pbl_audio_dai.
 
#define PBL_AUDIO_CARD_DEFINE(sym, _name, _dai, _codec, _amp, _fmt, _clocks)
 Define a card.
 
Link formats

Flags of struct pbl_audio_link::fmt.

#define PBL_AUDIO_FMT_I2S   PBL_BIT(0)
 I2S framing.
 
#define PBL_AUDIO_FMT_CODEC_MASTER   PBL_BIT(1)
 The codec drives the bit and frame clocks.
 
#define PBL_AUDIO_FMT_PDM   PBL_BIT(2)
 PDM: the 1-bit stream of digital microphones.
 

Functions

static const struct pbl_audio * pbl_audio_dai_card (const struct pbl_audio_dai *dai)
 Get the card of a DAI, for drivers.
 
void pbl_audio_period_elapsed (const struct pbl_audio *audio, enum pbl_audio_dir dir)
 Report the end of the period the hardware was working on.
 
void pbl_audio_report_xrun (const struct pbl_audio *audio, enum pbl_audio_dir dir)
 Report a hardware overrun or underrun, flagged in the next callback.
 
void * pbl_audio_period (const struct pbl_audio *audio, enum pbl_audio_dir dir, uint8_t idx)
 Get a period of a running stream, for drivers.
 
static const struct pbl_audio_stream * pbl_audio_stream (const struct pbl_audio *audio, enum pbl_audio_dir dir)
 Get a running stream, for drivers.
 
static int32_t pbl_audio_gain_to_step (int32_t gain_mdb, int32_t min_mdb, int32_t step_mdb)
 Convert a gain in mdB to the register steps of a hardware gain stage.