fn send_data_dma(&self, dmac: &DMAC, channel_num: dma_channel, chip_select: u32, tx: &[u32]) {
        unsafe {
            self.spi.dmacr.write(|w| w.bits(0x2));    /*enable dma transmit*/
            self.spi.ssienr.write(|w| w.bits(0x01));

            sysctl::dma_select(channel_num, IF::DMA_TX);
            dmac.set_single_mode(channel_num, tx.as_ptr() as u64, self.spi.dr.as_ptr() as u64,
                                 address_increment::INCREMENT, address_increment::NOCHANGE,
                                 burst_length::LENGTH_4, transfer_width::WIDTH_32, tx.len() as u32);
            self.spi.ser.write(|w| w.bits(1 << chip_select));
            dmac.wait_done(channel_num);

            while (self.spi.sr.read().bits() & 0x05) != 0x04 {
                // IDLE
            }
            self.spi.ser.write(|w| w.bits(0x00));
            self.spi.ssienr.write(|w| w.bits(0x00));
        }
    }
/// Send 32-bit data using DMA.
/// If you want to use this function to send 8-bit or 16-bit data, you need to wrap each
/// data unit in a 32-bit word.
/// This is intentionally left to the caller: the difficulty here is to avoid the need for alloc/freeing()
/// buffers every time as the SDK does because this is highly undesirable!
Send 32-bit data using DMA.
If you want to use this function to send 8-bit or 16-bit data, you need to wrap each
data unit in a 32-bit word.
This is intentionally left to the caller: the difficulty here is to avoid the need for alloc/freeing()
buffers every time as the SDK does because this is highly undesirable!
Send 32 - bit data using DMA . If you want to use this function to send 8 - bit or 16 - bit data you need to wrap each data unit in a 32 - bit word . This is intentionally left to the caller : the difficulty here is to avoid the need for alloc / freeing () buffers every time as the SDK does because this is highly undesirable!
fn send_data_dma(&self, dmac: &DMAC, channel_num: dma_channel, chip_select: u32, tx: &[u32]) {
        unsafe {
            self.spi.dmacr.write(|w| w.bits(0x2));    /*enable dma transmit*/
            self.spi.ssienr.write(|w| w.bits(0x01));
            sysctl::dma_select(channel_num, IF::DMA_TX);
            dmac.set_single_mode(channel_num, tx.as_ptr() as u64, self.spi.dr.as_ptr() as u64,
                                 address_increment::INCREMENT, address_increment::NOCHANGE,
                                 burst_length::LENGTH_4, transfer_width::WIDTH_32, tx.len() as u32);
            self.spi.ser.write(|w| w.bits(1 << chip_select));
            dmac.wait_done(channel_num);
            while (self.spi.sr.read().bits() & 0x05) != 0x04 {
                // IDLE
            }
            self.spi.ser.write(|w| w.bits(0x00));
            self.spi.ssienr.write(|w| w.bits(0x00));
        }
    }
fn send_data_dma ( & self , dmac : & DMAC , channel_num : dma_channel , chip_select : u32 , tx : & [ u32 ] ) { unsafe { self . spi . dmacr . write ( | w | w . bits ( 0x2 ) ) ; /*enable dma transmit*/ self . spi . ssienr . write ( | w | w . bits ( 0x01 ) ) ; sysctl :: dma_select ( channel_num , IF :: DMA_TX ) ; dmac . set_single_mode ( channel_num , tx . as_ptr ( ) as u64 , self . spi . dr . as_ptr ( ) as u64 , address_increment :: INCREMENT , address_increment :: NOCHANGE , burst_length :: LENGTH_4 , transfer_width :: WIDTH_32 , tx . len ( ) as u32 ) ; self . spi . ser . write ( | w | w . bits ( 1 << chip_select ) ) ; dmac . wait_done ( channel_num ) ; while ( self . spi . sr . read ( ) . bits ( ) & 0x05 ) != 0x04 { // IDLE } self . spi . ser . write ( | w | w . bits ( 0x00 ) ) ; self . spi . ssienr . write ( | w | w . bits ( 0x00 ) ) ; } }
Send 32-bit data using DMA.
Send 32 - bit data using DMA .
&self
dmac
&DMAC
channel_num
dma_channel
chip_select
u32
tx
&[u32]
&self
dmac
&DMAC
channel_num
dma_channel
chip_select
u32
tx
&[u32]