Struct devices::pci::ac97_bus_master::Ac97BusMaster
source · pub struct Ac97BusMaster {
mem: GuestMemory,
regs: Arc<Mutex<Ac97BusMasterRegs>>,
acc_sema: u8,
po_info: AudioThreadInfo,
pi_info: AudioThreadInfo,
pmic_info: AudioThreadInfo,
audio_server: Box<dyn ShmStreamSource<Error>>,
irq_resample_thread: Option<JoinHandle<()>>,
sys: Ac97BusMasterSys,
}
Expand description
Ac97BusMaster
emulates the bus master portion of AC97. It exposes a register read/write
interface compliant with the ICH bus master.
Fields§
§mem: GuestMemory
§regs: Arc<Mutex<Ac97BusMasterRegs>>
§acc_sema: u8
§po_info: AudioThreadInfo
§pi_info: AudioThreadInfo
§pmic_info: AudioThreadInfo
§audio_server: Box<dyn ShmStreamSource<Error>>
§irq_resample_thread: Option<JoinHandle<()>>
§sys: Ac97BusMasterSys
Implementations§
source§impl Ac97BusMaster
impl Ac97BusMaster
sourcepub(crate) fn new(
mem: GuestMemory,
audio_server: Box<dyn ShmStreamSource<Error>>
) -> Self
pub(crate) fn new(
mem: GuestMemory,
audio_server: Box<dyn ShmStreamSource<Error>>
) -> Self
Creates an Ac97BusMasterobject that plays audio from
memto streams provided by
audio_server`.
sourcepub fn keep_rds(&self) -> Option<Vec<RawDescriptor>>
pub fn keep_rds(&self) -> Option<Vec<RawDescriptor>>
Returns any file descriptors that need to be kept open when entering a jail.
pub(in pci::ac97_bus_master) fn check_and_move_to_next_buffer(
func_regs: &mut Ac97FunctionRegs
)
pub(in pci::ac97_bus_master) fn thread_semaphore_notify(
&self,
func: Ac97Function
)
fn stream_effects(func: Ac97Function) -> Vec<StreamEffect> ⓘ
fn create_audio_worker(
&mut self,
mixer: &Ac97Mixer,
func: Ac97Function
) -> Result<AudioWorker, AudioError>
pub(in pci::ac97_bus_master) fn start_audio(
&mut self,
func: Ac97Function,
mixer: &Ac97Mixer
) -> Result<(), AudioError>
source§impl Ac97BusMaster
impl Ac97BusMaster
sourcepub fn set_irq_event(&mut self, irq_evt: IrqLevelEvent)
pub fn set_irq_event(&mut self, irq_evt: IrqLevelEvent)
Provides the events needed to raise interrupts in the guest.
sourcepub fn update_mixer_settings(&mut self, mixer: &Ac97Mixer)
pub fn update_mixer_settings(&mut self, mixer: &Ac97Mixer)
Called when mixer
has been changed and the new values should be applied to currently
active streams.
sourcepub fn is_cold_reset(&self) -> bool
pub fn is_cold_reset(&self) -> bool
Checks if the bus master is in the cold reset state.
sourcepub fn readw(&mut self, offset: u64, mixer: &Ac97Mixer) -> u16
pub fn readw(&mut self, offset: u64, mixer: &Ac97Mixer) -> u16
Reads a word from the given offset
.
sourcepub fn writeb(&mut self, offset: u64, val: u8, mixer: &Ac97Mixer)
pub fn writeb(&mut self, offset: u64, val: u8, mixer: &Ac97Mixer)
Writes the byte val
to the register specified by offset
.
sourcepub fn writew(&mut self, offset: u64, val: u16)
pub fn writew(&mut self, offset: u64, val: u16)
Writes the word val
to the register specified by offset
.
sourcepub fn writel(&mut self, offset: u64, val: u32, mixer: &mut Ac97Mixer)
pub fn writel(&mut self, offset: u64, val: u32, mixer: &mut Ac97Mixer)
Writes the 32-bit val
to the register specified by offset
.
fn set_bdbar(&mut self, func: Ac97Function, val: u32)
fn set_lvi(&mut self, func: Ac97Function, val: u8)
fn set_sr(&mut self, func: Ac97Function, val: u16)
fn set_cr(&mut self, func: Ac97Function, val: u8, mixer: &Ac97Mixer)
fn set_glob_cnt(&mut self, new_glob_cnt: u32, mixer: &mut Ac97Mixer)
fn current_sample_rate(&self, func: Ac97Function, mixer: &Ac97Mixer) -> u32
fn thread_info(&self, func: Ac97Function) -> &AudioThreadInfo
fn thread_info_mut(&mut self, func: Ac97Function) -> &mut AudioThreadInfo
fn is_audio_running(&self) -> bool
fn stop_all_audio(&mut self)
fn reset_func_regs(regs: &mut Ac97BusMasterRegs, func: Ac97Function)
fn reset_audio_regs(&mut self)
Auto Trait Implementations§
impl !RefUnwindSafe for Ac97BusMaster
impl Send for Ac97BusMaster
impl !Sync for Ac97BusMaster
impl Unpin for Ac97BusMaster
impl !UnwindSafe for Ac97BusMaster
Blanket Implementations§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.