30#define NSTEPKF (4000.0 / BASETIMER)
31#define NSTEPKT (1e6 / NSTEPKF)
34extern char SERIALDEVICE[100];
51 void SetSharePath(std::string spath) { SHARE = spath; };
53 std::string GetLibPath(
void) {
return libpath; };
54 void SetLibPath(std::string lpath) { libpath = lpath; };
56 std::string GetHomePath(
void) {
return HOME; };
57 void SetHomePath(std::string home) { HOME = home; };
59 std::string GetPath(
void) {
return PATH; };
60 void SetPath(std::string path) { PATH = path; };
62 std::string GetFNAME(
void) {
return FNAME; };
63 void SetFNAME(std::string fname) { FNAME = fname; };
65 std::string GetOldPath(
void) {
return OldPath; };
66 void SetOldPath(std::string op) { OldPath = op; };
68 std::string GetProcessorName(
void) {
return proc_; };
69 void SetProcessorName(std::string pn) { proc_ = pn; };
71 long int GetNSTEP(
void) {
return NSTEP; };
72 void SetNSTEP(
long int ns) { NSTEP = ns; };
78 void SetNSTEPJ(
long int nsj) { NSTEPJ = nsj; };
84 void SetJUMPSTEPS(
int js);
90 void SetBoard(
board* b) { pboard = b; };
91 void DeleteBoard(
void);
103 int GetMcuDbg(
void) {
return mcudbg; };
111 SetCpuState(CPU_RUNNING);
113 SetCpuState(CPU_POWER_OFF);
116 void SetCpuState(
const PICSimlabCPUState cs);
123 char GetCpuState(
void) {
return cpustate; };
125 void Set_mcudbg(
int pd);
127 void SetMcuRun(
int mr) { mcurun = mr; };
128 int GetMcuRun(
void) {
return mcurst; };
175 void SetClock(
const float clk,
const int update = 1);
176 float GetClock(
void);
181 void SavePrefs(std::string name, std::string value);
183 void PrefsClear(
void) { prefs.clear(); };
184 int PrefsSaveToFile(std::string fname) {
return SaveToFile(prefs, fname.c_str()); };
185 int PrefsLoadFromFile(std::string fname) {
return LoadFromFile(prefs, fname.c_str()); };
186 unsigned int PrefsGetLinesCount(
void) {
return prefs.size(); };
187 std::string PrefsGetLine(
int ln) {
return prefs.at(ln); };
189 void OpenLoadHexFileDialog(
void);
191 void SetNeedReboot(
int nr = 1);
192 int GetNeedReboot(
void) {
return NeedReboot; };
194 void RegisterError(
const std::string error);
195 int GetErrorCount(
void) {
return Errors.size(); };
197 std::string GetError(
int en) {
return Errors.at(en); };
199 void DeleteError(
int en) { Errors.erase(Errors.begin() + en); };
201 void EndSimulation(
int saveold = 0,
const char* newpath = NULL);
203 void SetWorkspaceFileName(
const std::string fname) { Workspacefn = fname; };
205 void SetLabs(
const int lb,
const int lb_) {
210 int GetLab(
void) {
return lab; };
211 int GetLab_(
void) {
return lab_; };
213 int LoadHexFile(std::string fname);
215 void LoadWorkspace(std::string fnpzw,
const int show_readme = 1);
216 void SaveWorkspace(std::string fnpzw);
218 void SetSimulationRun(
int run);
219 int GetSimulationRun(
void);
221 double GetScale(
void) {
return scale; };
222 void SetScale(
double s) { scale = s; };
224 int GetNeedResize(
void) {
return need_resize; };
225 void SetNeedResize(
int nr) { need_resize = nr; };
227 void Configure(
const char* home,
int use_default_board = 0,
int create = 0,
const char* lfile = NULL,
228 const int disable_debug = 0);
230 void SetplWidth(
int pw) { plWidth = pw; };
232 void SetplHeight(
int ph) { plHeight = ph; };
234 double GetIdleMs(
void);
235 void SetIdleMs(
double im);
237 int GetUseDSRReset(
void) {
return use_dsr_reset; };
238 void SetUseDSRReset(
int udsr) { use_dsr_reset = udsr; };
240 void SetToDestroy(
void);
241 int GetToDestroy(
void) {
return settodestroy; };
243 void SetSync(
unsigned char s) { sync = s; };
244 unsigned char GetSync(
void) {
return sync; };
246 char* GetPzwTmpdir(
void) {
return pzwtmpdir; };
248 void UpdateStatus(
const PICSimlabStatus field,
const std::string msg);
250 void* UpdateGUI(
const int id,
const PICSimlabGUIType type,
const PICSimlabGUIAction action,
const void* arg);
252 void ConfigMenuGUI(
const PICSimlabGUIMenu type);
256 static int WindowCmd(
const int id,
const char* ControlName,
const PICSimLabWindowAction action,
const char* Value,
257 void* ReturnBuff = NULL);
259 static int SystemCmd(
const PICSimLabSystemCmd cmd,
const char* Arg,
void* ReturnBuff = NULL);
263 unsigned short int status;
272 void (*OnUpdateStatus)(
const int field,
const std::string msg);
273 void (*OnConfigure)(void);
274 void (*OnClockSet)(
const float clk,
const int update);
275 void (*OnReadPreferences)(
const char* name,
const char* value,
const int create);
276 void (*OnSavePrefs)(void);
277 void (*OnLoadHexFile)(
const std::string fname);
278 void (*OnOpenLoadHexFileDialog)(void);
279 void (*OnEndSimulation)(void);
280 void* (*OnUpdateGUI)(
const int id,
const PICSimlabGUIType type,
const PICSimlabGUIAction action,
const void* arg);
281 void (*OnConfigMenuGUI)(
const PICSimlabGUIMenu type);
284 int (*OnWindowCmd)(
const int id,
const char* ControlName,
const PICSimLabWindowAction action,
const char* Value,
286 int (*OnSystemCmd)(
const PICSimLabSystemCmd cmd,
const char* Arg,
void* ReturnBuff);
289 void StartRControl(
void);
302 PICSimlabCPUState cpustate;
303 unsigned short debug_port;
304 unsigned short remotec_port;
315 std::vector<std::string> prefs;
317 std::vector<std::string> Errors;
318 std::string Workspacefn;
323 char pzwtmpdir[1024];
329#define msleep(x) Sleep(x)
333#define msleep(x) usleep(x * 1000)
342#define NULLFILE "\\\\.\\NUL"
344#define NULLFILE "/dev/null"
Definition picsimlab.h:41
void SetMcuRst(int pr)
Set mcu rst flag (inform simulator about mcu reset state)
Definition picsimlab.h:121
int GetMcuRst(void)
Retunr if microcontroller reset pin is enabled.
Definition picsimlab.h:101
void SetDebugStatus(int dbs)
Set debug status flag.
Definition picsimlab.cc:215
long int GetNSTEPJ(void)
Get the number of steps in 100ms of simulation.
Definition picsimlab.h:77
void SetRemotecPort(unsigned short rcp)
Set remote control TCP port.
Definition picsimlab.cc:203
std::string GetSharePath(void)
Get the file path of resources.
Definition picsimlab.h:50
void SetMcuPwr(int pp)
Set the power status of microcontroller ON/OFF.
Definition picsimlab.h:108
void SetDebugPort(unsigned short dp)
Set debug TCP port.
Definition picsimlab.cc:199
int GetDebugStatus(void)
Get debug status (On/Off)
Definition picsimlab.cc:211
int GetMcuPwr(void)
Return actual power status of microcontroller ON/OFF.
Definition picsimlab.h:96
unsigned short GetRemotecPort(void)
Return the selected remote control port.
Definition picsimlab.h:143
int GetInstanceNumber(void)
Return the program instance number.
Definition picsimlab.h:153
int GetDebugType(void)
Return the selected debugger type.
Definition picsimlab.h:158
int GetJUMPSTEPS(void)
Get the number of steps to be skipped in board update.
Definition picsimlab.h:83
board * GetBoard(void)
Return a pointer to board object.
Definition picsimlab.h:89
unsigned short GetDebugPort(void)
Return the selected debugger port.
Definition picsimlab.h:133
void SetDebugType(int dt)
Set debug type (MDB or GDB)
Definition picsimlab.h:163
void SavePrefs(std::string name, std::string value)
Save the preferences.
Definition picsimlab.cc:251
Board class.
Definition board.h:111