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-2024 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 "bsim_picsim.h"
30#include "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 MSetAPin(int pin, float value) override;
68 unsigned char MGetPin(int pin) override;
69 const picpin* MGetPinsValues(void) override;
70 void MStep(void) override;
71 void MStepResume(void) override;
72 void MReset(int flags) override;
73 unsigned short* DBGGetProcID_p(void) override;
74 unsigned int DBGGetPC(void) override;
75 void DBGSetPC(unsigned int pc) override;
76 unsigned char* DBGGetRAM_p(void) override;
77 unsigned char* DBGGetROM_p(void) override;
78 unsigned char* DBGGetCONFIG_p(void) override;
79 unsigned char* DBGGetID_p(void) override;
80 unsigned char* DBGGetEEPROM_p(void) override;
81 unsigned int DBGGetRAMSize(void) override;
82 unsigned int DBGGetROMSize(void) override;
83 unsigned int DBGGetCONFIGSize(void) override;
84 unsigned int DBGGetIDSize(void) override;
85 unsigned int DBGGetEEPROM_Size(void) override;
86 int GetUARTRX(const int uart_num) override;
87 int GetUARTTX(const int uart_num) override;
88
89 // Constructor called once on board creation
91 // Destructor called once on board destruction
93 // Called ever 100ms to draw board
94 void Draw(void) override;
95 void Run_CPU(void) override;
96 // Return a list of board supported microcontrollers
97 std::string GetSupportedDevices(void) override {
98 return "atmega328p,atmega2560,attiny85,PIC16F1516,PIC16F18324,PIC16F18855,PIC16F1619,PIC16F1788,PIC16F1789,"
99 "PIC16F1827,PIC16F1829,PIC16F1847,PIC16F1939,PIC16F1947,PIC16F628A,PIC16F648A,PIC16F688,PIC16F84A,"
100 "PIC16F777,PIC16F819,PIC16F877A,PIC16F886,PIC16F887,PIC18F24Q10,PIC18F26K80,PIC18F27K40,PIC18F452,"
101 "PIC18F4520,PIC18F4550,PIC18F45K50,PIC18F4580,PIC18F4620,PIC18F46J50,PIC18F47K40,PIC18F67J60,"
102 "PIC18F67J94,";
103 };
104 // Reset board status
105 void Reset(void) override;
106 // Event on the board
107 void EvMouseButtonPress(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override;
108 // Event on the board
109 void EvMouseButtonRelease(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override;
110 // Event on the board
111 void EvKeyPress(unsigned int key, unsigned int mask) override;
112 // Event on the board
113 void EvKeyRelease(unsigned int key, unsigned int mask) override;
114 // Called ever 1s to refresh status
115 void RefreshStatus(void) override;
116 // Called to save board preferences in configuration file
117 void WritePreferences(void) override;
118 // Called whe configuration file load preferences
119 void ReadPreferences(char* name, char* value) override;
120 // return the input ids numbers of names used in input map
121 unsigned short GetInputId(char* name) override;
122 // return the output ids numbers of names used in output map
123 unsigned short GetOutputId(char* name) override;
124 void EndServers(void) override;
125 int GetDefaultClock(void) override;
126};
127
128#endif /* BOARD_Breadboard_H */
Definition bsim_picsim.h:34
Definition bsim_simavr.h:56
Definition board_Breadboard.h:38
std::string GetDebugName(void) override
Get debug interface name.
Definition board_Breadboard.cc:654
int MGetArchitecture(void) override
Return board microcontroller architecture.
Definition board_Breadboard.cc:750
void MSetVCC(float vcc) override
board microcontroller set vcc
Definition board_Breadboard.cc:808
void DBGSetPC(unsigned int pc) override
board microcontroller set PC
Definition board_Breadboard.cc:981
int MGetPinCount(void) override
board microcontroller pin count
Definition board_Breadboard.cc:843
unsigned char * DBGGetRAM_p(void) override
board microcontroller get RAM memory pointer
Definition board_Breadboard.cc:995
unsigned char * DBGGetCONFIG_p(void) override
board microcontroller get CONFIG memory pointer
Definition board_Breadboard.cc:1019
void MReset(int flags) override
board microcontroller reset
Definition board_Breadboard.cc:946
int MInit(const char *processor, const char *fname, float freq) override
board microcontroller init
Definition board_Breadboard.cc:700
unsigned char * DBGGetEEPROM_p(void) override
board microcontroller get data EEPROM memory pointer
Definition board_Breadboard.cc:1043
int GetUARTTX(const int uart_num) override
Return the UART N TX pin number.
Definition board_Breadboard.cc:1138
unsigned char * DBGGetROM_p(void) override
board microcontroller get ROM (FLASH) memory pointer
Definition board_Breadboard.cc:1007
unsigned int DBGGetCONFIGSize(void) override
board microcontroller get CONFIG memory size
Definition board_Breadboard.cc:1079
void EndServers(void) override
board servers shutdown
Definition board_Breadboard.cc:1183
float MGetVCC(void) override
board microcontroller get vcc
Definition board_Breadboard.cc:819
unsigned short * DBGGetProcID_p(void) override
board microcontroller get pointer to processor ID
Definition board_Breadboard.cc:957
void SetScale(double scale) override
Set board draw scale.
Definition board_Breadboard.cc:1150
void MStepResume(void) override
board microcontroller run one or two steps to resume instruction
Definition board_Breadboard.cc:935
std::string MGetPinName(int pin) override
board microcontroller pin name
Definition board_Breadboard.cc:855
std::string GetSupportedDevices(void) override
Return a list of supported microcontrollers.
Definition board_Breadboard.h:97
int MDumpMemory(const char *fname) override
board microcontroller save non volatile memory to hex file
Definition board_Breadboard.cc:762
unsigned char MGetPin(int pin) override
board microcontroller get digital pin value
Definition board_Breadboard.cc:900
void Reset(void) override
Reset board status.
Definition board_Breadboard.cc:102
void MEnd(void) override
board microcontroller end
Definition board_Breadboard.cc:739
void RefreshStatus(void) override
Called ever 1s to refresh status.
Definition board_Breadboard.cc:148
void EvKeyPress(unsigned int key, unsigned int mask) override
Event on the board.
Definition board_Breadboard.cc:245
void Draw(void) override
Called ever 100ms to draw board.
Definition board_Breadboard.cc:326
void EvMouseButtonPress(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override
Event on the board.
Definition board_Breadboard.cc:253
void MSetAPin(int pin, float value) override
board microcontroller set analog pin
Definition board_Breadboard.cc:889
void MStep(void) override
board microcontroller run one step
Definition board_Breadboard.cc:924
void ReadPreferences(char *name, char *value) override
Called whe configuration file load preferences.
Definition board_Breadboard.cc:224
const picpin * MGetPinsValues(void) override
board microcontroller get all pins list struct
Definition board_Breadboard.cc:912
unsigned int DBGGetRAMSize(void) override
board microcontroller get RAM memory size
Definition board_Breadboard.cc:1055
void MEraseFlash(void) override
board microcontroller erase flash memory (program)
Definition board_Breadboard.cc:774
void MSetPinDOV(int pin, unsigned char ovalue) override
board microcontroller set Default Open Value (external pull)
Definition board_Breadboard.cc:878
unsigned char * DBGGetID_p(void) override
board microcontroller get internal IDS memory pointer
Definition board_Breadboard.cc:1031
int DebugInit(int dtyppe) override
Start debug support.
Definition board_Breadboard.cc:642
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:831
void MSetFreq(float freq) override
board microcontroller set frequency
Definition board_Breadboard.cc:785
unsigned int DBGGetROMSize(void) override
board microcontroller get ROM (FLASH) memory size
Definition board_Breadboard.cc:1067
int CpuInitialized(void) override
return true if microcontroller is initialized
Definition board_Breadboard.cc:677
void MSetSerial(const char *port) override
Set serial port name to use.
Definition board_Breadboard.cc:689
float MGetFreq(void) override
board microcontroller get frequency
Definition board_Breadboard.cc:796
unsigned int DBGGetPC(void) override
board microcontroller get PC
Definition board_Breadboard.cc:969
void DebugLoop(void) override
debug step (pooling)
Definition board_Breadboard.cc:666
void EvKeyRelease(unsigned int key, unsigned int mask) override
Event on the board.
Definition board_Breadboard.cc:249
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:1103
unsigned int DBGGetIDSize(void) override
board microcontroller get internal IDS memory size
Definition board_Breadboard.cc:1091
void Run_CPU(void) override
Paralle thread called ever 100ms to run cpu code.
Definition board_Breadboard.cc:423
void WritePreferences(void) override
Called to save board preferences in configuration file.
Definition board_Breadboard.cc:215
void MSetPin(int pin, unsigned char value) override
board microcontroller set digital pin
Definition board_Breadboard.cc:867
int GetUARTRX(const int uart_num) override
Return the UART N RX pin number.
Definition board_Breadboard.cc:1127
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:1115
void EvMouseButtonRelease(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override
Event on the board.
Definition board_Breadboard.cc:299
unsigned short GetOutputId(char *name) override
return the output ids numbers of names used in output map
Definition board_Breadboard.cc:66