fn write_register(&mut self, port: Port, addr: u16, value: u32) -> Result<(), DebugProbeError> {
        if (addr & 0xf0) == 0 || port != Port::DebugPort {
            let port = match port {
                Port::DebugPort => 0xffff,
                Port::AccessPort(p) => p,
            };

            let cmd = vec![
                commands::JTAG_COMMAND,
                commands::JTAG_WRITE_DAP_REG,
                (port & 0xFF) as u8,
                ((port >> 8) & 0xFF) as u8,
                (addr & 0xFF) as u8,
                ((addr >> 8) & 0xFF) as u8,
                (value & 0xFF) as u8,
                ((value >> 8) & 0xFF) as u8,
                ((value >> 16) & 0xFF) as u8,
                ((value >> 24) & 0xFF) as u8,
            ];
            let mut buf = [0; 2];
            self.device.write(cmd, &[], &mut buf, TIMEOUT)?;
            Self::check_status(&buf)?;
            Ok(())
        } else {
            Err(DebugProbeError::BlanksNotAllowedOnDPRegister)
        }
    }
/// Writes a value to the DAP register on the specified port and address.
Writes a value to the DAP register on the specified port and address.
Writes a value to the DAP register on the specified port and address .
fn write_register(&mut self, port: Port, addr: u16, value: u32) -> Result<(), DebugProbeError> {
        if (addr & 0xf0) == 0 || port != Port::DebugPort {
            let port = match port {
                Port::DebugPort => 0xffff,
                Port::AccessPort(p) => p,
            };
            let cmd = vec![
                commands::JTAG_COMMAND,
                commands::JTAG_WRITE_DAP_REG,
                (port & 0xFF) as u8,
                ((port >> 8) & 0xFF) as u8,
                (addr & 0xFF) as u8,
                ((addr >> 8) & 0xFF) as u8,
                (value & 0xFF) as u8,
                ((value >> 8) & 0xFF) as u8,
                ((value >> 16) & 0xFF) as u8,
                ((value >> 24) & 0xFF) as u8,
            ];
            let mut buf = [0; 2];
            self.device.write(cmd, &[], &mut buf, TIMEOUT)?;
            Self::check_status(&buf)?;
            Ok(())
        } else {
            Err(DebugProbeError::BlanksNotAllowedOnDPRegister)
        }
    }
fn write_register ( & mut self , port : Port , addr : u16 , value : u32 ) -> Result < ( ) , DebugProbeError > { if ( addr & 0xf0 ) == 0 || port != Port :: DebugPort { let port = match port { Port :: DebugPort => 0xffff , Port :: AccessPort ( p ) => p , } ; let cmd = vec ! [ commands JTAG_COMMAND commands JTAG_WRITE_DAP_REG ( port 0xFF ) as u8 ( ( port 8 ) 0xFF ) as u8 ( addr 0xFF ) as u8 ( ( addr 8 ) 0xFF ) as u8 ( value 0xFF ) as u8 ( ( value 8 ) 0xFF ) as u8 ( ( value 16 ) 0xFF ) as u8 ( ( value 24 ) 0xFF ) as u8 ] ; let mut buf = [ 0 ; 2 ] ; self . device . write ( cmd , & [ ] , & mut buf , TIMEOUT ) ? ; Self :: check_status ( & buf ) ? ; Ok ( ( ) ) } else { Err ( DebugProbeError :: BlanksNotAllowedOnDPRegister ) } }
Writes a value to the DAP register on the specified port and address.
Writes a value to the DAP register on the specified port and address .
&mut self
port
Port
addr
u16
value
u32