PICSimLab - Programmable IC Simulator Laboratory 0.9.2
PICSimLab - API
Loading...
Searching...
No Matches
board Class Referenceabstract

Board class. More...

#include <board.h>

Inheritance diagram for board:
Collaboration diagram for board:

Public Member Functions

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 int DebugInit (int dtyppe)=0
 Start debug support.
 
virtual std::string GetDebugName (void)=0
 Get debug interface name.
 
virtual std::string GetAboutInfo (void)=0
 Return the about information of part.
 
virtual void DebugLoop (void)=0
 debug step (pooling)
 
virtual int CpuInitialized (void)=0
 return true if microcontroller is initialized
 
virtual void MSetSerial (const char *port)=0
 Set serial port name to use.
 
virtual int MInit (const char *processor, const char *fname, float freq)=0
 board microcontroller init
 
virtual void MEnd (void)=0
 board microcontroller end
 
virtual int MGetArchitecture (void)=0
 Return board microcontroller architecture.
 
virtual void EndServers (void)
 board servers shutdown
 
virtual int MDumpMemory (const char *fname)=0
 board microcontroller save non volatile memory to hex file
 
virtual void MEraseFlash (void)=0
 board microcontroller erase flash memory (program)
 
virtual void MSetFreq (float freq)=0
 board microcontroller set frequency
 
virtual float MGetFreq (void)=0
 board microcontroller get frequency
 
virtual void MSetVCC (float vcc)=0
 board microcontroller set vcc
 
virtual float MGetVCC (void)=0
 board microcontroller get vcc
 
virtual float MGetInstClockFreq (void)=0
 board microcontroller get cpu internal clock (in PIC frequency/4)
 
int MGetClocksPerInstructions (void)
 board microcontroller get Clock pulses per instruction (in PIC equal to 4)
 
virtual int MGetPinCount (void)=0
 board microcontroller pin count
 
virtual std::string MGetPinName (int pin)=0
 board microcontroller pin name
 
virtual void MSetPin (int pin, unsigned char value)=0
 board microcontroller set digital pin
 
virtual void MSetPinDOV (int pin, unsigned char ovalue)=0
 board microcontroller set Default Open Value (external pull)
 
virtual void MSetAPin (int pin, float value)=0
 board microcontroller set analog pin
 
virtual unsigned char MGetPin (int pin)=0
 board microcontroller get digital pin value
 
virtual const picpin * MGetPinsValues (void)=0
 board microcontroller get all pins list struct
 
virtual void MStep (void)=0
 board microcontroller run one step
 
virtual void MStepResume (void)=0
 board microcontroller run one or two steps to resume instruction
 
virtual void MReset (int flags)=0
 board microcontroller reset
 
virtual unsigned short * DBGGetProcID_p (void)
 board microcontroller get pointer to processor ID
 
virtual unsigned int DBGGetPC (void)
 board microcontroller get PC
 
virtual void DBGSetPC (unsigned int pc)
 board microcontroller set PC
 
virtual unsigned char * DBGGetRAM_p (void)
 board microcontroller get RAM memory pointer
 
virtual unsigned char * DBGGetROM_p (void)
 board microcontroller get ROM (FLASH) memory pointer
 
virtual unsigned char * DBGGetCONFIG_p (void)
 board microcontroller get CONFIG memory pointer
 
virtual unsigned char * DBGGetID_p (void)
 board microcontroller get internal IDS memory pointer
 
virtual unsigned char * DBGGetEEPROM_p (void)
 board microcontroller get data EEPROM memory pointer
 
virtual unsigned int DBGGetRAMSize (void)
 board microcontroller get RAM memory size
 
virtual unsigned int DBGGetROMSize (void)
 board microcontroller get ROM (FLASH) memory size
 
virtual unsigned int DBGGetCONFIGSize (void)
 board microcontroller get CONFIG memory size
 
virtual unsigned int DBGGetIDSize (void)
 board microcontroller get internal IDS memory size
 
virtual unsigned int DBGGetEEPROM_Size (void)
 board microcontroller get data EEPROM memory size
 
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.
 
virtual int GetDefaultClock (void)
 Get board default clock in MHz.
 
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 int GetUARTRX (const int uart_num)
 Return the UART N RX pin number.
 
virtual int GetUARTTX (const int uart_num)
 Return the UART N TX pin number.
 
virtual std::string GetClkLabel (void)
 Return the description of clk label.
 

Protected Member Functions

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

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

void ReadInputMap (std::string fname)
 Read the Input Map.
 
void ReadOutputMap (std::string fname)
 Read the Output Map.
 

Private Attributes

uint32_t InstCounter
 
int TimersCount
 
Timers_t Timers [MAX_TIMERS]
 
Timers_tTimersList [MAX_TIMERS]
 

Detailed Description

Board class.

class definition of boards used in picsimlab.

Member Function Documentation

◆ board_ButtonEvent()

virtual void board::board_ButtonEvent ( const char *  controlname,
unsigned int  button,
unsigned int  x,
unsigned int  y,
unsigned int  state 
)
inlinevirtual

Called when window side controls are activated.

Reimplemented in cboard_Blue_Pill, cboard_C3_DevKitC, cboard_DevKitC, and cboard_STM32_H103.

◆ board_Event()

virtual void board::board_Event ( const char *  controlname)
inlinevirtual

Called when window side controls are activated.

Reimplemented in cboard_Blue_Pill, cboard_C3_DevKitC, cboard_DevKitC, cboard_PICGenios, and cboard_STM32_H103.

◆ CpuInitialized()

virtual int board::CpuInitialized ( void  )
pure virtual

return true if microcontroller is initialized

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ DBGGetCONFIG_p()

virtual unsigned char * board::DBGGetCONFIG_p ( void  )
inlinevirtual

board microcontroller get CONFIG memory pointer

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetCONFIGSize()

virtual unsigned int board::DBGGetCONFIGSize ( void  )
inlinevirtual

board microcontroller get CONFIG memory size

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetEEPROM_p()

virtual unsigned char * board::DBGGetEEPROM_p ( void  )
inlinevirtual

board microcontroller get data EEPROM memory pointer

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetEEPROM_Size()

virtual unsigned int board::DBGGetEEPROM_Size ( void  )
inlinevirtual

board microcontroller get data EEPROM memory size

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetID_p()

virtual unsigned char * board::DBGGetID_p ( void  )
inlinevirtual

board microcontroller get internal IDS memory pointer

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetIDSize()

virtual unsigned int board::DBGGetIDSize ( void  )
inlinevirtual

board microcontroller get internal IDS memory size

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetPC()

virtual unsigned int board::DBGGetPC ( void  )
inlinevirtual

board microcontroller get PC

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetProcID_p()

virtual unsigned short * board::DBGGetProcID_p ( void  )
inlinevirtual

board microcontroller get pointer to processor ID

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetRAM_p()

virtual unsigned char * board::DBGGetRAM_p ( void  )
inlinevirtual

board microcontroller get RAM memory pointer

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetRAMLARD()

virtual unsigned int board::DBGGetRAMLARD ( void  )
inlinevirtual

board microcontroller get last ram read address

Reimplemented in bsim_picsim.

◆ DBGGetRAMLAWR()

virtual unsigned int board::DBGGetRAMLAWR ( void  )
inlinevirtual

board microcontroller get last ram write address

Reimplemented in bsim_picsim.

◆ DBGGetRAMSize()

virtual unsigned int board::DBGGetRAMSize ( void  )
inlinevirtual

board microcontroller get RAM memory size

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetROM_p()

virtual unsigned char * board::DBGGetROM_p ( void  )
inlinevirtual

board microcontroller get ROM (FLASH) memory pointer

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DBGGetROMSize()

virtual unsigned int board::DBGGetROMSize ( void  )
inlinevirtual

board microcontroller get ROM (FLASH) memory size

Reimplemented in cboard_Breadboard, cboard_C3_DevKitC, cboard_DevKitC, bsim_picsim, and bsim_simavr.

◆ DBGSetPC()

virtual void board::DBGSetPC ( unsigned int  pc)
inlinevirtual

board microcontroller set PC

Reimplemented in cboard_Breadboard, bsim_picsim, and bsim_simavr.

◆ DebugInit()

virtual int board::DebugInit ( int  dtyppe)
pure virtual

Start debug support.

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ DebugLoop()

virtual void board::DebugLoop ( void  )
pure virtual

debug step (pooling)

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ Draw()

◆ EndServers()

virtual void board::EndServers ( void  )
inlinevirtual

board servers shutdown

Reimplemented in cboard_Breadboard, bsim_picsim, bsim_remote, and bsim_simavr.

◆ EvKeyPress()

◆ EvKeyRelease()

◆ EvMouseButtonPress()

virtual void board::EvMouseButtonPress ( unsigned int  button,
unsigned int  x,
unsigned int  y,
unsigned int  state 
)
pure virtual

◆ EvMouseButtonRelease()

virtual void board::EvMouseButtonRelease ( unsigned int  button,
unsigned int  x,
unsigned int  y,
unsigned int  state 
)
pure virtual

◆ EvMouseMove()

virtual void board::EvMouseMove ( unsigned int  button,
unsigned int  x,
unsigned int  y,
unsigned int  state 
)
inlinevirtual

◆ EvOnShow()

void board::EvOnShow ( void  )
virtual

Event on the board.

Reimplemented in cboard_K16F, cboard_McLab2, cboard_PICGenios, and cboard_PQDB.

◆ EvThreadRun()

virtual void board::EvThreadRun ( void  )
inlinevirtual

Event on the board.

Reimplemented in cboard_RemoteTCP, and bsim_qemu.

◆ GetAboutInfo()

◆ GetClkLabel()

virtual std::string board::GetClkLabel ( void  )
inlinevirtual

Return the description of clk label.

Reimplemented in bsim_qemu, and bsim_remote.

◆ GetDebugName()

virtual std::string board::GetDebugName ( void  )
pure virtual

Get debug interface name.

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ GetDefaultClock()

virtual int board::GetDefaultClock ( void  )
inlinevirtual

Get board default clock in MHz.

Reimplemented in cboard_Breadboard, cboard_McLab1, bsim_gpsim, bsim_picsim, bsim_qemu, and bsim_simavr.

◆ GetInputId()

◆ GetName()

◆ GetOutputId()

◆ GetSupportedDevices()

◆ GetUARTRX()

virtual int board::GetUARTRX ( const int  uart_num)
inlinevirtual

Return the UART N RX pin number.

Reimplemented in cboard_Breadboard, bsim_picsim, bsim_qemu, bsim_remote, and bsim_simavr.

◆ GetUARTTX()

virtual int board::GetUARTTX ( const int  uart_num)
inlinevirtual

Return the UART N TX pin number.

Reimplemented in cboard_Breadboard, bsim_picsim, bsim_qemu, bsim_remote, and bsim_simavr.

◆ IoLockAccess()

virtual void board::IoLockAccess ( void  )
inlinevirtual

Lock IO to others threads access.

Reimplemented in bsim_qemu.

◆ IoUnlockAccess()

virtual void board::IoUnlockAccess ( void  )
inlinevirtual

Unlock IO to others threads access.

Reimplemented in bsim_qemu.

◆ MDumpMemory()

virtual int board::MDumpMemory ( const char *  fname)
pure virtual

board microcontroller save non volatile memory to hex file

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, bsim_ucsim, cboard_K16F, cboard_McLab2, and cboard_PICGenios.

◆ MEnd()

virtual void board::MEnd ( void  )
pure virtual

board microcontroller end

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MEraseFlash()

virtual void board::MEraseFlash ( void  )
pure virtual

board microcontroller erase flash memory (program)

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MGetArchitecture()

virtual int board::MGetArchitecture ( void  )
pure virtual

Return board microcontroller architecture.

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MGetFreq()

virtual float board::MGetFreq ( void  )
pure virtual

board microcontroller get frequency

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MGetInstClockFreq()

virtual float board::MGetInstClockFreq ( void  )
pure virtual

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

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MGetPin()

virtual unsigned char board::MGetPin ( int  pin)
pure virtual

board microcontroller get digital pin value

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MGetPinCount()

virtual int board::MGetPinCount ( void  )
pure virtual

◆ MGetPinName()

virtual std::string board::MGetPinName ( int  pin)
pure virtual

◆ MGetPinsValues()

virtual const picpin * board::MGetPinsValues ( void  )
pure virtual

board microcontroller get all pins list struct

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MGetVCC()

virtual float board::MGetVCC ( void  )
pure virtual

board microcontroller get vcc

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MInit()

virtual int board::MInit ( const char *  processor,
const char *  fname,
float  freq 
)
pure virtual

◆ MReset()

virtual void board::MReset ( int  flags)
pure virtual

board microcontroller reset

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MSetAPin()

virtual void board::MSetAPin ( int  pin,
float  value 
)
pure virtual

◆ MSetFreq()

virtual void board::MSetFreq ( float  freq)
pure virtual

board microcontroller set frequency

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MSetPin()

virtual void board::MSetPin ( int  pin,
unsigned char  value 
)
pure virtual

board microcontroller set digital pin

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MSetPinDOV()

virtual void board::MSetPinDOV ( int  pin,
unsigned char  ovalue 
)
pure virtual

board microcontroller set Default Open Value (external pull)

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MSetSerial()

virtual void board::MSetSerial ( const char *  port)
pure virtual

◆ MSetVCC()

virtual void board::MSetVCC ( float  vcc)
pure virtual

board microcontroller set vcc

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MStep()

virtual void board::MStep ( void  )
pure virtual

board microcontroller run one step

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ MStepResume()

virtual void board::MStepResume ( void  )
pure virtual

board microcontroller run one or two steps to resume instruction

Implemented in cboard_Breadboard, bsim_gpsim, bsim_picsim, bsim_qemu, bsim_remote, bsim_simavr, and bsim_ucsim.

◆ ReadPreferences()

◆ RefreshStatus()

◆ RegisterRemoteControl()

virtual void board::RegisterRemoteControl ( void  )
inlineprotectedvirtual

◆ Reset()

◆ Run_CPU()

◆ SetScale()

void board::SetScale ( double  scale)
virtual

Set board draw scale.

Reimplemented in cboard_Breadboard, cboard_gpboard, cboard_McLab2, cboard_PICGenios, and cboard_uCboard.

◆ WritePreferences()


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