simulavr
1.1.0
|
#include <hwusi.h>
Public Member Functions | |
HWUSI (AvrDevice *core, HWIrqSystem *, PinAtPort din, PinAtPort dout, PinAtPort sck, unsigned int irq_start, unsigned int irq_ovr) | |
virtual | ~HWUSI () |
virtual void | Reset () |
virtual void | fireEvent (int event) |
int | Step (bool &untilCoreStepFinished, SystemClockOffset *nextStepIn_ns=0) |
Return nonzero if a breakpoint was hit. More... | |
void | SetUSIDR (unsigned char val) |
void | SetUSISR (unsigned char val) |
void | SetUSICR (unsigned char val) |
unsigned char | GetUSIDR (void) |
unsigned char | GetUSISR (void) |
unsigned char | GetUSICR (void) |
![]() | |
Hardware (AvrDevice *core) | |
virtual | ~Hardware () |
virtual unsigned int | CpuCycle (void) |
virtual void | ClearIrqFlag (unsigned int vector) |
virtual bool | IsLevelInterrupt (unsigned int vector) |
virtual bool | LevelInterruptPending (unsigned int vector) |
![]() | |
virtual | ~SimulationMember () |
![]() | |
TraceValueRegister (TraceValueRegister *parent, const std::string &name) | |
Create a TraceValueRegister, with a scope prefix built on parent scope + name. More... | |
TraceValueRegister () | |
Create a TraceValueRegister, with a empty scope name, single device application. More... | |
virtual | ~TraceValueRegister () |
const std::string | GetTraceValuePrefix (void) |
Returns the scope prefix. More... | |
const std::string | GetScopeName (void) |
Returns the scope name. More... | |
void | RegisterTraceValue (TraceValue *t) |
Registers a TraceValue for this register. More... | |
void | UnregisterTraceValue (TraceValue *t) |
Unregisters a TraceValue, remove it from register. More... | |
TraceValueRegister * | GetScopeGroupByName (const std::string &name) |
Get a here registered TraceValueRegister by it's name. More... | |
virtual TraceValue * | GetTraceValueByName (const std::string &name) |
Get a here registered TraceValue by it's name. More... | |
TraceValueRegister * | FindScopeGroupByName (const std::string &name) |
Seek for a TraceValueRegister by it's name. More... | |
TraceValue * | FindTraceValueByName (const std::string &name) |
Seek for a TraceValue by it's name. More... | |
TraceSet * | GetAllTraceValues (void) |
Get all here registered TraceValue's only (not with descending values) More... | |
TraceSet * | GetAllTraceValuesRecursive (void) |
Get all here registered TraceValue's with descending values. More... | |
![]() | |
virtual | ~HasPinNotifyFunction () |
![]() | |
virtual | ~TimerEventListener () |
Public Attributes | |
IOReg< HWUSI > | usidr_reg |
IOReg< HWUSI > | usisr_reg |
IOReg< HWUSI > | usicr_reg |
Protected Member Functions | |
virtual void | setDataBuffer (unsigned char data) |
virtual void | registerDIandSCK (HWUSI *cb) |
virtual void | toggleSCK (void) |
virtual void | setDO (bool state) |
virtual void | setDI (bool state, bool ddr, bool port) |
virtual void | setSCK_TWI (bool hold, bool ddr, bool port) |
virtual void | controlDO (bool state) |
virtual void | controlTWI (bool state) |
![]() | |
virtual size_t | _tvr_getValuesCount (void) |
Get the count of all TraceValues, that are registered here and descending. More... | |
virtual void | _tvr_insertTraceValuesToSet (TraceSet &t) |
Insert all TraceValues into TraceSet, that registered here and descending. More... | |
Private Types | |
enum | WMtype { WM_OFF = 0, WM_3WIRE, WM_2WIRE, WM_2WIRE_OVR, WM_tablesize } |
Private Member Functions | |
void | doCount (void) |
void | setDout (void) |
void | doShift (void) |
void | PinStateHasChanged (Pin *) |
Private Attributes | |
HWIrqSystem * | irq |
unsigned char | shift_data |
unsigned char | control_data |
PinAtPort | DI |
PinAtPort | DO |
PinAtPort | SCK |
bool | sck_state |
bool | sck_port |
bool | sck_ddr |
bool | di_state |
bool | di_port |
bool | di_ddr |
bool | scl_hold |
unsigned int | irq_start |
bool | irqen_start |
bool | irqactive_start |
unsigned int | irq_ovr |
bool | irqen_ovr |
bool | irqactive_ovr |
bool | flag_stop |
bool | flag_dcol |
WMtype | wire_mode |
unsigned char | clock_mode |
unsigned char | counter_data |
bool | is_DI_change |
Implements USI base module (w/o buffer register or alternate pins)
|
private |
HWUSI::HWUSI | ( | AvrDevice * | core, |
HWIrqSystem * | _irq, | ||
PinAtPort | din, | ||
PinAtPort | dout, | ||
PinAtPort | sck, | ||
unsigned int | irq_start, | ||
unsigned int | irq_ovr | ||
) |
Definition at line 204 of file hwusi.cpp.
References counter_data, HWIrqSystem::DebugVerifyInterruptVector(), irq, registerDIandSCK(), Reset(), shift_data, and trace_direct().
Referenced by setDataBuffer().
|
inlinevirtual |
Definition at line 148 of file hwusi.h.
References fireEvent(), Reset(), SetUSICR(), SetUSIDR(), SetUSISR(), and Step().
|
protectedvirtual |
set output control for DO pin
Definition at line 187 of file hwusi.cpp.
References DO, and PinAtPort::SetUseAlternatePortIfDdrSet().
Referenced by Reset(), setDataBuffer(), and SetUSICR().
|
protectedvirtual |
set output control for two wire mode (for DI and SCK!)
Definition at line 191 of file hwusi.cpp.
References DI, SCK, PinAtPort::SetAlternatePort(), PinAtPort::SetAlternatePullup(), PinAtPort::SetUseAlternateDdr(), PinAtPort::SetUseAlternatePortIfDdrSet(), and PinAtPort::SetUseAlternatePullup().
Referenced by Reset(), setDataBuffer(), and SetUSICR().
|
private |
process counter event (clock)
Definition at line 123 of file hwusi.cpp.
References SystemClock::Add(), clock_mode, counter_data, SystemClock::Instance(), irq, irq_ovr, irqactive_ovr, irqen_ovr, is_DI_change, scl_hold, setDataBuffer(), HWIrqSystem::SetIrqFlag(), shift_data, wire_mode, and WM_2WIRE_OVR.
Referenced by fireEvent(), PinStateHasChanged(), and SetUSICR().
|
private |
process shift event, store DI in LSB
Definition at line 142 of file hwusi.cpp.
References DI, and shift_data.
Referenced by fireEvent(), and PinStateHasChanged().
|
virtual |
Implements TimerEventListener.
Definition at line 352 of file hwusi.cpp.
References clock_mode, doCount(), doShift(), BasicTimerUnit::EVT_COMPARE_1, and setDout().
Referenced by ~HWUSI().
|
inline |
Definition at line 165 of file hwusi.h.
References control_data.
|
inline |
Definition at line 163 of file hwusi.h.
References GetUSISR(), and shift_data.
unsigned char HWUSI::GetUSISR | ( | void | ) |
Definition at line 37 of file hwusi.cpp.
References counter_data, flag_dcol, flag_stop, irqactive_ovr, and irqactive_start.
Referenced by GetUSIDR().
|
privatevirtual |
Interface for HasPinNotifyFunction
Implements HasPinNotifyFunction.
Definition at line 267 of file hwusi.cpp.
References SystemClock::Add(), clock_mode, DI, di_ddr, di_port, di_state, doCount(), doShift(), PinAtPort::GetDdr(), PinAtPort::GetPin(), PinAtPort::GetPort(), SystemClock::Instance(), irq, irq_start, irqactive_start, irqen_start, is_DI_change, SCK, sck_ddr, sck_port, sck_state, scl_hold, setDout(), HWIrqSystem::SetIrqFlag(), wire_mode, WM_2WIRE, WM_2WIRE_OVR, WM_3WIRE, and WM_OFF.
|
protectedvirtual |
register notify for SCK pin
Definition at line 168 of file hwusi.cpp.
References DI, PinAtPort::GetPin(), Pin::RegisterCallback(), and SCK.
Referenced by HWUSI(), and setDataBuffer().
|
virtual |
Implement the hardware's reset functionality here. The default is no action on reset.
Reimplemented from Hardware.
Reimplemented in HWUSI_BR.
Definition at line 229 of file hwusi.cpp.
References clock_mode, control_data, controlDO(), controlTWI(), counter_data, di_ddr, di_port, di_state, flag_dcol, flag_stop, irqactive_ovr, irqactive_start, irqen_ovr, irqen_start, is_DI_change, sck_ddr, sck_port, sck_state, scl_hold, shift_data, wire_mode, and WM_OFF.
Referenced by HWUSI(), HWUSI_BR::Reset(), and ~HWUSI().
|
inlineprotectedvirtual |
interface to store data to buffer register
Reimplemented in HWUSI_BR.
Definition at line 121 of file hwusi.h.
References controlDO(), controlTWI(), HWUSI(), registerDIandSCK(), setDI(), setDO(), setSCK_TWI(), and toggleSCK().
Referenced by doCount().
|
protectedvirtual |
set state for DI pin
Definition at line 177 of file hwusi.cpp.
References DI, and PinAtPort::SetAlternateDdr().
Referenced by setDataBuffer(), setDout(), SetUSICR(), and Step().
|
protectedvirtual |
set state for DO pin
Definition at line 173 of file hwusi.cpp.
References DO, and PinAtPort::SetAlternatePort().
Referenced by setDataBuffer(), and setDout().
|
private |
set DO output pin
Definition at line 147 of file hwusi.cpp.
References di_ddr, di_port, setDI(), setDO(), shift_data, wire_mode, WM_3WIRE, and WM_OFF.
Referenced by fireEvent(), PinStateHasChanged(), SetUSICR(), and SetUSIDR().
|
protectedvirtual |
set state for SCK pin in two wire modes
Definition at line 182 of file hwusi.cpp.
References SCK, and PinAtPort::SetAlternateDdr().
Referenced by setDataBuffer(), SetUSICR(), SetUSISR(), and Step().
void HWUSI::SetUSICR | ( | unsigned char | val | ) |
Definition at line 67 of file hwusi.cpp.
References clock_mode, control_data, controlDO(), controlTWI(), di_ddr, di_port, doCount(), irqen_ovr, irqen_start, sck_ddr, sck_port, setDI(), setDout(), setSCK_TWI(), shift_data, toggleSCK(), wire_mode, WM_2WIRE, WM_2WIRE_OVR, WM_3WIRE, and WM_OFF.
Referenced by ~HWUSI().
void HWUSI::SetUSIDR | ( | unsigned char | val | ) |
Definition at line 32 of file hwusi.cpp.
References setDout(), and shift_data.
Referenced by ~HWUSI().
void HWUSI::SetUSISR | ( | unsigned char | val | ) |
Definition at line 46 of file hwusi.cpp.
References HWIrqSystem::ClearIrqFlag(), counter_data, flag_stop, irq, irq_ovr, irq_start, irqactive_ovr, irqactive_start, sck_ddr, sck_port, scl_hold, and setSCK_TWI().
Referenced by ~HWUSI().
|
virtual |
Return nonzero if a breakpoint was hit.
Implements SimulationMember.
Definition at line 255 of file hwusi.cpp.
References di_ddr, di_port, is_DI_change, sck_ddr, sck_port, scl_hold, setDI(), setSCK_TWI(), and shift_data.
Referenced by ~HWUSI().
|
protectedvirtual |
toggle port state for SCK pin
Definition at line 161 of file hwusi.cpp.
References PinAtPort::GetPort(), SCK, and PinAtPort::SetPort().
Referenced by setDataBuffer(), and SetUSICR().
|
private |
USI clock mode [USICS1 USICS0 USICLK]
Definition at line 102 of file hwusi.h.
Referenced by doCount(), fireEvent(), PinStateHasChanged(), Reset(), and SetUSICR().
|
private |
USI control register
Definition at line 59 of file hwusi.h.
Referenced by GetUSICR(), Reset(), and SetUSICR().
|
private |
USI 4bit counter
Definition at line 107 of file hwusi.h.
Referenced by doCount(), GetUSISR(), HWUSI(), Reset(), and SetUSISR().
|
private |
data input port pin
Definition at line 62 of file hwusi.h.
Referenced by controlTWI(), doShift(), PinStateHasChanged(), registerDIandSCK(), and setDI().
|
private |
DDR register value for DI port pin
Definition at line 78 of file hwusi.h.
Referenced by PinStateHasChanged(), Reset(), setDout(), SetUSICR(), and Step().
|
private |
PORT register value for DI port pin
Definition at line 76 of file hwusi.h.
Referenced by PinStateHasChanged(), Reset(), setDout(), SetUSICR(), and Step().
|
private |
stored input state for DI port pin
Definition at line 74 of file hwusi.h.
Referenced by PinStateHasChanged(), and Reset().
|
private |
|
private |
active flag for data collision (no interrupt)
Definition at line 97 of file hwusi.h.
Referenced by GetUSISR(), and Reset().
|
private |
active flag for stop condition (no interrupt)
Definition at line 95 of file hwusi.h.
Referenced by GetUSISR(), Reset(), and SetUSISR().
|
private |
connected irq system controller
Definition at line 54 of file hwusi.h.
Referenced by doCount(), HWUSI(), PinStateHasChanged(), and SetUSISR().
|
private |
irq vector for USI counter overflow interrupt
Definition at line 89 of file hwusi.h.
Referenced by doCount(), and SetUSISR().
|
private |
irq vector for USI start condition interrupt
Definition at line 83 of file hwusi.h.
Referenced by PinStateHasChanged(), and SetUSISR().
|
private |
active flag for USI counter overflow interrupt
Definition at line 93 of file hwusi.h.
Referenced by doCount(), GetUSISR(), Reset(), and SetUSISR().
|
private |
active flag for start condition interrupt
Definition at line 87 of file hwusi.h.
Referenced by GetUSISR(), PinStateHasChanged(), Reset(), and SetUSISR().
|
private |
enable flag for USI counter overflow interrupt
Definition at line 91 of file hwusi.h.
Referenced by doCount(), Reset(), and SetUSICR().
|
private |
enable flag for start condition interrupt
Definition at line 85 of file hwusi.h.
Referenced by PinStateHasChanged(), Reset(), and SetUSICR().
|
private |
|
private |
data clock port pin
Definition at line 66 of file hwusi.h.
Referenced by controlTWI(), PinStateHasChanged(), registerDIandSCK(), setSCK_TWI(), and toggleSCK().
|
private |
DDR register value for SCK port pin
Definition at line 72 of file hwusi.h.
Referenced by PinStateHasChanged(), Reset(), SetUSICR(), SetUSISR(), and Step().
|
private |
PORT register value for SCK port pin
Definition at line 70 of file hwusi.h.
Referenced by PinStateHasChanged(), Reset(), SetUSICR(), SetUSISR(), and Step().
|
private |
stored input state for SCK port pin
Definition at line 68 of file hwusi.h.
Referenced by PinStateHasChanged(), and Reset().
|
private |
USI SCL hold state
Definition at line 80 of file hwusi.h.
Referenced by doCount(), PinStateHasChanged(), Reset(), SetUSISR(), and Step().
|
private |
USI shift register
Definition at line 57 of file hwusi.h.
Referenced by doCount(), doShift(), GetUSIDR(), HWUSI(), Reset(), setDout(), SetUSICR(), SetUSIDR(), and Step().
Definition at line 168 of file hwusi.h.
Referenced by AvrDevice_attiny2313::AvrDevice_attiny2313(), and AvrDevice_attinyX5::AvrDevice_attinyX5().
Definition at line 168 of file hwusi.h.
Referenced by AvrDevice_attiny2313::AvrDevice_attiny2313(), and AvrDevice_attinyX5::AvrDevice_attinyX5().
Definition at line 168 of file hwusi.h.
Referenced by AvrDevice_attiny2313::AvrDevice_attiny2313(), and AvrDevice_attinyX5::AvrDevice_attinyX5().
|
private |
USI wire mode
Definition at line 100 of file hwusi.h.
Referenced by doCount(), PinStateHasChanged(), Reset(), setDout(), and SetUSICR().