pub fn transmit(&mut self, bytes: &[u8]) -> Result<(), Error<E>> {
        assert!(bytes.len() <= usize(Self::MAX_FRAME_LENGTH - Self::CRC_SZ));

        self.flush()?;

        let txst = self.txst();

        // work around errata issue 10 by resetting the transmit logic before any every new
        // transmission
        self.bit_field_set(common::Register::ECON1, common::ECON1::mask().txrst())?;
        self.bit_field_clear(common::Register::ECON1, common::ECON1::mask().txrst())?;
        self.bit_field_clear(common::Register::EIR, {
            let mask = common::EIR::mask();
            mask.txerif() | mask.txif()
        })?;

        // NOTE the plus one is to not override the per packet control byte
        let wrpt = txst + 1;

        // 1. ETXST was set during initialization

        // 2. write the frame to the IC memory
        self.write_buffer_memory(Some(wrpt), bytes)?;

        let txnd = wrpt + u16(bytes.len()).unwrap() - 1;

        // 3. Set the end address of the transmit buffer
        self.write_control_register(bank0::Register::ETXNDL, txnd.low())?;
        self.write_control_register(bank0::Register::ETXNDH, txnd.high())?;

        // 4. reset interrupt flag
        self.bit_field_clear(common::Register::EIR, { common::EIR::mask().txif() })?;

        // 5. start transmission
        self.bit_field_set(common::Register::ECON1, common::ECON1::mask().txrts())?;

        // NOTE(volatile) to avoid this value being set *before* the transmission is started
        unsafe { ptr::write_volatile(&mut self.txnd, txnd) }

        Ok(())
    }
/// Starts the transmission of `bytes`
///
/// It's up to the caller to ensure that `bytes` is a valid Ethernet frame. The interface will
/// take care of appending a (4 byte) CRC to the frame and of padding the frame to the minimum
/// size allowed by the Ethernet specification (64 bytes, or 46 bytes of payload).
///
/// NOTE This method will flush any previous transmission that's in progress
///
/// # Panics
///
/// If `bytes` length is greater than 1514, the maximum frame length allowed by the interface.
Starts the transmission of `bytes`
It's up to the caller to ensure that `bytes` is a valid Ethernet frame. The interface will
take care of appending a (4 byte) CRC to the frame and of padding the frame to the minimum
size allowed by the Ethernet specification (64 bytes, or 46 bytes of payload).

NOTE This method will flush any previous transmission that's in progress
Starts the transmission of ` bytes ` It ' s up to the caller to ensure that ` bytes ` is a valid Ethernet frame . The interface will take care of appending a ( 4 byte ) CRC to the frame and of padding the frame to the minimum size allowed by the Ethernet specification ( 64 bytes or 46 bytes of payload ) . NOTE This method will flush any previous transmission that ' s in progress
pub fn transmit(&mut self, bytes: &[u8]) -> Result<(), Error<E>> {
        assert!(bytes.len() <= usize(Self::MAX_FRAME_LENGTH - Self::CRC_SZ));
        self.flush()?;
        let txst = self.txst();
        // work around errata issue 10 by resetting the transmit logic before any every new
        // transmission
        self.bit_field_set(common::Register::ECON1, common::ECON1::mask().txrst())?;
        self.bit_field_clear(common::Register::ECON1, common::ECON1::mask().txrst())?;
        self.bit_field_clear(common::Register::EIR, {
            let mask = common::EIR::mask();
            mask.txerif() | mask.txif()
        })?;
        // NOTE the plus one is to not override the per packet control byte
        let wrpt = txst + 1;
        // 1. ETXST was set during initialization
        // 2. write the frame to the IC memory
        self.write_buffer_memory(Some(wrpt), bytes)?;
        let txnd = wrpt + u16(bytes.len()).unwrap() - 1;
        // 3. Set the end address of the transmit buffer
        self.write_control_register(bank0::Register::ETXNDL, txnd.low())?;
        self.write_control_register(bank0::Register::ETXNDH, txnd.high())?;
        // 4. reset interrupt flag
        self.bit_field_clear(common::Register::EIR, { common::EIR::mask().txif() })?;
        // 5. start transmission
        self.bit_field_set(common::Register::ECON1, common::ECON1::mask().txrts())?;
        // NOTE(volatile) to avoid this value being set *before* the transmission is started
        unsafe { ptr::write_volatile(&mut self.txnd, txnd) }
        Ok(())
    }
pub fn transmit ( & mut self , bytes : & [ u8 ] ) -> Result < ( ) , Error < E > > { assert ! ( bytes len ( ) usize ( Self MAX_FRAME_LENGTH Self CRC_SZ ) ) ; self . flush ( ) ? ; let txst = self . txst ( ) ; // work around errata issue 10 by resetting the transmit logic before any every new // transmission self . bit_field_set ( common :: Register :: ECON1 , common :: ECON1 :: mask ( ) . txrst ( ) ) ? ; self . bit_field_clear ( common :: Register :: ECON1 , common :: ECON1 :: mask ( ) . txrst ( ) ) ? ; self . bit_field_clear ( common :: Register :: EIR , { let mask = common :: EIR :: mask ( ) ; mask . txerif ( ) | mask . txif ( ) } ) ? ; // NOTE the plus one is to not override the per packet control byte let wrpt = txst + 1 ; // 1. ETXST was set during initialization // 2. write the frame to the IC memory self . write_buffer_memory ( Some ( wrpt ) , bytes ) ? ; let txnd = wrpt + u16 ( bytes . len ( ) ) . unwrap ( ) - 1 ; // 3. Set the end address of the transmit buffer self . write_control_register ( bank0 :: Register :: ETXNDL , txnd . low ( ) ) ? ; self . write_control_register ( bank0 :: Register :: ETXNDH , txnd . high ( ) ) ? ; // 4. reset interrupt flag self . bit_field_clear ( common :: Register :: EIR , { common :: EIR :: mask ( ) . txif ( ) } ) ? ; // 5. start transmission self . bit_field_set ( common :: Register :: ECON1 , common :: ECON1 :: mask ( ) . txrts ( ) ) ? ; // NOTE(volatile) to avoid this value being set *before* the transmission is started unsafe { ptr :: write_volatile ( & mut self . txnd , txnd ) } Ok ( ( ) ) }
Starts the transmission of `bytes`
It's up to the caller to ensure that `bytes` is a valid Ethernet frame.
Starts the transmission of ` bytes ` It ' s up to the caller to ensure that ` bytes ` is a valid Ethernet frame .
&mut self
bytes
&[u8]
&mut self
bytes
&[u8]
panics
If `bytes` length is greater than 1514, the maximum frame length allowed by the interface.
If ` bytes ` length is greater than 1514 the maximum frame length allowed by the interface .