PICSimLab - Programmable IC Simulator Laboratory 0.9.2
PICSimLab - API
Loading...
Searching...
No Matches
board_Breadboard.h
1/* ########################################################################
2
3 PICSimLab - Programmable IC Simulator Laboratory
4
5 ########################################################################
6
7 Copyright (c) : 2015-2025 Luis Claudio GambĂ´a Lopes <lcgamboa@yahoo.com>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 For e-mail suggestions : lcgamboa@yahoo.com
24 ######################################################################## */
25
26#ifndef BOARD_Breadboard_H
27#define BOARD_Breadboard_H
28
29#include "../sim_backend/bsim_picsim.h"
30#include "../sim_backend/bsim_simavr.h"
31
32#define BOARD_Breadboard_Name "Breadboard"
33
34#define _PIC 0
35#define _AVR 1
36
37// new board class must be derived from board class defined in board.h
39private:
40 int ptype;
41 int micbmp;
42 unsigned char jmp[1]; // jumper
43public:
44 void SetScale(double scale) override;
45 // Return the board name
46 std::string GetName(void) override { return BOARD_Breadboard_Name; };
47 std::string GetAboutInfo(void) override { return "L.C. Gamboa \n <lcgamboa@yahoo.com>"; };
48 int DebugInit(int dtyppe) override;
49 std::string GetDebugName(void) override;
50 void DebugLoop(void) override;
51 int CpuInitialized(void) override;
52 void MSetSerial(const char* port) override;
53 int MInit(const char* processor, const char* fname, float freq) override;
54 void MEnd(void) override;
55 int MGetArchitecture(void) override;
56 int MDumpMemory(const char* fname) override;
57 void MEraseFlash(void) override;
58 void MSetFreq(float freq) override;
59 float MGetFreq(void) override;
60 void MSetVCC(float vcc) override;
61 float MGetVCC(void) override;
62 float MGetInstClockFreq(void) override;
63 int MGetPinCount(void) override;
64 std::string MGetPinName(int pin) override;
65 void MSetPin(int pin, unsigned char value) override;
66 void MSetPinDOV(int pin, unsigned char ovalue) override;
67 void MSetPinOAV(int pin, float value) override;
68 void MSetAPin(int pin, float value) override;
69 unsigned char MGetPin(int pin) override;
70 const picpin* MGetPinsValues(void) override;
71 float* MGetPinOAVPtr(int pin) override;
72 void MStep(void) override;
73 void MStepResume(void) override;
74 int MReset(int flags) override;
75 int MGetResetPin(void) override;
76 int MGetIOUpdated(void) override;
77 void MClearIOUpdated(void) override;
78 unsigned short* DBGGetProcID_p(void) override;
79 unsigned int DBGGetPC(void) override;
80 void DBGSetPC(unsigned int pc) override;
81 unsigned char* DBGGetRAM_p(void) override;
82 unsigned char* DBGGetROM_p(void) override;
83 unsigned char* DBGGetCONFIG_p(void) override;
84 unsigned char* DBGGetID_p(void) override;
85 unsigned char* DBGGetEEPROM_p(void) override;
86 unsigned int DBGGetRAMSize(void) override;
87 unsigned int DBGGetROMSize(void) override;
88 unsigned int DBGGetCONFIGSize(void) override;
89 unsigned int DBGGetIDSize(void) override;
90 unsigned int DBGGetEEPROM_Size(void) override;
91 int GetUARTRX(const int uart_num) override;
92 int GetUARTTX(const int uart_num) override;
93 std::string GetUARTStrStatus(const int uart_num) override;
94
95 // Constructor called once on board creation
97 // Destructor called once on board destruction
99 // Called ever 100ms to draw board
100 void Draw(void) override;
101 void Run_CPU(void) override;
102 // Return a list of board supported microcontrollers
103 std::string GetSupportedDevices(void) override {
104 return "atmega328p,atmega2560,attiny85,PIC16F1516,PIC16F18324,PIC16F18855,PIC16F1619,PIC16F1788,PIC16F1789,"
105 "PIC16F1827,PIC16F1829,PIC16F1847,PIC16F1939,PIC16F1947,PIC16F628A,PIC16F648A,PIC16F688,PIC16F84A,"
106 "PIC16F777,PIC16F819,PIC16F877A,PIC16F886,PIC16F887,PIC18F24Q10,PIC18F26K80,PIC18F27K40,PIC18F452,"
107 "PIC18F4520,PIC18F4550,PIC18F45K50,PIC18F4580,PIC18F4620,PIC18F46J50,PIC18F47K40,PIC18F67J60,"
108 "PIC18F67J94,";
109 };
110 // Reset board status
111 void Reset(void) override;
112 // Event on the board
113 void EvMouseButtonPress(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override;
114 // Event on the board
115 void EvMouseButtonRelease(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override;
116 // Event on the board
117 void EvKeyPress(unsigned int key, unsigned int mask) override;
118 // Event on the board
119 void EvKeyRelease(unsigned int key, unsigned int mask) override;
120 // Called ever 1s to refresh status
121 void RefreshStatus(void) override;
122 // Called to save board preferences in configuration file
123 void WritePreferences(void) override;
124 // Called whe configuration file load preferences
125 void ReadPreferences(char* name, char* value) override;
126 // return the input ids numbers of names used in input map
127 unsigned short GetInputId(char* name) override;
128 // return the output ids numbers of names used in output map
129 unsigned short GetOutputId(char* name) override;
130 void EndServers(void) override;
131 int GetDefaultClock(void) override;
132};
133
134#endif /* BOARD_Breadboard_H */
Definition bsim_picsim.h:34
Definition bsim_simavr.h:56
Definition board_Breadboard.h:38
void MSetPinOAV(int pin, float value) override
board microcontroller set digital pin output average value
Definition board_Breadboard.cc:849
std::string GetDebugName(void) override
Get debug interface name.
Definition board_Breadboard.cc:614
int MGetArchitecture(void) override
Return board microcontroller architecture.
Definition board_Breadboard.cc:710
void MSetVCC(float vcc) override
board microcontroller set vcc
Definition board_Breadboard.cc:768
void DBGSetPC(unsigned int pc) override
board microcontroller set PC
Definition board_Breadboard.cc:1000
int MGetPinCount(void) override
board microcontroller pin count
Definition board_Breadboard.cc:803
unsigned char * DBGGetRAM_p(void) override
board microcontroller get RAM memory pointer
Definition board_Breadboard.cc:1014
unsigned char * DBGGetCONFIG_p(void) override
board microcontroller get CONFIG memory pointer
Definition board_Breadboard.cc:1038
int MInit(const char *processor, const char *fname, float freq) override
board microcontroller init
Definition board_Breadboard.cc:660
unsigned char * DBGGetEEPROM_p(void) override
board microcontroller get data EEPROM memory pointer
Definition board_Breadboard.cc:1062
int GetUARTTX(const int uart_num) override
Return the UART N TX pin number.
Definition board_Breadboard.cc:1157
unsigned char * DBGGetROM_p(void) override
board microcontroller get ROM (FLASH) memory pointer
Definition board_Breadboard.cc:1026
unsigned int DBGGetCONFIGSize(void) override
board microcontroller get CONFIG memory size
Definition board_Breadboard.cc:1098
void EndServers(void) override
board servers shutdown
Definition board_Breadboard.cc:1214
float MGetVCC(void) override
board microcontroller get vcc
Definition board_Breadboard.cc:779
unsigned short * DBGGetProcID_p(void) override
board microcontroller get pointer to processor ID
Definition board_Breadboard.cc:976
void SetScale(double scale) override
Set board draw scale.
Definition board_Breadboard.cc:1181
void MStepResume(void) override
board microcontroller run one or two steps to resume instruction
Definition board_Breadboard.cc:918
std::string MGetPinName(int pin) override
board microcontroller pin name
Definition board_Breadboard.cc:815
std::string GetSupportedDevices(void) override
Return a list of supported microcontrollers.
Definition board_Breadboard.h:103
int MDumpMemory(const char *fname) override
board microcontroller save non volatile memory to hex file
Definition board_Breadboard.cc:722
unsigned char MGetPin(int pin) override
board microcontroller get digital pin value
Definition board_Breadboard.cc:871
void Reset(void) override
Reset board status.
Definition board_Breadboard.cc:102
void MEnd(void) override
board microcontroller end
Definition board_Breadboard.cc:699
void RefreshStatus(void) override
Called ever 1s to refresh status.
Definition board_Breadboard.cc:125
void EvKeyPress(unsigned int key, unsigned int mask) override
Event on the board.
Definition board_Breadboard.cc:205
void Draw(void) override
Called ever 100ms to draw board.
Definition board_Breadboard.cc:286
void EvMouseButtonPress(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override
Event on the board.
Definition board_Breadboard.cc:213
void MSetAPin(int pin, float value) override
board microcontroller set analog pin
Definition board_Breadboard.cc:860
int MGetResetPin(void) override
Get the Reset pin of microcontroller.
Definition board_Breadboard.cc:941
void MStep(void) override
board microcontroller run one step
Definition board_Breadboard.cc:907
void ReadPreferences(char *name, char *value) override
Called whe configuration file load preferences.
Definition board_Breadboard.cc:184
const picpin * MGetPinsValues(void) override
board microcontroller get all pins list struct
Definition board_Breadboard.cc:883
unsigned int DBGGetRAMSize(void) override
board microcontroller get RAM memory size
Definition board_Breadboard.cc:1074
void MEraseFlash(void) override
board microcontroller erase flash memory (program)
Definition board_Breadboard.cc:734
void MSetPinDOV(int pin, unsigned char ovalue) override
board microcontroller set Default Open Value (external pull)
Definition board_Breadboard.cc:838
unsigned char * DBGGetID_p(void) override
board microcontroller get internal IDS memory pointer
Definition board_Breadboard.cc:1050
float * MGetPinOAVPtr(int pin) override
board microcontroller get pointer to digital pin average value
Definition board_Breadboard.cc:895
int DebugInit(int dtyppe) override
Start debug support.
Definition board_Breadboard.cc:602
int MGetIOUpdated(void) override
get microcontroler status IO updated
Definition board_Breadboard.cc:953
std::string GetAboutInfo(void) override
Return the about information of part.
Definition board_Breadboard.h:47
float MGetInstClockFreq(void) override
board microcontroller get cpu internal clock (in PIC frequency/4)
Definition board_Breadboard.cc:791
void MSetFreq(float freq) override
board microcontroller set frequency
Definition board_Breadboard.cc:745
unsigned int DBGGetROMSize(void) override
board microcontroller get ROM (FLASH) memory size
Definition board_Breadboard.cc:1086
int CpuInitialized(void) override
return true if microcontroller is initialized
Definition board_Breadboard.cc:637
void MSetSerial(const char *port) override
Set serial port name to use.
Definition board_Breadboard.cc:649
float MGetFreq(void) override
board microcontroller get frequency
Definition board_Breadboard.cc:756
void MClearIOUpdated(void) override
clear microcontroler status IO updated
Definition board_Breadboard.cc:965
unsigned int DBGGetPC(void) override
board microcontroller get PC
Definition board_Breadboard.cc:988
void DebugLoop(void) override
debug step (pooling)
Definition board_Breadboard.cc:626
void EvKeyRelease(unsigned int key, unsigned int mask) override
Event on the board.
Definition board_Breadboard.cc:209
std::string GetName(void) override
Get board name registered in PICSimLab.
Definition board_Breadboard.h:46
unsigned int DBGGetEEPROM_Size(void) override
board microcontroller get data EEPROM memory size
Definition board_Breadboard.cc:1122
int MReset(int flags) override
board microcontroller reset
Definition board_Breadboard.cc:929
unsigned int DBGGetIDSize(void) override
board microcontroller get internal IDS memory size
Definition board_Breadboard.cc:1110
void Run_CPU(void) override
Paralle thread called ever 100ms to run cpu code.
Definition board_Breadboard.cc:383
void WritePreferences(void) override
Called to save board preferences in configuration file.
Definition board_Breadboard.cc:175
void MSetPin(int pin, unsigned char value) override
board microcontroller set digital pin
Definition board_Breadboard.cc:827
int GetUARTRX(const int uart_num) override
Return the UART N RX pin number.
Definition board_Breadboard.cc:1146
unsigned short GetInputId(char *name) override
return the input ids numbers of names used in input map
Definition board_Breadboard.cc:50
int GetDefaultClock(void) override
Get board default clock in MHz.
Definition board_Breadboard.cc:1134
void EvMouseButtonRelease(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override
Event on the board.
Definition board_Breadboard.cc:259
unsigned short GetOutputId(char *name) override
return the output ids numbers of names used in output map
Definition board_Breadboard.cc:66