30#include "../devices/bitbang_i2c.h"
31#include "../devices/bitbang_out.h"
32#include "../devices/bitbang_pwm.h"
33#include "../devices/bitbang_spi.h"
34#include "../devices/bitbang_uart.h"
35#include "../lib/board.h"
38typedef enum { QEMU_SIM_NONE = 0, QEMU_SIM_STM32, QEMU_SIM_ESP32, QEMU_SIM_ESP32_C3 } QEMUSimType;
40#define TTIMEOUT (BASETIMER * 1000000L)
51 int MInit(
const char* processor,
const char* fname,
float freq)
override;
52 void MEnd(
void)
override;
58 void MSetVCC(
float vcc)
override;
61 void MSetPin(
int pin,
unsigned char value)
override;
62 void MSetPinDOV(
int pin,
unsigned char ovalue)
override;
63 unsigned char MGetPin(
int pin)
override;
65 void MStep(
void)
override;
67 void MReset(
int flags)
override;
70 int GetInc_ns(
void) {
return inc_ns; };
71 virtual void PinsExtraConfig(
int cfg) {};
73 virtual void Run_CPU_ns(uint64_t time) = 0;
81 int GetUARTRX(
const int uart_num)
override;
82 int GetUARTTX(
const int uart_num)
override;
83 virtual std::string
GetClkLabel(
void)
override {
return "IO (Mhz)"; };
86 int MipsStrToIcount(
const char* mipstr);
87 const char* IcountToMipsStr(
int icount);
88 const char* IcountToMipsItens(
char* buffer);
89 unsigned int ns_count;
90 void pins_reset(
void);
91 virtual void BoardOptions(
int* argc,
char** argv) {};
92 virtual const short int* GetPinMap(
void) = 0;
101 unsigned int serialbaud;
107 char fname_bak[2048];
108 unsigned short ADCvalues[16];
110 std::atomic_int qemu_started;
113 int use_cmdline_extra;
114 std::string cmdline_extra;
116 unsigned int application_offset;
117 int ConfEnableSerial;
121 int load_qemu_lib(
const char* path);
Board class.
Definition board.h:111
Definition bsim_qemu.h:42
void MSetPinDOV(int pin, unsigned char ovalue) override
board microcontroller set Default Open Value (external pull)
Definition bsim_qemu.cc:1154
float MGetFreq(void) override
board microcontroller get frequency
Definition bsim_qemu.cc:1002
int MInit(const char *processor, const char *fname, float freq) override
board microcontroller init
Definition bsim_qemu.cc:361
void MSetFreq(float freq) override
board microcontroller set frequency
Definition bsim_qemu.cc:996
void IoLockAccess(void) override
Lock IO to others threads access.
Definition bsim_qemu.cc:1299
void MEraseFlash(void) override
board microcontroller erase flash memory (program)
Definition bsim_qemu.cc:992
float MGetVCC(void) override
board microcontroller get vcc
Definition bsim_qemu.cc:1010
int GetDefaultClock(void) override
Get board default clock in MHz.
Definition bsim_qemu.h:69
float MGetInstClockFreq(void) override
board microcontroller get cpu internal clock (in PIC frequency/4)
Definition bsim_qemu.cc:1014
unsigned char MGetPin(int pin) override
board microcontroller get digital pin value
Definition bsim_qemu.cc:1158
virtual std::string GetClkLabel(void) override
Return the description of clk label.
Definition bsim_qemu.h:83
void MEnd(void) override
board microcontroller end
Definition bsim_qemu.cc:961
std::string GetDebugName(void) override
Get debug interface name.
Definition bsim_qemu.h:47
void MStep(void) override
board microcontroller run one step
Definition bsim_qemu.cc:1196
void MStepResume(void) override
board microcontroller run one or two steps to resume instruction
Definition bsim_qemu.h:66
void EvThreadRun(void) override
Event on the board.
Definition bsim_qemu.cc:417
int DebugInit(int dtyppe) override
Start debug support.
Definition bsim_qemu.cc:1113
int MGetArchitecture(void) override
Return board microcontroller architecture.
Definition bsim_qemu.cc:984
void MReset(int flags) override
board microcontroller reset
Definition bsim_qemu.cc:1165
int GetUARTTX(const int uart_num) override
Return the UART N TX pin number.
Definition bsim_qemu.cc:1314
void MSetSerial(const char *port) override
Set serial port name to use.
Definition bsim_qemu.cc:359
int GetUARTRX(const int uart_num) override
Return the UART N RX pin number.
Definition bsim_qemu.cc:1307
int MDumpMemory(const char *fname) override
board microcontroller save non volatile memory to hex file
Definition bsim_qemu.cc:1024
const picpin * MGetPinsValues(void) override
board microcontroller get all pins list struct
Definition bsim_qemu.cc:1192
int CpuInitialized(void) override
return true if microcontroller is initialized
Definition bsim_qemu.cc:1018
void DebugLoop(void) override
debug step (pooling)
Definition bsim_qemu.cc:1022
void MSetPin(int pin, unsigned char value) override
board microcontroller set digital pin
Definition bsim_qemu.cc:1143
void MSetVCC(float vcc) override
board microcontroller set vcc
Definition bsim_qemu.cc:1006
void IoUnlockAccess(void) override
Unlock IO to others threads access.
Definition bsim_qemu.cc:1303
Definition bitbang_i2c.h:39
Definition bitbang_out.h:33
Definition bitbang_pwm.h:43
Definition bitbang_spi.h:35
Definition bitbang_uart.h:35