PICSimLab - Programmable IC Simulator Laboratory 0.9.2
PICSimLab - API
Loading...
Searching...
No Matches
bsim_simavr Class Reference
Inheritance diagram for bsim_simavr:
Collaboration diagram for bsim_simavr:

Public Member Functions

int DebugInit (int dtyppe) override
 Start debug support.
 
std::string GetDebugName (void) override
 Get debug interface name.
 
void DebugLoop (void) override
 debug step (pooling)
 
int CpuInitialized (void) override
 return true if microcontroller is initialized
 
void MSetSerial (const char *port) override
 Set serial port name to use.
 
int MInit (const char *processor, const char *fname, float freq) override
 board microcontroller init
 
void MEnd (void) override
 board microcontroller end
 
int MGetArchitecture (void) override
 Return board microcontroller architecture.
 
int MDumpMemory (const char *fname) override
 board microcontroller save non volatile memory to hex file
 
void MEraseFlash (void) override
 board microcontroller erase flash memory (program)
 
void MSetFreq (float freq) override
 board microcontroller set frequency
 
float MGetFreq (void) override
 board microcontroller get frequency
 
void MSetVCC (float vcc) override
 board microcontroller set vcc
 
float MGetVCC (void) override
 board microcontroller get vcc
 
float MGetInstClockFreq (void) override
 board microcontroller get cpu internal clock (in PIC frequency/4)
 
int MGetPinCount (void) override
 board microcontroller pin count
 
std::string MGetPinName (int pin) override
 board microcontroller pin name
 
void MSetPin (int pin, unsigned char value) override
 board microcontroller set digital pin
 
void MSetPinDOV (int pin, unsigned char ovalue) override
 board microcontroller set Default Open Value (external pull)
 
void MSetAPin (int pin, float value) override
 board microcontroller set analog pin
 
unsigned char MGetPin (int pin) override
 board microcontroller get digital pin value
 
const picpin * MGetPinsValues (void) override
 board microcontroller get all pins list struct
 
void MStep (void) override
 board microcontroller run one step
 
void MStepResume (void) override
 board microcontroller run one or two steps to resume instruction
 
void MReset (int flags) override
 board microcontroller reset
 
unsigned short * DBGGetProcID_p (void) override
 board microcontroller get pointer to processor ID
 
unsigned int DBGGetPC (void) override
 board microcontroller get PC
 
void DBGSetPC (unsigned int pc) override
 board microcontroller set PC
 
unsigned char * DBGGetRAM_p (void) override
 board microcontroller get RAM memory pointer
 
unsigned char * DBGGetROM_p (void) override
 board microcontroller get ROM (FLASH) memory pointer
 
unsigned char * DBGGetCONFIG_p (void) override
 board microcontroller get CONFIG memory pointer
 
unsigned char * DBGGetID_p (void) override
 board microcontroller get internal IDS memory pointer
 
unsigned char * DBGGetEEPROM_p (void) override
 board microcontroller get data EEPROM memory pointer
 
unsigned int DBGGetRAMSize (void) override
 board microcontroller get RAM memory size
 
unsigned int DBGGetROMSize (void) override
 board microcontroller get ROM (FLASH) memory size
 
unsigned int DBGGetCONFIGSize (void) override
 board microcontroller get CONFIG memory size
 
unsigned int DBGGetIDSize (void) override
 board microcontroller get internal IDS memory size
 
unsigned int DBGGetEEPROM_Size (void) override
 board microcontroller get data EEPROM memory size
 
void EndServers (void) override
 board servers shutdown
 
int GetDefaultClock (void) override
 Get board default clock in MHz.
 
int GetUARTRX (const int uart_num) override
 Return the UART N RX pin number.
 
int GetUARTTX (const int uart_num) override
 Return the UART N TX pin number.
 
virtual void UpdateHardware (void)
 
void SerialSend (bitbang_uart_t *_bb_uart, const unsigned char value)
 
- Public Member Functions inherited from board
virtual void Draw (void)=0
 Called ever 100ms to draw board.
 
virtual void Run_CPU (void)=0
 Paralle thread called ever 100ms to run cpu code.
 
virtual std::string GetSupportedDevices (void)=0
 Return a list of supported microcontrollers.
 
virtual std::string GetPictureFileName (void)
 Return the filename of board picture.
 
virtual std::string GetMapFile (void)
 Return the filename of board picture map.
 
virtual void Reset (void)=0
 Reset board status.
 
virtual void EvMouseButtonPress (unsigned int button, unsigned int x, unsigned int y, unsigned int state)=0
 Event on the board.
 
virtual void EvMouseButtonRelease (unsigned int button, unsigned int x, unsigned int y, unsigned int state)=0
 Event on the board.
 
virtual void EvMouseMove (unsigned int button, unsigned int x, unsigned int y, unsigned int state)
 Event on the board.
 
virtual void EvKeyPress (unsigned int key, unsigned int mask)=0
 Event on the board.
 
virtual void EvKeyRelease (unsigned int key, unsigned int mask)=0
 Event on the board.
 
virtual void EvOnShow (void)
 Event on the board.
 
virtual void EvThreadRun (void)
 Event on the board.
 
virtual void RefreshStatus (void)
 Called ever 1s to refresh status.
 
virtual void WritePreferences (void)
 Called to save board preferences in configuration file.
 
virtual void ReadPreferences (char *name, char *value)
 Called whe configuration file load preferences.
 
virtual unsigned short GetInputId (char *name)=0
 return the input ids numbers of names used in input map
 
virtual unsigned short GetOutputId (char *name)=0
 return the output ids numbers of names used in output map
 
virtual void board_Event (const char *controlname)
 Called when window side controls are activated.
 
virtual void board_ButtonEvent (const char *controlname, unsigned int button, unsigned int x, unsigned int y, unsigned int state)
 Called when window side controls are activated.
 
 board (void)
 Called once on board creation.
 
virtual ~board (void)
 Called once on board destruction.
 
void SetUseOscilloscope (int uo)
 Enable/disable oscilloscope measurement.
 
void SetUseSpareParts (int sp)
 Enable/disable spare parts.
 
int GetUseOscilloscope (void)
 Get if oscilloscope is in use.
 
int GetUseSpareParts (void)
 Get if spare parts is in use.
 
virtual std::string GetName (void)=0
 Get board name registered in PICSimLab.
 
void SetProcessorName (std::string proc)
 Set board processor.
 
std::string GetProcessorName (void)
 Get board processor in use.
 
int GetInputCount (void)
 Get board input count.
 
input_tGetInput (int n)
 Get board input.
 
int GetOutputCount (void)
 Get board output count.
 
output_tGetOutput (int n)
 Get board input.
 
virtual std::string GetAboutInfo (void)=0
 Return the about information of part.
 
virtual unsigned int DBGGetRAMLAWR (void)
 board microcontroller get last ram write address
 
virtual unsigned int DBGGetRAMLARD (void)
 board microcontroller get last ram read address
 
unsigned char CalcAngle (int i, int x, int y)
 Calc rotary potentiometer angle.
 
virtual void SetScale (double scale)
 Set board draw scale.
 
double GetScale (void)
 Get board draw scale.
 
std::string GetDefaultProcessor (void)
 Get board default processor.
 
void SetDefaultProcessor (std::string dproc)
 Set board default processor.
 
uint32_t GetInstCounter (void)
 Get instruction counter.
 
uint32_t GetInstCounter_us (const uint32_t start)
 Get elapsed time from instruction counter in us.
 
uint32_t GetInstCounter_ms (const uint32_t start)
 Get elapsed time from instruction counter in us.
 
int TimerRegister_us (const double micros, void(*Callback)(void *arg), void *arg)
 Register a new timer with time in us (default enabled)
 
int TimerRegister_ms (const double miles, void(*Callback)(void *arg), void *arg)
 Register a new timer with time in ms (default enabled)
 
int TimerUnregister (const int timer)
 Unregister timer.
 
int TimerChange_us (const int timer, const double micros)
 Modify timer value with us.
 
int TimerChange_ms (const int timer, const double miles)
 Modify timer value with us.
 
int TimerSetState (const int timer, const int enabled)
 Enable or disable timer.
 
uint64_t TimerGet_ns (const int timer)
 Get elapsed time from instruction counter in ns.
 
void TimerUpdateFrequency (float freq)
 Update Timer counters on frequency change.
 
virtual void IoLockAccess (void)
 Lock IO to others threads access.
 
virtual void IoUnlockAccess (void)
 Unlock IO to others threads access.
 
virtual std::string GetClkLabel (void)
 Return the description of clk label.
 

Static Public Member Functions

static void out_hook (struct avr_irq_t *irq, uint32_t value, void *param)
 
static void ddr_hook (struct avr_irq_t *irq, uint32_t value, void *param)
 

Public Attributes

usi_t USI
 

Protected Member Functions

void pins_reset (void)
 
- Protected Member Functions inherited from board
virtual void RegisterRemoteControl (void)
 Register remote control variables.
 
void InstCounterInc (void)
 Increment the Intructions Counter.
 
void ReadMaps (void)
 Read maps.
 
void StartThread (void)
 Start parallel thread.
 
void StopThread (void)
 Stop parallel thread.
 

Protected Attributes

avr_t * avr
 
avr_irq_t * serial_irq [MAX_UART_COUNT]
 
picpin pins [256]
 
avr_irq_t * Write_stat_irq [100]
 
unsigned int serialbaud [MAX_UART_COUNT]
 
float serialexbaud [MAX_UART_COUNT]
 
int avr_debug_type
 
serialfd_t serialfd
 
bitbang_uart_t bb_uart [MAX_UART_COUNT]
 
unsigned char * eeprom
 
unsigned char uart_config [MAX_UART_COUNT]
 
unsigned char usart_count
 
unsigned int UCSR_base [MAX_UART_COUNT]
 
int pkg
 
- Protected Attributes inherited from board
std::string Proc
 Name of processor in use.
 
std::string DProc
 Name of default board processor.
 
input_t input [MAX_IDS]
 input map elements
 
input_tinput_ids [MAX_IDS]
 input map elements by id order
 
output_t output [MAX_IDS]
 output map elements
 
output_toutput_ids [MAX_IDS]
 output map elements by id order
 
int inputc
 input map elements counter
 
int outputc
 output map elements counter
 
int use_oscope
 use oscilloscope window
 
int use_spare
 use spare parts window
 
unsigned char p_RST
 board /RESET pin state
 
float Scale
 

Private Member Functions

int parse_hex (const char *line, int bytes)
 
unsigned char checksum (char *str)
 
int read_ihx_avr (const char *fname, int leeprom)
 
int write_ihx_avr (const char *fname)
 

Member Function Documentation

◆ CpuInitialized()

int bsim_simavr::CpuInitialized ( void  )
overridevirtual

return true if microcontroller is initialized

Implements board.

Reimplemented in cboard_Breadboard.

◆ DBGGetCONFIG_p()

unsigned char * bsim_simavr::DBGGetCONFIG_p ( void  )
overridevirtual

board microcontroller get CONFIG memory pointer

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetCONFIGSize()

unsigned int bsim_simavr::DBGGetCONFIGSize ( void  )
overridevirtual

board microcontroller get CONFIG memory size

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetEEPROM_p()

unsigned char * bsim_simavr::DBGGetEEPROM_p ( void  )
overridevirtual

board microcontroller get data EEPROM memory pointer

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetEEPROM_Size()

unsigned int bsim_simavr::DBGGetEEPROM_Size ( void  )
overridevirtual

board microcontroller get data EEPROM memory size

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetID_p()

unsigned char * bsim_simavr::DBGGetID_p ( void  )
overridevirtual

board microcontroller get internal IDS memory pointer

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetIDSize()

unsigned int bsim_simavr::DBGGetIDSize ( void  )
overridevirtual

board microcontroller get internal IDS memory size

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetPC()

unsigned int bsim_simavr::DBGGetPC ( void  )
overridevirtual

board microcontroller get PC

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetProcID_p()

unsigned short * bsim_simavr::DBGGetProcID_p ( void  )
overridevirtual

board microcontroller get pointer to processor ID

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetRAM_p()

unsigned char * bsim_simavr::DBGGetRAM_p ( void  )
overridevirtual

board microcontroller get RAM memory pointer

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetRAMSize()

unsigned int bsim_simavr::DBGGetRAMSize ( void  )
overridevirtual

board microcontroller get RAM memory size

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetROM_p()

unsigned char * bsim_simavr::DBGGetROM_p ( void  )
overridevirtual

board microcontroller get ROM (FLASH) memory pointer

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGGetROMSize()

unsigned int bsim_simavr::DBGGetROMSize ( void  )
overridevirtual

board microcontroller get ROM (FLASH) memory size

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DBGSetPC()

void bsim_simavr::DBGSetPC ( unsigned int  pc)
overridevirtual

board microcontroller set PC

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ DebugInit()

int bsim_simavr::DebugInit ( int  dtyppe)
overridevirtual

Start debug support.

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ DebugLoop()

void bsim_simavr::DebugLoop ( void  )
overridevirtual

debug step (pooling)

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ EndServers()

void bsim_simavr::EndServers ( void  )
overridevirtual

board servers shutdown

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ GetDebugName()

std::string bsim_simavr::GetDebugName ( void  )
overridevirtual

Get debug interface name.

Implements board.

Reimplemented in cboard_Breadboard.

◆ GetDefaultClock()

int bsim_simavr::GetDefaultClock ( void  )
inlineoverridevirtual

Get board default clock in MHz.

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ GetUARTRX()

int bsim_simavr::GetUARTRX ( const int  uart_num)
overridevirtual

Return the UART N RX pin number.

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ GetUARTTX()

int bsim_simavr::GetUARTTX ( const int  uart_num)
overridevirtual

Return the UART N TX pin number.

Reimplemented from board.

Reimplemented in cboard_Breadboard.

◆ MDumpMemory()

int bsim_simavr::MDumpMemory ( const char *  fname)
overridevirtual

board microcontroller save non volatile memory to hex file

Implements board.

Reimplemented in cboard_Breadboard.

◆ MEnd()

void bsim_simavr::MEnd ( void  )
overridevirtual

board microcontroller end

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ MEraseFlash()

void bsim_simavr::MEraseFlash ( void  )
overridevirtual

board microcontroller erase flash memory (program)

Implements board.

Reimplemented in cboard_Breadboard.

◆ MGetArchitecture()

int bsim_simavr::MGetArchitecture ( void  )
overridevirtual

Return board microcontroller architecture.

Implements board.

Reimplemented in cboard_Breadboard.

◆ MGetFreq()

float bsim_simavr::MGetFreq ( void  )
overridevirtual

board microcontroller get frequency

Implements board.

Reimplemented in cboard_Breadboard.

◆ MGetInstClockFreq()

float bsim_simavr::MGetInstClockFreq ( void  )
overridevirtual

board microcontroller get cpu internal clock (in PIC frequency/4)

Implements board.

Reimplemented in cboard_Breadboard.

◆ MGetPin()

unsigned char bsim_simavr::MGetPin ( int  pin)
overridevirtual

board microcontroller get digital pin value

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ MGetPinCount()

int bsim_simavr::MGetPinCount ( void  )
overridevirtual

board microcontroller pin count

Implements board.

Reimplemented in cboard_Breadboard.

◆ MGetPinName()

std::string bsim_simavr::MGetPinName ( int  pin)
overridevirtual

board microcontroller pin name

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ MGetPinsValues()

const picpin * bsim_simavr::MGetPinsValues ( void  )
overridevirtual

board microcontroller get all pins list struct

Implements board.

Reimplemented in cboard_Breadboard.

◆ MGetVCC()

float bsim_simavr::MGetVCC ( void  )
overridevirtual

board microcontroller get vcc

Implements board.

Reimplemented in cboard_Breadboard.

◆ MInit()

int bsim_simavr::MInit ( const char *  processor,
const char *  fname,
float  freq 
)
overridevirtual

board microcontroller init

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ MReset()

void bsim_simavr::MReset ( int  flags)
overridevirtual

board microcontroller reset

Implements board.

Reimplemented in cboard_Breadboard.

◆ MSetAPin()

void bsim_simavr::MSetAPin ( int  pin,
float  value 
)
overridevirtual

board microcontroller set analog pin

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ MSetFreq()

void bsim_simavr::MSetFreq ( float  freq)
overridevirtual

board microcontroller set frequency

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ MSetPin()

void bsim_simavr::MSetPin ( int  pin,
unsigned char  value 
)
overridevirtual

board microcontroller set digital pin

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ MSetPinDOV()

void bsim_simavr::MSetPinDOV ( int  pin,
unsigned char  ovalue 
)
overridevirtual

board microcontroller set Default Open Value (external pull)

Implements board.

Reimplemented in cboard_Breadboard.

Here is the call graph for this function:

◆ MSetSerial()

void bsim_simavr::MSetSerial ( const char *  port)
overridevirtual

Set serial port name to use.

Implements board.

Reimplemented in cboard_Breadboard.

◆ MSetVCC()

void bsim_simavr::MSetVCC ( float  vcc)
overridevirtual

board microcontroller set vcc

Implements board.

Reimplemented in cboard_Breadboard.

◆ MStep()

void bsim_simavr::MStep ( void  )
overridevirtual

board microcontroller run one step

Implements board.

Reimplemented in cboard_Breadboard.

◆ MStepResume()

void bsim_simavr::MStepResume ( void  )
overridevirtual

board microcontroller run one or two steps to resume instruction

Implements board.

Reimplemented in cboard_Breadboard.


The documentation for this class was generated from the following files: