30#define NSTEPKF (4000.0 / BASETIMER)
31#define NSTEPKT (1e6 / NSTEPKF)
34extern char SERIALDEVICE[100];
52 void SetSharePath(std::string spath) { SHARE = spath; };
54 std::string GetLibPath(
void) {
return libpath; };
55 void SetLibPath(std::string lpath) { libpath = lpath; };
57 std::string GetHomePath(
void) {
return HOME; };
58 void SetHomePath(std::string home) { HOME = home; };
60 std::string GetPath(
void) {
return PATH; };
61 void SetPath(std::string path) { PATH = path; };
63 std::string GetFNAME(
void) {
return FNAME; };
64 void SetFNAME(std::string fname) { FNAME = fname; };
66 std::string GetOldPath(
void) {
return OldPath; };
67 void SetOldPath(std::string op) { OldPath = op; };
69 std::string GetProcessorName(
void) {
return proc_; };
70 void SetProcessorName(std::string pn) { proc_ = pn; };
72 long int GetNSTEP(
void) {
return NSTEP; };
73 void SetNSTEP(
long int ns) { NSTEP = ns; };
79 void SetNSTEPJ(
long int nsj) { NSTEPJ = nsj; };
85 void SetJUMPSTEPS(
int js);
91 void SetBoard(
board* b) { pboard = b; };
92 void DeleteBoard(
void);
104 int GetMcuDbg(
void) {
return mcudbg; };
112 SetCpuState(CPU_RUNNING);
114 SetCpuState(CPU_POWER_OFF);
117 void SetCpuState(
const PICSimlabCPUState cs);
124 char GetCpuState(
void) {
return cpustate; };
126 void Set_mcudbg(
int pd);
128 void SetMcuRun(
int mr) { mcurun = mr; };
129 int GetMcuRun(
void) {
return mcurun; };
176 void SetClock(
const float clk,
const int update = 1);
177 float GetClock(
void);
182 void SavePrefs(std::string name, std::string value);
184 void PrefsClear(
void) { prefs.clear(); };
185 int PrefsSaveToFile(std::string fname) {
return SaveToFile(prefs, fname.c_str()); };
186 int PrefsLoadFromFile(std::string fname) {
return LoadFromFile(prefs, fname.c_str()); };
187 unsigned int PrefsGetLinesCount(
void) {
return prefs.size(); };
188 std::string PrefsGetLine(
int ln) {
return prefs.at(ln); };
190 void OpenLoadHexFileDialog(
void);
192 void SetNeedReboot(
int nr = 1);
193 int GetNeedReboot(
void) {
return NeedReboot; };
195 void RegisterError(
const std::string error);
196 int GetErrorCount(
void) {
return Errors.size(); };
198 std::string GetError(
int en) {
return Errors.at(en); };
200 void DeleteError(
int en) { Errors.erase(Errors.begin() + en); };
202 void EndSimulation(
int saveold = 0,
const char* newpath = NULL);
204 void SetWorkspaceFileName(
const std::string fname) { Workspacefn = fname; };
206 void SetLabs(
const int lb,
const int lb_) {
211 int GetLab(
void) {
return lab; };
212 int GetLab_(
void) {
return lab_; };
214 int LoadHexFile(std::string fname);
216 void LoadWorkspace(std::string fnpzw,
const int show_readme = 1);
217 void SaveWorkspace(std::string fnpzw);
219 void SetSimulationRun(
int run);
220 int GetSimulationRun(
void);
222 double GetScale(
void) {
return scale; };
223 void SetScale(
double s) { scale = s; };
225 int GetNeedResize(
void) {
return need_resize; };
226 void SetNeedResize(
int nr) { need_resize = nr; };
228 void Configure(
const char* home,
int use_default_board = 0,
int create = 0,
const char* lfile = NULL,
229 const int disable_debug = 0);
231 void SetplWidth(
int pw) { plWidth = pw; };
233 void SetplHeight(
int ph) { plHeight = ph; };
235 double GetIdleMs(
void);
236 void SetIdleMs(
double im);
238 int GetUseDSRReset(
void) {
return use_dsr_reset; };
239 void SetUseDSRReset(
int udsr) { use_dsr_reset = udsr; };
241 void SetToDestroy(
int reason = RC_EXIT);
242 int GetToDestroy(
void) {
return settodestroy; };
244 void SetSync(
unsigned char s) { sync = s; };
245 unsigned char GetSync(
void) {
return sync; };
247 char* GetPzwTmpdir(
void) {
return pzwtmpdir; };
249 void UpdateStatus(
const PICSimlabStatus field,
const std::string msg);
251 void* UpdateGUI(
const int id,
const PICSimlabGUIType type,
const PICSimlabGUIAction action,
const void* arg);
253 void ConfigMenuGUI(
const PICSimlabGUIMenu type);
257 static int WindowCmd(
const int id,
const char* ControlName,
const PICSimLabWindowAction action,
const char* Value,
258 void* ReturnBuff = NULL);
260 static int SystemCmd(
const PICSimLabSystemCmd cmd,
const char* Arg,
void* ReturnBuff = NULL);
262 std::atomic<unsigned short int> status;
264 std::atomic<int> tgo;
270 void (*OnUpdateStatus)(
const int field,
const std::string msg);
271 void (*OnConfigure)(void);
272 void (*OnClockSet)(
const float clk,
const int update);
273 void (*OnReadPreferences)(
const char* name,
const char* value,
const int create);
274 void (*OnSavePrefs)(void);
275 void (*OnLoadHexFile)(
const std::string fname);
276 void (*OnOpenLoadHexFileDialog)(void);
277 void (*OnEndSimulation)(void);
278 void* (*OnUpdateGUI)(
const int id,
const PICSimlabGUIType type,
const PICSimlabGUIAction action,
const void* arg);
279 void (*OnConfigMenuGUI)(
const PICSimlabGUIMenu type);
282 int (*OnWindowCmd)(
const int id,
const char* ControlName,
const PICSimLabWindowAction action,
const char* Value,
284 int (*OnSystemCmd)(
const PICSimLabSystemCmd cmd,
const char* Arg,
void* ReturnBuff);
287 void StartRControl(
void);
300 PICSimlabCPUState cpustate;
301 unsigned short debug_port;
302 unsigned short remotec_port;
313 std::vector<std::string> prefs;
315 std::vector<std::string> Errors;
316 std::string Workspacefn;
321 char pzwtmpdir[1024];
327#define msleep(x) Sleep(x)
331#define msleep(x) usleep(x * 1000)
340#define NULLFILE "\\\\.\\NUL"
342#define NULLFILE "/dev/null"
Definition picsimlab.h:42
void SetMcuRst(int pr)
Set mcu rst flag (inform simulator about mcu reset state)
Definition picsimlab.h:122
int GetMcuRst(void)
Retunr if microcontroller reset pin is enabled.
Definition picsimlab.h:102
void SetDebugStatus(int dbs)
Set debug status flag.
Definition picsimlab.cc:217
long int GetNSTEPJ(void)
Get the number of steps in 100ms of simulation.
Definition picsimlab.h:78
void SetRemotecPort(unsigned short rcp)
Set remote control TCP port.
Definition picsimlab.cc:205
std::string GetSharePath(void)
Get the file path of resources.
Definition picsimlab.h:51
void SetMcuPwr(int pp)
Set the power status of microcontroller ON/OFF.
Definition picsimlab.h:109
void SetDebugPort(unsigned short dp)
Set debug TCP port.
Definition picsimlab.cc:201
int GetDebugStatus(void)
Get debug status (On/Off)
Definition picsimlab.cc:213
int GetMcuPwr(void)
Return actual power status of microcontroller ON/OFF.
Definition picsimlab.h:97
unsigned short GetRemotecPort(void)
Return the selected remote control port.
Definition picsimlab.h:144
int GetInstanceNumber(void)
Return the program instance number.
Definition picsimlab.h:154
int GetDebugType(void)
Return the selected debugger type.
Definition picsimlab.h:159
int GetJUMPSTEPS(void)
Get the number of steps to be skipped in board update.
Definition picsimlab.h:84
board * GetBoard(void)
Return a pointer to board object.
Definition picsimlab.h:90
unsigned short GetDebugPort(void)
Return the selected debugger port.
Definition picsimlab.h:134
void SetDebugType(int dt)
Set debug type (MDB or GDB)
Definition picsimlab.h:164
void SavePrefs(std::string name, std::string value)
Save the preferences.
Definition picsimlab.cc:253
Board class.
Definition board.h:111