+//-----------------------------------------------------------------------------
+// Work with emulator memory
+//
+// Note: we call FpgaDownloadAndGo(FPGA_BITSTREAM_HF) here although FPGA is not
+// involved in dealing with emulator memory. But if it is called later, it might
+// destroy the Emulator Memory.
+//-----------------------------------------------------------------------------
+// arg0 = offset
+// arg1 = num of bytes
+void LegicEMemSet(uint32_t arg0, uint32_t arg1, uint8_t *data) {
+ FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
+ legic_emlset_mem(data, arg0, arg1);
+}
+// arg0 = offset
+// arg1 = num of bytes
+void LegicEMemGet(uint32_t arg0, uint32_t arg1) {
+ FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
+ uint8_t buf[USB_CMD_DATA_SIZE] = {0x00};
+ legic_emlget_mem(buf, arg0, arg1);
+ LED_B_ON();
+ cmd_send(CMD_ACK, arg0, arg1, 0, buf, USB_CMD_DATA_SIZE);
+ LED_B_OFF();
+}
+void legic_emlset_mem(uint8_t *data, int offset, int numofbytes) {
+ cardmem = BigBuf_get_EM_addr();
+ memcpy(cardmem + offset, data, numofbytes);
+}
+void legic_emlget_mem(uint8_t *data, int offset, int numofbytes) {
+ cardmem = BigBuf_get_EM_addr();
+ memcpy(data, cardmem + offset, numofbytes);
+}