#include #ifndef W32TST #include "cenk.h" #include "kernelmisc.h" #endif #include "vectorutils.h" #include "stringutils.h" #include "debug.h" /* 00000000: aa 00 00000002: 01 00 ======== writebuffer1 00000004: 60 01 ; wrhead1 00000006: 60 01 ; wrtail1 00000008: buffer size 0x3fc ======== writebuffer2 00000404: 00 00 ; wrhead2 00000406: 00 00 ; wrtail2 00000408: wrbuffer2 0xE90 dup(0x22) ======== readbuffer1 00001298: 20 02 ; rdhead1 0000129a: 20 02 ; rdtail1 0000129c: rdbuffer1 of size 0x3fc ======== read buffer2 00001698: 00 00 ; rdhead2 0000169a: 00 00 ; rdtail2 0000169c: 0x2950 dup(0x44) ======== 00003fec: 02 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00003ffc: 82 00 irqmask 00003ffe: 82 00 irqmask data in rd1: char magichead; // 0x7f uint16 size1; // excl head+tail ( from size1 .. tail ) uint8 seqnr1; // 0 for 'rd' uint16 size2; // from size2 .. tail uint8 seqnr2; uint8 direction;// 0x00 for 'rd', 0xff for 'wr' uint8 data[]; char magictail; // 0x7e data[0] msgclass data[1] msgcode data[2] msgtype ==msgclass== 01 PWR 7 02 CALL 10 03 - 04 SMS 17 05 SEC 9 06 PB 5 07 DISP 2 08 NET 12 09 SND 16 0A MISC 14 0B SVC 7 0C SS 10 0D GPRS 16 0E SAT 13 0F CFG 15 10 IMEI 8 11 GPS 22 12 SAP 7 ==msgtype== request response 0 1 exec indi 2 get resp 3 set noti 4 cfrm 5 event */ struct bufinfo { DWORD base; DWORD size; const char*name; }; struct dprambuffer { WORD head; WORD tail; BYTE data[1]; }; bufinfo dprbufs[]= { { 0x0004, 0x03fc, "wr1" }, { 0x0404, 0x0e90, "wr2" }, { 0x1298, 0x03fc, "rd1" }, { 0x1698, 0x2950, "rd2" }, }; #define NBUFS (sizeof(dprbufs)/sizeof(*dprbufs)) static int g_devtype=-1; inline WORD read_hword(DWORD ofs) { return *(WORD*)ofs; } template void read_mem(DWORD ofs, DWORD size, T &buf) { buf.resize(size/sizeof(T::value_type)); memcpy(vectorptr(buf), (void*)ofs, size); } void write_diffs(int i, WORD prev, WORD cur, ByteVector::const_iterator bufstart, ByteVector::const_iterator bufend, const char *type) { if (prev==cur) { return; } ByteVector diff; if (prevhead); ptrs.push_back(dp->tail); } if (ptrs!=prevptrs) { for (int i=0 ; i