pub fn memory_read_32(
        &mut self,
        address: u32,
        data: &mut [u8],
    ) -> io::Result<()> {
        const MEMORY_READ_LEN: usize = 6;
        if let Family::CC2538 = self.family {
            panic!("32-bit memory accesses are only allowed on CC26xx");
        }

        assert!(
            data.len() <= (63 * 4),
            "only a maximum of 63 accesses can be done on word mode"
        );
        assert!(
            data.len() % 4 == 0,
            "number of bytes is not divisible from 4"
        );
        assert!(
            (address & 0x03) == 0,
            "memory address must be 32-bits aligned"
        );

        log::trace!(
            "memory_read_32 `{}` elements at start address `{:#X}`",
            data.len() / 4,
            address
        );

        let mut cmd = [0u8; MEMORY_READ_LEN];
        (&mut cmd[..4]).copy_from_slice(&address.to_be_bytes()); /* address */
        cmd[4] = 1; /* access type */
        cmd[5] = (data.len() / 4) as u8; /* number of accesses */
        self.write_cmd(constants::CMD_MEMORY_READ, &cmd)?;
        let ack = self.read_ack()?;
        if !ack {
            return Err(io::Error::new(
                io::ErrorKind::Other,
                "failed to read memory",
            ));
        }

        self.read_response(data)?;
        self.write_ack(true)?;

        Ok(())
    }
/// Read memory using 32-bit access type.
///
/// # Parameters
///
/// - `address`: the memory address to read. Must be aligned to 32-bits.
/// - `data`: where the data will be stored. Can't be higher than `63 * 4`
/// bytes. The number of bytes MUST be exactly divisible by 4.
///
/// # Panics
///
/// - This function will panic if the length of the `data` slice
/// is higher than `63 * 4` bytes, this is the maximum number of accesses
/// that can be done using this mode.
/// - This function will panic if the `address` is not aligned to 32-bits.
Read memory using 32-bit access type.
Read memory using 32 - bit access type .
pub fn memory_read_32(
        &mut self,
        address: u32,
        data: &mut [u8],
    ) -> io::Result<()> {
        const MEMORY_READ_LEN: usize = 6;
        if let Family::CC2538 = self.family {
            panic!("32-bit memory accesses are only allowed on CC26xx");
        }
        assert!(
            data.len() <= (63 * 4),
            "only a maximum of 63 accesses can be done on word mode"
        );
        assert!(
            data.len() % 4 == 0,
            "number of bytes is not divisible from 4"
        );
        assert!(
            (address & 0x03) == 0,
            "memory address must be 32-bits aligned"
        );
        log::trace!(
            "memory_read_32 `{}` elements at start address `{:#X}`",
            data.len() / 4,
            address
        );
        let mut cmd = [0u8; MEMORY_READ_LEN];
        (&mut cmd[..4]).copy_from_slice(&address.to_be_bytes()); /* address */
        cmd[4] = 1; /* access type */
        cmd[5] = (data.len() / 4) as u8; /* number of accesses */
        self.write_cmd(constants::CMD_MEMORY_READ, &cmd)?;
        let ack = self.read_ack()?;
        if !ack {
            return Err(io::Error::new(
                io::ErrorKind::Other,
                "failed to read memory",
            ));
        }
        self.read_response(data)?;
        self.write_ack(true)?;
        Ok(())
    }
pub fn memory_read_32 ( & mut self , address : u32 , data : & mut [ u8 ] , ) -> io :: Result < ( ) > { const MEMORY_READ_LEN : usize = 6 ; if let Family :: CC2538 = self . family { panic ! ( " " ) ; } assert ! ( data len ( ) ( 63 4 ) " " ) ; assert ! ( data len ( ) 4 0 " " ) ; assert ! ( ( address 0x03 ) 0 " " ) ; log :: trace ! ( " " data len ( ) 4 address ) ; let mut cmd = [ 0u8 ; MEMORY_READ_LEN ] ; ( & mut cmd [ .. 4 ] ) . copy_from_slice ( & address . to_be_bytes ( ) ) ; /* address */ cmd [ 4 ] = 1 ; /* access type */ cmd [ 5 ] = ( data . len ( ) / 4 ) as u8 ; /* number of accesses */ self . write_cmd ( constants :: CMD_MEMORY_READ , & cmd ) ? ; let ack = self . read_ack ( ) ? ; if ! ack { return Err ( io :: Error :: new ( io :: ErrorKind :: Other , " " , ) ) ; } self . read_response ( data ) ? ; self . write_ack ( true ) ? ; Ok ( ( ) ) }
Read memory using 32-bit access type.
Read memory using 32 - bit access type .
&mut self
address
u32
data
&mut [u8]
&mut self
address
u32
the memory address to read. Must be aligned to 32-bits.
the memory address to read . Must be aligned to 32 - bits .
data
&mut [u8]
None
panics
This function will panic if the length of the `data` slice
is higher than `63 * 4` bytes, this is the maximum number of accesses
that can be done using this mode.
This function will panic if the `address` is not aligned to 32-bits.
This function will panic if the length of the ` data ` slice is higher than ` 63 * 4 ` bytes this is the maximum number of accesses that can be done using this mode . This function will panic if the ` address ` is not aligned to 32 - bits .