Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: BaseEmuISP.h
- Revision:
- 1:4ff199bddbc1
- Child:
- 2:e3c085ac77f1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/BaseEmuISP.h Tue Mar 08 12:03:48 2016 +0900
@@ -0,0 +1,82 @@
+// BaseEmuISP.h 2016/3/8
+#pragma once
+#include <string>
+#include <vector>
+
+#define M_RESET 0
+#define M_SYNC 1
+#define M_CMD 2
+#define M_CMD_W_DATA 3
+#define M_CMD_R_DATA 4
+#define M_CMD_J 5
+#define M_CMD_K 6
+#define M_CMD_N 7
+
+// Return Code
+#define CMD_SUCCESS 0
+#define INVALID_COMMAND 1
+#define SRC_ADDR_ERROR 2
+#define DST_ADDR_ERROR 3
+#define SRC_ADDR_NOT_MAPPED 4
+#define DST_ADDR_NOT_MAPPED 5
+#define COUNT_ERROR 6
+#define INVALID_SECTOR 7
+#define SECTOR_NOT_BLANK 8
+#define SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION 9
+#define COMPARE_ERROR 10
+#define BUSY 11
+#define PARAM_ERROR 12
+#define ADDR_ERROR 13
+#define ADDR_NOT_MAPPED 14
+#define CMD_LOCKED 15
+#define INVALID_CODE 16
+#define INVALID_BAUD_RATE 17
+#define INVALID_STOP_BIT 18
+#define CODE_READ_PROTECTIN_ENABLED 19
+
+class BaseEmuISP {
+public:
+ void Reset();
+ void Poll();
+
+protected:
+ virtual int Part() { return 0; }
+ virtual void WriteData(int addr, int c) {}
+ virtual int ReadData(int addr) { return 0; }
+ virtual void CopyData(int dst, int src, int count) {}
+ virtual bool SectorExist(int sector) { return true; }
+ virtual int Getch() = 0;
+ virtual void Putch(int c) = 0;
+ virtual void DebugPutch(int c) { return; }
+
+private:
+ bool sync();
+ int cmd(const char* s);
+ int cmd_u(int arg, int p1);
+ int cmd_b(int arg, int p1, int p2);
+ int cmd_a(int arg, int p1);
+ int cmd_w(int arg, int p1, int p2);
+ int cmd_r(int arg, int p1, int p2);
+ int cmd_p(int arg, int p1, int p2);
+ int cmd_c(int arg, int p1, int p2, int p3);
+ int cmd_g(int arg, int p1, int p2);
+ int cmd_e(int arg, int p1, int p2);
+ int cmd_i(int arg, int p1, int p2);
+ int cmd_j(int arg);
+ int cmd_k(int arg);
+ int cmd_m(int arg, int p1, int p2, int p3);
+ int cmd_n(int arg);
+ int cmd_s(int arg, int p1, int p2);
+ void putln(const char *s);
+ bool line_proc();
+ void debugPrintf(const char *format, ...);
+ int mode;
+ int seq;
+ bool echoFlag;
+ bool lockFlag;
+ std::string line;
+ int freq;
+ int addr;
+ int count;
+};
+