pub fn step(&mut self, halt_block_mode: BlockMode) -> Result<Option<Event>, FatalError> {
        if self.frozen {
            return Ok(None);
        }

        use crate::devices::syscon::PowerState;
        match self.devices.syscon.power_state() {
            PowerState::Run => {
                // set up memory sniffer to support watchpoints
                let mut hit_watchpoint = None;
                let mut sniffer = MemSniffer::new(&mut self.devices, &self.watchpoints, |access| {
                    hit_watchpoint = Some(access)
                });

                // step the system
                let mut mem = MemoryAdapter::new(&mut sniffer);
                self.cpu.step(&mut mem);
                if let Some(e) = mem.take_exception() {
                    Ts7200::handle_mem_exception(&self.cpu, &self.devices, e)?;
                }
                self.check_device_interrupts(BlockMode::NonBlocking);

                let pc = self.cpu.reg_get(ArmMode::User, reg::PC);

                // check for HLE exit
                if self.hle && pc == HLE_BOOTLOADER_LR {
                    info!("Successfully returned to bootloader");
                    info!("Return value: {}", self.cpu.reg_get(ArmMode::User, 0));
                    return Ok(Some(Event::Halted));
                }

                // check to see if a watchpoint was hit
                if let Some(access) = hit_watchpoint {
                    return Ok(Some(match access.kind {
                        MemAccessKind::Read => Event::WatchRead(access.offset),
                        MemAccessKind::Write => Event::WatchWrite(access.offset),
                    }));
                }

                // check to see if a breakpoint was hit
                if self.breakpoints.contains(&pc) {
                    return Ok(Some(Event::Break));
                }
            }
            PowerState::Halt => {
                self.check_device_interrupts(halt_block_mode);
                if self.devices.vicmgr.fiq() || self.devices.vicmgr.irq() {
                    self.devices.syscon.set_run_mode();
                };
            }
            PowerState::Standby => {
                return Err(FatalError::UnimplementedPowerState(PowerState::Standby))
            }
        };

        Ok(None)
    }
/// Run the system for a single CPU instruction, returning `true` if the
/// system is still running, or `false` upon exiting to the bootloader.
Run the system for a single CPU instruction, returning `true` if the
system is still running, or `false` upon exiting to the bootloader.
Run the system for a single CPU instruction returning ` true ` if the system is still running or ` false ` upon exiting to the bootloader .
pub fn step(&mut self, halt_block_mode: BlockMode) -> Result<Option<Event>, FatalError> {
        if self.frozen {
            return Ok(None);
        }
        use crate::devices::syscon::PowerState;
        match self.devices.syscon.power_state() {
            PowerState::Run => {
                // set up memory sniffer to support watchpoints
                let mut hit_watchpoint = None;
                let mut sniffer = MemSniffer::new(&mut self.devices, &self.watchpoints, |access| {
                    hit_watchpoint = Some(access)
                });
                // step the system
                let mut mem = MemoryAdapter::new(&mut sniffer);
                self.cpu.step(&mut mem);
                if let Some(e) = mem.take_exception() {
                    Ts7200::handle_mem_exception(&self.cpu, &self.devices, e)?;
                }
                self.check_device_interrupts(BlockMode::NonBlocking);
                let pc = self.cpu.reg_get(ArmMode::User, reg::PC);
                // check for HLE exit
                if self.hle && pc == HLE_BOOTLOADER_LR {
                    info!("Successfully returned to bootloader");
                    info!("Return value: {}", self.cpu.reg_get(ArmMode::User, 0));
                    return Ok(Some(Event::Halted));
                }
                // check to see if a watchpoint was hit
                if let Some(access) = hit_watchpoint {
                    return Ok(Some(match access.kind {
                        MemAccessKind::Read => Event::WatchRead(access.offset),
                        MemAccessKind::Write => Event::WatchWrite(access.offset),
                    }));
                }
                // check to see if a breakpoint was hit
                if self.breakpoints.contains(&pc) {
                    return Ok(Some(Event::Break));
                }
            }
            PowerState::Halt => {
                self.check_device_interrupts(halt_block_mode);
                if self.devices.vicmgr.fiq() || self.devices.vicmgr.irq() {
                    self.devices.syscon.set_run_mode();
                };
            }
            PowerState::Standby => {
                return Err(FatalError::UnimplementedPowerState(PowerState::Standby))
            }
        };
        Ok(None)
    }
pub fn step ( & mut self , halt_block_mode : BlockMode ) -> Result < Option < Event > , FatalError > { if self . frozen { return Ok ( None ) ; } use crate :: devices :: syscon :: PowerState ; match self . devices . syscon . power_state ( ) { PowerState :: Run => { // set up memory sniffer to support watchpoints let mut hit_watchpoint = None ; let mut sniffer = MemSniffer :: new ( & mut self . devices , & self . watchpoints , | access | { hit_watchpoint = Some ( access ) } ) ; // step the system let mut mem = MemoryAdapter :: new ( & mut sniffer ) ; self . cpu . step ( & mut mem ) ; if let Some ( e ) = mem . take_exception ( ) { Ts7200 :: handle_mem_exception ( & self . cpu , & self . devices , e ) ? ; } self . check_device_interrupts ( BlockMode :: NonBlocking ) ; let pc = self . cpu . reg_get ( ArmMode :: User , reg :: PC ) ; // check for HLE exit if self . hle && pc == HLE_BOOTLOADER_LR { info ! ( " " ) ; info ! ( " " self cpu reg_get ( ArmMode User 0 ) ) ; return Ok ( Some ( Event :: Halted ) ) ; } // check to see if a watchpoint was hit if let Some ( access ) = hit_watchpoint { return Ok ( Some ( match access . kind { MemAccessKind :: Read => Event :: WatchRead ( access . offset ) , MemAccessKind :: Write => Event :: WatchWrite ( access . offset ) , } ) ) ; } // check to see if a breakpoint was hit if self . breakpoints . contains ( & pc ) { return Ok ( Some ( Event :: Break ) ) ; } } PowerState :: Halt => { self . check_device_interrupts ( halt_block_mode ) ; if self . devices . vicmgr . fiq ( ) || self . devices . vicmgr . irq ( ) { self . devices . syscon . set_run_mode ( ) ; } ; } PowerState :: Standby => { return Err ( FatalError :: UnimplementedPowerState ( PowerState :: Standby ) ) } } ; Ok ( None ) }
Run the system for a single CPU instruction, returning `true` if the
system is still running, or `false` upon exiting to the bootloader.
Run the system for a single CPU instruction returning ` true ` if the system is still running or ` false ` upon exiting to the bootloader .
&mut self
halt_block_mode
BlockMode
&mut self
halt_block_mode
BlockMode