Struct maia_httpd::fpga::IpCore
source · pub struct IpCore { /* private fields */ }
Expand description
Maia SDR FPGA IP core.
This struct represents the FPGA IP core and gives access to its registers and DMA buffers.
Implementations§
source§impl IpCore
impl IpCore
sourcepub async fn take() -> Result<(IpCore, InterruptHandler)>
pub async fn take() -> Result<(IpCore, InterruptHandler)>
Opens the FPGA IP core.
This function can only be run successfully once in the lifetime of the
process. If this function has returned Ok
previously, all subsequent
calls will return Err
. This ensures that there is only a single
IpCore
object in the program.
On success, the IpCore
and the corresponding InterruptHandler
are
returned.
sourcepub fn spectrometer_last_buffer(&self) -> usize
pub fn spectrometer_last_buffer(&self) -> usize
Gives the value of the last buffer register of the spectrometer.
This register indicates the index of the last buffer to which the spectrometer has written.
sourcepub fn spectrometer_number_integrations(&self) -> u32
pub fn spectrometer_number_integrations(&self) -> u32
Gives the value of the number of integrations register of the spectrometer.
This register indicates how many FFTs are non-coherently accumulated by the spectrometer.
Note: IpCore
caches in RAM the value of this register every time
that it is updated, so calls to this function are very fast because the
FPGA register doesn’t need to be accessed.
sourcepub fn spectrometer_mode(&self) -> SpectrometerMode
pub fn spectrometer_mode(&self) -> SpectrometerMode
Returns the current spectrometer mode.
This register indicates whether the spectrometer is running in average power mode or in peak detect mode.
Note: IpCore
caches in RAM the value of this register every time
that it is updated, so calls to this function are very fast because the
FPGA register doesn’t need to be accessed.
sourcepub fn set_spectrometer_number_integrations(&self, value: u32) -> Result<()>
pub fn set_spectrometer_number_integrations(&self, value: u32) -> Result<()>
Sets the value of the number of integrations register of the spectrometer.
sourcepub fn set_spectrometer_mode(&self, mode: SpectrometerMode)
pub fn set_spectrometer_mode(&self, mode: SpectrometerMode)
Sets the spectrometer mode.
sourcepub fn get_spectrometer_buffers(&mut self) -> impl Iterator<Item = &[u64]>
pub fn get_spectrometer_buffers(&mut self) -> impl Iterator<Item = &[u64]>
Returns the new buffers that have been written by the spectrometer.
This function returns an iterator that iterates over the buffers to
which the spectrometter has written since the last call to
get_spectrometer_buffers
.
sourcepub fn recorder_mode(&self) -> RecorderMode
pub fn recorder_mode(&self) -> RecorderMode
Gives the value of the recorder mode register of the recorder.
This register is used to select 8-bit mode or 12-bit mode.
sourcepub fn set_recorder_mode(&self, mode: RecorderMode)
pub fn set_recorder_mode(&self, mode: RecorderMode)
Sets the value of the recorder mode register of the recorder.
sourcepub fn recorder_start(&self)
pub fn recorder_start(&self)
Starts a recording.
The recording will end when the recording DMA buffer is exhausted or
when IpCore::recorder_stop
is called.
sourcepub fn recorder_stop(&self)
pub fn recorder_stop(&self)
Stops a recording.
This stops a currently running recording.
sourcepub fn recorder_next_address(&self) -> usize
pub fn recorder_next_address(&self) -> usize
Gives the value of the next address register of the recorder.
This register indicates the next physical address to which the recorder would have written if it had not stopped. It can be used to calculate the size of the recording.