dds: inline

close #407
This commit is contained in:
Robert Jördens 2021-07-28 07:37:35 +00:00
parent bf0afc8a88
commit 1787daacaa
2 changed files with 4 additions and 0 deletions

View File

@ -562,6 +562,7 @@ impl ProfileSerializer {
/// * `acr` - If provided, indicates the amplitude control register for the channels. The ACR /// * `acr` - If provided, indicates the amplitude control register for the channels. The ACR
/// should be stored in the 3 LSB of the word. Note that if amplitude scaling is to be used, /// should be stored in the 3 LSB of the word. Note that if amplitude scaling is to be used,
/// the "Amplitude multiplier enable" bit must be set. /// the "Amplitude multiplier enable" bit must be set.
#[inline]
pub fn update_channels( pub fn update_channels(
&mut self, &mut self,
channels: &[Channel], channels: &[Channel],
@ -597,6 +598,7 @@ impl ProfileSerializer {
self.index += value.len() + 1; self.index += value.len() + 1;
} }
#[inline]
fn pad(&mut self) { fn pad(&mut self) {
// Pad the buffer to 32-bit (4 byte) alignment by adding dummy writes to CSR and LSRR. // Pad the buffer to 32-bit (4 byte) alignment by adding dummy writes to CSR and LSRR.
match self.index & 3 { match self.index & 3 {
@ -621,6 +623,7 @@ impl ProfileSerializer {
/// ///
/// # Returns /// # Returns
/// A slice of `u32` words representing the serialized profile. /// A slice of `u32` words representing the serialized profile.
#[inline]
pub fn finalize<'a>(&'a mut self) -> &'a [u32] { pub fn finalize<'a>(&'a mut self) -> &'a [u32] {
self.pad(); self.pad();
unsafe { unsafe {

View File

@ -162,6 +162,7 @@ impl<'a> ProfileBuilder<'a> {
/// Write the profile to the DDS asynchronously. /// Write the profile to the DDS asynchronously.
#[allow(dead_code)] #[allow(dead_code)]
#[inline]
pub fn write_profile(mut self) { pub fn write_profile(mut self) {
let profile = self.serializer.finalize(); let profile = self.serializer.finalize();
self.dds_output.write_profile(profile); self.dds_output.write_profile(profile);