#ifndef __AGDI__INCED___ #define __AGDI__INCED___ //---Revision History: ---------------------------------------------- // 17.10.2000, added AG_SYM_SFR // //------------------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif #include <Windows.h> // wg. HWND, RECT, CALLBACK, HANDLE #define _EXPO_ __declspec(dllexport) /* * Advanced GDI types */ typedef unsigned long UL32; typedef signed long SL32; typedef signed char SC8; typedef unsigned char UC8; typedef signed int I32; typedef unsigned int U32; typedef signed short int I16; typedef unsigned short int U16; typedef __int64 I64; typedef unsigned __int64 U64; typedef float F32; typedef double F64; typedef union { U32 u32; // 32-Bit signed int I32 i32; // 32-Bit unsigned int UL32 ul; // 32-Bit unsigned long SL32 sl; // 32-Bit signed long UC8 uc; // 8-Bit unsigned char SC8 sc; // 8-Bit signed char U16 u16; // 16-Bit unsigned short int I16 i16; // 16-Bit signed short int U64 u64; // 64-Bit unsigned int I64 i64; // 64-Bit signed int F32 f32; // 32-Bit single precision float F64 f64; // 64-Bit single precision float UL32 ul2 [2]; SL32 sl2 [2]; U16 u16a [4]; I16 i16a [4]; UC8 uc8 [8]; SC8 sc8 [8]; SC8 *pS; UC8 *pU; U16 *pW; U32 *pD; } GVAL; /* * 166/167 specific's */ #define mWREG 0x100 // 0x100...0x10F := R0...R15 #define mBREG 0x200 // 0x200...0x20F := RL0...RH7 #define mDREG 0x300 // not used. #define mDPP 0x400 // 0x400...0x403 := DPP0...DPP3 #define mPC 0x500 // PC #define mPSW 0x600 // PSW #define mSP 0x700 // SP #define mCP 0x800 // CP #define mCYC 0x900 // Cycles value #define mEPTR 0xA00 #pragma pack(1) typedef struct { union { U16 wregs [16]; // R0 ... R15 UC8 bregs [16]; // RL0 ... RH7 } r; U32 Ndpp[4]; // full linear base address values U32 nPC; // full address ! U16 cPsw; // current Psw U16 cSP; U16 cMDL; // MDL U16 cMDH; // MDH U32 cCP; // CP I64 nCycles; // cycle counter (or time ???) INT64 macc; // 40-Bit value U16 mah; // MAH MAC-Unit Accumulator High U16 mal; // MAL MAC-Unit Accumulator Low U16 mas; // MAS limited MAH/signed U16 msw; // MSW MAC-Unit Status Word U16 mcw; // MCW MAC-Unit Control Word U16 mrw; // MRW MAC-Unit Repeat Word U16 idx0; U16 idx1; U16 qx0; U16 qx1; U16 qr0; U16 qr1; } RG166; /* * Sle66+ specific's */ #define nnR0 0x00 // R0 #define nnR1 0x01 // R1 #define nnR2 0x02 // R2 #define nnR3 0x03 // R3 #define nnR4 0x04 // R4 #define nnR5 0x05 // R5 #define nnR6 0x06 // R6 #define nnR7 0x07 // R7 //#define niR0 0x10 // @R0 //#define niR1 0x11 // @R1 //#define nrAB 0x12 // AB #define nrCY 0x13 // C #define nrA 0x14 // A #define nrDPTR 0x18 // DPTR #define nnPR0 0x1C // PR0 (80C51MX) #define nnPR1 0x1D // PR1 (80C51MX) typedef struct { // iMCS51 - SLE66Cxx Registers UL32 nPC; I64 nCycles; // cycle counter UC8 psw; UC8 sp; UC8 b; UC8 acc; UC8 dpl; UC8 dph; UC8 bregs [8]; UC8 dpsel; UC8 adrxh; // page for MOVX @Ri U16 dptx [8]; // DPTR save area } RGSLE66; typedef struct { // iMCS51-Registers BYTE Rn [16]; // R0 ... R7 DWORD nPC; // full address ! BYTE sp; // SP BYTE psw; // PSW-sfr BYTE b; // B-sfr BYTE acc; // ACC-sfr BYTE dpl; // DPL-sfr BYTE dph; // DPH-sfr BYTE ports[8]; I64 nCycles; // cycle counter } RG51; typedef struct { // iMCSARM Registers DWORD cur[16]; // Current Mode: R0..R15(PC) DWORD cpsr; // CPSR DWORD spsr; // Current SPSR DWORD usr[7]; // User & System: R8..R14 DWORD fiq[8]; // Fast Interrupt: R8..R14, SPSR DWORD irq[3]; // Interrupt: R13,R14, SPSR DWORD svc[3]; // Supervisor: R13,R14, SPSR DWORD abt[3]; // Abort: R13,R14, SPSR DWORD und[3]; // Undefined: R13,R14, SPSR INT64 nCycles; // cycle counter } RgARM ; typedef struct { // SmartMX-Registers BYTE Rn [32]; // 7F:0000 .. 7F:001F (D:0 .. D:1F) BYTE acc, pcl, pch, pcx, psw, pswh; // System Mode Registers BYTE s_B, s_EPL, s_EPM, s_EPH, s_DPL0, s_DPH0; BYTE s_DPL1, s_DPH1, s_MXCON, s_AUXR1, s_XRAMP; BYTE s_SP, s_SPE, s_SPLOW,s_SPELOW,s_SPHIGH,s_SPEHIGH; //User Context Registers BYTE u_B, u_EPL, u_EPM, u_EPH, u_DPL0, u_DPH0; BYTE u_DPL1, u_DPH1, u_MXCON, u_AUXR1, u_XRAMP; BYTE u_SP, u_SPE, u_SPLOW,u_SPELOW,u_SPHIGH,u_SPEHIGH; // Physical PC Value BYTE YPCL, YPCH, YPCX; BYTE MMUCTRL; BYTE MMUPTRL, MMUPTRM, MMUPTRH; } RGSMX; #pragma pack() #pragma pack(1) #define RGROUP struct rGroup #define RITEM struct rItem #define REGDSC struct RegDsc struct rGroup { // Register Group Descriptor UC8 desc; // always 0x00 UC8 ShEx; // Bit.0 = 1 Show Group initially expanded // Bit.1 = 1 Show Group description 'bold' char *name; // Group name }; struct rItem { // Register Item Descriptor UC8 desc; // always 0x01 U16 nGi; // Group-Index (0...nGroups-1) U16 nItem; // Item indicator char szReg[16]; // Name of Register UC8 isPC; // is this the PC UC8 canChg; // can this Reg be changed in Reg-Window UC8 iHigh; // highlight the value UC8 iDraw; // item needs to be repainted char szVal[32]; // it's value in Ascii GVAL v; // it's binary item value }; struct RegDsc { I32 nGitems; // number of group items I32 nRitems; // number of register items RGROUP *GrpArr; // array of group descriptors RITEM *RegArr; // array of register descriptors void (*RegGet) (RITEM *vp, int nR); // get RegItem's value I32 (*RegSet) (RITEM *vp, GVAL *pV); // set RegItem's value }; #pragma pack() #define UPR_NORMAL 0x80000000 // update normal registers #define UPR_HIST 0x40000000 // update history registers /* * Advanced GDI Functions */ /* * Error codes */ #define AG_OK 0 // Ok. #define AG_NOACCESS 1 // Cannot access while running. #define AG_RDFAILED 2 // memory read failed. #define AG_INVALOP 3 // invalid operation code #define AG_RO 4 // attempt to write Read-only item #define AG_WRFAILED 5 // memory write failed. #define AG_CANTMAP 6 // cannot map memory /* * 80x51 + Sle66(+) memory spaces, added 12/19/99 */ #define amNONE 0x0000 // not spaced #define amXDATA 0x0001 // XDATA #define amBANK0 0x0080 // BANK0 #define amBANK31 0x009F // BANK31 #define amDATA 0x00F0 // DATA #define amBIT 0x00F1 // BIT #define amEDATA 0x00F2 // EDATA (i251) #define amIDATA 0x00F3 // IDATA #define amECODE 0x00F4 // 251 ecode #define amHDATA 0x00F5 // 251 hdata #define amHCONS 0x00F6 // 251 hconst #define amCONST 0x00F7 // 251 const #define amPDATA 0x00FE // PDATA (c51 macht das bei generic) #define amCODE 0x00FF // CODE #define amPHYS 0x0100 // Physical SLE66+ Memory #define amPHLIM 0x0110 // 1MB Physical Memory #define amYMEM 0x0040 // Mifare ProX Y: (physical code 1MB) #define amZMEM 0x0041 // Mifare ProX Z: (physical xdata) #define amSMEM 0x0042 // Mifare ProX S: (physical sfr) #define amU1MEM 0x00F8 // UsrMem #1 (E2-PROM) #define amU2MEM 0x00F9 // UsrMem #2 (reserved for future use) #define amU3MEM 0x00FA // UsrMem #3 (reserved for future use) #define amU4MEM 0x00FB // UsrMem #4 (reserved for future use) #define amU5MEM 0x00FC // UsrMem #5 (reserved for future use) #define mmU6MEM 0x00FD // UsrMem #6 (reserved for future use) /* * Features */ typedef struct { U32 MemAccR : 1; // memory-access while running supported U32 RegAccR : 1; // register-access while running supported U32 hTrace : 1; // trace-recording supported U32 hCover : 1; // code coverage supported U32 hPaLyze : 1; // Performance-Analyzer support U32 hMemMap : 1; // Memory-Map support U32 ResetR : 1; // Reset possible while running U32 ExtBrk : 1; // OCDS/JTAG: Break in EXTx allowed /10.3.2003/ U32 LaSupp : 1; // Logic-Analyzer supported } SUPP; #pragma pack(1) typedef struct { UL32 Adr; // linear address UL32 ErrAdr; // memory access failed address UL32 nLen; // address range, used for memory-map U16 mSpace; // memory space (not used on 166/167) } GADR; typedef struct { // Assemble/Disassemble UL32 Adr; // linear address UC8 Opc [8]; // 167 needs max. 4 Opcode bytes I32 OpcLen; // Result length in assemble mode SC8 szB [256]; // DisAsm-result or Asm-input line I32 Result; // 0:=Ok, otherwise error } DAAS; typedef struct { // 11.1.2005, DisAssemble Mixed-Mode into File UL32 nStart; // Start-Address for disassemble UL32 nEnd; // Stop-Address for disassemble I32 Result; // 0:=Ok, 1:=can't create file, 2:=file write error I32 nMode; // 0:=Asm-Mode, 1:=Mixed-Mode UL32 nRes[8]; // reserved char szN [300]; // name of file to create and write disassembly } DAS_MIXED; typedef struct { // Memory-Range descriptor UC8 mTyp; // 0=RAM, 1=ROM UL32 nStart; // Memory start address UL32 nSize; // Size of memory block (0=unused) } OCM; typedef struct { // 166/167 Device Info UC8 Vendor [64]; // Device-Vendor: example 'Siemens' UC8 Device [64]; // Device-Name: example 'C167CR-16FM' UL32 Clock; // clock frequency UC8 RestoreBp; // 1 := restore Breakpoints UC8 Rtos; // OS: 0:=none, 1:=RtxTiny, 2:=RtxFull UC8 Mod167; // 0:=166-Instr. Set 1:=167-Instr Set UC8 useOnChipRom; // 1:=use on chip Rom UC8 useOnChipXper; // 1:=use on chip X-peripherals (XRAM+CAN) UC8 useMAC; // 0:=no MACC, 1:=MACC instr. used OCM ExtMem[6]; // up to 6 external memory ranges OCM Ican; // address range of on-chip CAN OCM Irom; // address range of on-chip internal Rom OCM Xram1; // address range of on-chip internal Xram OCM Xram2; // address range of on-chip internal Xram OCM Iram; // address range of on-chip internal Ram UC8 PrjPath [260]; // path of project UC8 AppName [260]; // path and name of loaded application } DEV_X66; #pragma pack() /* * Symbol search masks (may be combined using |) : */ #define AG_SYM_VAR 0x0001 // search for non-bit Variables #define AG_SYM_CON 0x0002 // search for named Constants #define AG_SYM_BIT 0x0004 // search for Bit in Memory #define AG_SYM_LOC 0x0008 // search for Function/Label #define AG_SYM_SFR 0x0200 // search for SFR name /* * Type of found symbol: */ #define AG_TP_VOID 0 #define AG_TP_BIT 1 #define AG_TP_CHAR 2 #define AG_TP_UCHAR 3 #define AG_TP_INT 4 #define AG_TP_UINT 5 #define AG_TP_SHORT 6 #define AG_TP_USHORT 7 #define AG_TP_LONG 8 #define AG_TP_ULONG 9 #define AG_TP_FLOAT 10 #define AG_TP_DOUBLE 11 #define AG_TP_PTR 12 #define AG_TP_UNION 13 #define AG_TP_STRUCT 14 #define AG_TP_FUNC 15 #define AG_TP_STRING 16 #define AG_TP_ENUM 17 #define AG_TP_FIELD 18 #pragma pack(1) typedef struct { // Search for Sym by Name or Value. UL32 nMask; // search mask (AG_SYM_LOC | ...) UC8 szName [256]; // search/found name (zero-terminated U64 val; // search/found Adr/Value UL32 type; // type of found symbol (AG_TP_???) UL32 Ok; // 1:=Ok, else find failed. } SYMDSC; #pragma pack() /* * Progress-Control Structure */ #define PROGRESS_INIT 1 #define PROGRESS_KILL 2 #define PROGRESS_SETPOS 3 #define PROGRESS_INITTXT 4 // 15.3.2003, init progress in text mode #define PROGRESS_SETTEXT 5 // ========= #pragma pack(1) typedef struct PgRess { // Progress-Setup and Control structure I32 Job; // PROGRESS_INIT/KILL/SETPOS I32 pos; // PROGRESS_SETPOS: position to set I32 low; // low percent (normally 0) I32 hig; // high percent (normally 100) SC8 *label; // text-label before progress-bar or NULL SC8 *ctext; // 15.3.2003, Text instead of % display } OIL; #pragma pack() /* * Flash-Parameter-Block, used in AG_CB_GETFLASHPARAM CallBack */ #pragma pack(1) typedef struct FlashBlock { UL32 start; // Start-Address UL32 many; // Number of Bytes UC8 *image; // Content UL32 ActSize; // total number of bytes UL32 Stop : 1; // cancel FlashDownLoad UL32 Res [16]; // reserved, unused } FLASHPARM; #pragma pack() /* * Init/Query Target features */ #define AG_INITFEATURES 0x0100 // Init target features #define AG_GETFEATURE 0x0200 // extract a single feature #define AG_INITITEM 0x0300 // Init item #define AG_EXECITEM 0x0400 // Execute item /* * Supported Target Features: */ #define AG_F_MEMACCR 0x0001 // memory-access while running #define AG_F_REGACCR 0x0002 // register-access while running #define AG_F_TRACE 0x0003 // back-trace support #define AG_F_COVERAGE 0x0004 // code-coverage support #define AG_F_PALYZE 0x0005 // Performance-Analyzer support #define AG_F_MEMMAP 0x0006 // Memory-Map support #define AG_F_RESETR 0x0007 // Reset while running possible feature #define AG_F_251MODE 0x0008 // 251: get mode (SRC_MODE/BIN_MODE) #define AG_F_251FRMSZ 0x0009 // 251: get framesize (FRM_SIZE2/4) #define AG_F_251CPU 0x000A // 251: get CPU type (CPU_251/CPU_51) #define AG_F_16XBIE 0x000B // 167: brk within EXTx-Sequ allowed // ret: 1:=yes, 0:=no #define AG_F_LANALYZER 0x000C // Logic-Analyzer support /* * Connection and Communication Items used for 'AG_INITITEM': */ #define AG_INITMENU 0x0007 // init extension menu #define AG_INITEXTDLGUPD 0x0008 // init modeless extesion dlg update function #define AG_INITMHANDLEP 0x0009 // setup ptr to HWND of active modeless dlg #define AG_INITPHANDLEP 0x000A // pointer to parent handle (MainFrame) #define AG_INITINSTHANDLE 0x000B // pointer to Agdi-instance handle #define AG_INITBPHEAD 0x000E // pointer to Bp-head #define AG_INITCURPC 0x000F // pointer to Program counter #define AG_INITDOEVENTS 0x0010 // pointer do DoEvents() #define AG_INITUSRMSG 0x0011 // Registered Message for SendMessage #define AG_INITCALLBACK 0x0012 // pointer to callback function //---19.7.2002: added for Flash DownLoad: #define AG_INITFLASHLOAD 0x0013 // Prepare for Flash Download #define AG_STARTFLASHLOAD 0x0014 // Start Flash DownLoad //---2.11.2004: added for Hitex-AGDI: #define AG_INITCWINAPP 0x0020 // sent Item is 'CWinApp *' #define AG_INITSTARTLOAD 0x0021 // 'Load about to start' (item := 'LOADPARMS *') #define AG_INITENDLOAD 0x0022 // 'Load finished' (item := NULL) /* * AG_EXECITEM items: */ #define AG_UNINIT 0x000C // Clean up target #define AG_RESET 0x000D // Reset target system #define AG_GETMODE 0x000E // for S8051.DLL: Get Dallas Contigious Mode //---26.10.2000: added for Hitex Emulators: #define AG_RUNSTART 0x0010 // Announcement: Go/Step about to start #define AG_RUNSTOP 0x0011 // : Go/Step completed. #define AG_QUERY_LASIG 0x0012 // 27.1.2005 #define AG_KILLED_LASIG 0x0013 // 27.1.2005 //--- typedef struct agdi_la { // Query LA-Signal /27.1.2005/ struct agdi_la *next; U64 nAdr; // LA-Signal: memory address U64 nSize; // LA-Signal: size of analyzed item in Bytes GVAL v; // value U32 SigNo; // internal LA signal number (don't change) U32 killed; // U32 nRes[16]; // reserved char szDname[128]; // Signal's display name char szExp[128]; // the expr.-text: LA CREATE <expr> char szError[256]; // Error-Text } AGDI_LA; typedef struct { // Write-Data-Record I64 tStamp; // Time-Stamp of write I64 totTime; // total running time U64 nPC; // PC-value at time of write U64 nAdr; // Write-Address GVAL v; // Write-value @nAdr U32 wType; // 1:=Byte, 2:=W16, 4=U32, 8=U64 U32 SigNo; // LASIG-Number (1...255) U32 nRes[16]; // reserved } AGDI_LAREC; //---TODO: define - tStamp/totTime uSec or cycles ??? /* * Errors returned from AG_QUERY_LASIG: */ #define AGDI_LA_OK 1 // LA-Signal was accepted by target #define AGDI_LA_NOTSUPPORTED (-10) // LA-Sig Address-Range not accepted /* * 26.1.2005, Info given on AG_INITSTARTLOAD: (see example dated /26.1.2005/ in this file) */ typedef struct { char szFile [512]; // full path name of App to load BYTE Incremental; // 1:=incremental load BYTE NoCode; // 1:=no code BYTE Reserved[32]; } LOADPARMS; #pragma pack(1) typedef struct ag_line { U16 line; UL32 addr; } AG_LINE; typedef struct ag_scope { DWORD AddrIn; // Input: Address to be mapped to Scope // Output values: const char *pModule; // name of Module const char *pFunc; // name of Function DWORD lowPC; // Scope-Block lower bound DWORD higPC; // Scope-Block upper bound DWORD nLines; // number of lines DWORD curLine; // current line (or 0 if none) AG_LINE *pLines; // Line-Number Array char szPath[512]; // full path name of source file DWORD nRes[32]; // reserved } AG_SCOPE; typedef struct ag_block { // App/Module/Func Enumeration char const *pApp; // App-Name (wg. incremental load) char const *pModule; // Module-Name char const *pFunc; // Function-Name UL32 lowPC; // Function starts at 'lowPC' UL32 higPC; // and extends up to and including 'higPC' // ***DO NOT MODIFY these: void *pA; // internal reserved data /App/ void *pT; // internal reserved data /Theadr/ void *pF; // internal reserved data /Func/ UL32 m1:1; } AG_BLOCK; #pragma pack() /* * Call-Back-Function in S166 and supported sub-functions */ typedef U32 (*pCBF) (U32 nCode, void *vp); #define AG_CB_TRUEXPR 1 // vp := 'EXP *' (use for Bp->ep) #define AG_CB_PROGRESS 2 // vp := 'struct PgRess *' #define AG_CB_INITREGV 3 // vp := 'REGDSC *' (into RegView) #define AG_CB_EXECCMD 4 // vp := 'char *' command string #define AG_CB_FORCEUPDATE 5 // vp := NULL, force general windows update #define AG_CB_DISASM 6 // vp := 'DAAS *', disasm opcodes #define AG_CB_INLASM 7 // vp := 'DAAS *', assemble szB[] into Opc[] #define AG_CB_MSGSTRING 8 // vp := 'char *' text for message pane #define AG_CB_GETDEVINFO 9 // vp := 'DEV_X66 *', get device info #define AG_CB_SYMBYVAL 10 // vp := 'SYMDESC *', find symbol by value #define AG_CB_SYMBYNAME 11 // vp := 'SYMDESC *', find symbol by name #define AG_CB_SLE66MM 12 // vp := &slots[0] out of [512] #define AG_CB_PHYS2MMU 13 // vp := (void *) ((DWORD) physAdr) #define AG_CB_MMU2PHYS 14 // vp := (void *) ((DWORD) logicalAdr) #define AG_CB_GETFLASHPARAM 15 // vp := (FLASHPARM *) or NULL #define AG_CB_GETBOMPTR 16 // vp := &ioc /5.3.2003/ // Note: special callback for DTC-Messaging #define AG_CB_DCTMSG_WRITE 17 // vp := write-access address #define AG_CB_DISASM_EXT 18 // vp := 'DAS_MIXED *', disasm to file #define AG_CB_LAREC_DATA 19 // vp := 'AGDI_LAREC *', send data-record to Logic-Analyzer #define AG_CB_SHUTDOWN 20 // #define AG_CB_GETSCOPEINFO 21 // vp := 'AG_SCOPE *', get Scope Info #define AG_CB_ENUMFUNCTIONS 22 // vp := 'AG_BLOCK *'. enumerate App/Modules/Functions #ifdef _IN_TARG_ // define if used in Mon166,Emu... extern _EXPO_ U32 AG_Init (U16 nCode, void *vp); #else // S166 extern U32 (*AG_Init) (U16 nCode, void *vp); #endif /* * Memory attributes */ #define AG_ATR_EXEC 0x01 // 'executable ' Attribute #define AG_ATR_READ 0x02 // 'readable' Attribute #define AG_ATR_WRITE 0x04 // 'writable' Attribute #define AG_ATR_BREAK 0x08 // 'Exec-Break' Attribute #define AG_ATR_EXECD 0x10 // 'Executed' Attribute #define AG_ATR_WATCH 0x20 // Location has a Watch #define AG_ATR_BPDIS 0x40 // 'disabled Exec-Break' Attribute #define AG_ATR_PAP 0x80 // Location has a Perf.-Analyzer point #define AG_ATR_WRBRK 0x100 // Loc has a write-access break #define AG_ATR_RDBRK 0x200 // Loc has a read-access break #define AG_ATR_COMC 0x400 // iMCS51/251: Common code marker #define AG_ATR_VNM 0x800 // iMCS51: von Neumann mapped #define AG_ATR_BEP 0x1000 // iMCS51: Bank-Entry Point #define AG_ATR_EXTR 0x2000 // 166/167: within range of an EXTR sequence #define AG_ATR_JTAKEN 0x4000 // Jump-taken attribute /* * ARM-specific attributes: */ #define AG_ATR_THUMB 0x00000080 // 'Thumb' code #define AG_ATR_ARM 0x00008000 // 'ARM' code #define AG_ATR_NOINST 0x00080000 // 'No instruction' Attribute #define AG_MEMMAP 0x01 // map memory #define AG_GETMEMATT 0x02 // get memory attribute #define AG_SETMEMATT 0x03 // set memory attribute #ifdef _IN_TARG_ // define if used in Mon166,Emu... extern _EXPO_ U32 AG_MemAtt (U16 nCode, UL32 nAttr, GADR *pA); #else extern U32 (*AG_MemAtt) (U16 nCode, UL32 nAttr, GADR *pA); #endif /* * Breakpoint query and access */ #define AG_ABREAK 0 // simple code address break #define AG_CBREAK 1 // conditional break (check after each instr.) #define AG_WBREAK 2 // data access break #define AG_RBREAK 3 // Address-Range Break (currently not used) #pragma pack(1) struct AG_Bps { struct AG_Bps *next; struct AG_Bps *prev; UL32 type : 4; // ABREAK, CBREAK, WBREAK UL32 enabled : 1; // 1:=enabled, 0:=disabled UL32 ReCalc : 1; // recalc expr flag UL32 BytObj : 1; // WatchBrk: 0:=Bytes, 1:=Objects UL32 Adr; // Address (or Range) UL32 mSpace; // memory-space void *pV; // used on VTR-access breakpoints UL32 tsize; // WatchBrk: size of one object UL32 many; // WatchBrk: many objects or bytes U16 acc; // WatchBrk: 1:=Read, 2:=Write, 3:=ReadWrite U16 BitPos; // currently not used UL32 number; // BreakPoint-Number I32 rcount; // Break is taken when rcount = 1 I32 ocount; // Original Count void *ep; // conditional-Expression char *cmd; // Exec-Command char *Line; // Breakpoint-Expression Line for Display char *pF; // module file name UL32 nLine; // line number UC8 Opc[8]; // Opcode-Save Area for Monitors }; #pragma pack() #define AG_BP struct AG_Bps #define AG_BPQUERY 0x01 #define AG_BPTOGGLE 0x02 // not sent to target #define AG_BPINSREM 0x03 // not sent to target #define AG_BPACTIVATE 0x04 // not sent to target #define AG_BPDISALL 0x05 // Notification: all Bp's have been disabled #define AG_BPKILLALL 0x06 // Notification: all Bp's have been killed #define AG_BPEXQUERY 0x07 #define AG_CADRVALID 0x10 // Is code address valid ? // added these /8.2.99/ #define AG_BPENABLE 0x08 // Notification: Enable Bp at address #define AG_BPDISABLE 0x09 // Notification: Disable Bp at address #define AG_BPKILL 0x0A // Notification: Kill Bp at address #define AG_BPSET 0x0B // Notification: Set Bp at address #ifdef _IN_TARG_ // define if used in Mon166,Emu... extern _EXPO_ U32 AG_BpInfo (U16 nCode, void *vp); extern _EXPO_ AG_BP *AG_BreakFunc (U16 nCode, U16 n1, GADR *pA, AG_BP *pB); #else extern U32 (*AG_BpInfo) (U16 nCode, void *vp); extern AG_BP *(*AG_BreakFunc) (U16 nCode, U16 n1, GADR *pA, AG_BP *pB); #endif /* * AG_BP *AG_BreakFunc (U16 nCode, U16 n1, GADR *pA, AG_BP *pB); * nCode := AG_BPQUERY, AG_BPINSREM, ... * n1 := */ /* * Go/Step function */ #define AG_STOPRUN 0x01 // force target to stop Go/Step. #define AG_NSTEP 0x02 // exteute 'n' steps #define AG_GOTILADR 0x03 // go til address #define AG_GOFORBRK 0x04 // go forever or some Bp fires #ifdef _IN_TARG_ // define if used in Mon166,Emu... extern _EXPO_ U32 AG_GoStep (U16 nCode, U32 nSteps, GADR *pA); #else extern U32 (*AG_GoStep) (U16 nCode, U32 nSteps, GADR *pA); #endif /* * Serial-Window I/O (thread-safe) */ struct SerAS { DWORD n1; DWORD n2; DWORD n3; DWORD n4; GVAL v; }; #define AG_SERBOUT 0x01 // write nMany bytes to Serial #1 Window #define AG_SERWOUT 0x02 // write nMany words to Serial #1 Window #define AG_SERXIN 0x03 // Key was pressed in Serial Window #1 or #2 #ifdef _IN_TARG_ // define if used in Mon166,Emu... extern _EXPO_ U32 AG_Serial (U16 nCode, U32 nSerNo, U32 nMany, void *vp); // nCode := AG_SER?OUT / AG_SERXIN // nSerNo: 0:=Serial #1, 1:=Serial #2 // nMany: number of items // vp: pointer to items (UC8 or U16) #else extern U32 (*AG_Serial) (U16 nCode, U32 nSerNo, U32 nMany, void *vp); #endif /* * Register and Memory access functions */ #define AG_READ 0x01 // read operation #define AG_WRITE 0x02 // write operation #define AG_WROPC 0x03 // write opcodes #define AG_RDOPC 0x04 // read opcodes #define AG_RDMMU66 0x05 // 19.12.99, read Sle66 MMU content #define AG_WRMMU66 0x06 // 19.12.99, write single Sle66 MMU-Descr. #define AG_RCRC 0x07 // Sle66 read CRC #define AG_RDSHIELD 0x08 // Sle66 read Shield #define AG_RDACE 0x09 // Sle66 read ACE //--- 8.7.2002: added for flash download, otherwise like 'AG_WRITE' #define AG_F_WRITE 0x0A // Write to Flash memory (download) #define AG_F_VERIFY 0x0B // Verify FLash Memory #define AG_F_ERASE 0x0C // Erase Flash #define AG_F_RUN 0x0D // Start flashed App. //---2.4.2003: added for SmartMX Peripheral Access #define AG_RD_XDES 0x10 // MXP: read DES (16 Bytes) #define AG_RD_XAES 0x11 // MXP: read AES (16 Bytes) #define AG_RD_XCRC 0x12 // MXP: read CRC (2 Bytes) #define AG_RD_XVECT 0x13 // MXP: read Vectors (10 DWORDS, prepared) //---22.7.2003: added for SLE66 RF Interface #define AG_RDRF 0x14 // SLE66: Read RF Fifo registers #define AG_WRRF 0x15 // SLE66: Write RF Fifo registers #define AG_RDMOVB 0x16 // SLE66: Read SFR via MOVB #define AG_WRMOVB 0x17 // SLE66: Write SFR via MOVB //---26.8.2004: added for SLE66 Special Access #define AG_BONVMREAD 0x18 // SLE66: BoNVMRead Macro #define AG_BONVMWRITE 0x19 // SLE66: BoNVMWrite Macro #pragma pack (1) struct BoNvmFunc { // for BoNVMRead/BoNVMWrite unsigned char Mode; // access mode unsigned char buf[85]; // read/write buffer }; #pragma pack () #ifdef _IN_TARG_ // define if used in Mon166,Emu... extern _EXPO_ U32 AG_MemAcc (U16 nCode, UC8 *pB, GADR *pA, UL32 nMany); extern _EXPO_ U32 AG_RegAcc (U16 nCode, U32 nReg, GVAL *pV); extern _EXPO_ U32 AG_AllReg (U16 nCode, void *pR); #else extern U32 (*AG_MemAcc) (U16 nCode, UC8 *pB, GADR *pA, UL32 nMany); extern U32 (*AG_RegAcc) (U16 nCode, U32 nReg, GVAL *pV); extern U32 (*AG_AllReg) (U16 nCode, void *pR); #endif /* * extract trace history */ #ifdef _IN_TARG_ // define if used in Mon166,Emu... extern _EXPO_ U32 AG_HistFunc (U32 nCode, I32 indx, I32 dir, void *vp); #else extern U32 (*AG_HistFunc) (U32 nCode, I32 indx, I32 dir, void *vp); #endif #pragma pack(1) #define DIAD struct DlgD struct DlgD { // every dialog has it's own structure UL32 iOpen; // auto reopen dialog (pos := 'rc') HWND hw; // Hwnd of Dialog BOOL (CALLBACK *wp) (HWND hw, UINT msg, WPARAM wp, LPARAM lp); RECT rc; // Position rectangle void (*Update) (void); // Update dialog content void (*Kill) (DIAD *pM); // Kill dialog void *vp; // reserved for C++ Dialogs (Dlg *this) }; #define DYMENU struct DyMenu struct DyMenu { // Menu item data structure I32 nDelim; // Menu template delimiter char *szText; // Menu item text void (*fp) (DYMENU *pM); // create/bringDlgtoTop function UL32 nID; // uv3 assigned ID_xxxx UL32 nDlgId; // Dialog ID DIAD *pDlg; // link to dialog attributes }; #pragma pack() /* * nDelim: 1 := normal Menu entry * 2 := Popup-Entry (nested submenu) * -2 := end of Popup-Group-List * -1 := total end of Menu-List * text: the name for the menu/popup-menu entry * fp: Function to be activated on menu-selection */ #if 0 // ----- Examples for AGDI's CallBack functions ----- //--- Example for Force Update: pCbFunc (AG_CB_EXECCMD, "dir public"); // execute dir public command //--- Note: almost any dScope command but 'Exit' can be given. //--- The 'Exit' command should not be executed ! //--- Example for Force Update: pCbFunc (AG_CB_FORCEUPDATE, NULL); //--- Note: function returns when update is completed. //--- Example for Set Message String: pCbFunc (AG_CB_MSGSTRING, "Running..."); // up to 20 characters //--- up to 20 characters may be displayed in the statusbar pane. //--- Example for DisAssemble Opcodes: DAAS parms; parms.Adr = 0x10000; // disassemble address parms.Opc[0] = 0xC0; parms.Opc[1] = 0xF0; // MovBZ RH7,R0 parms.Opc[2] = 0; parms.Opc[3] = 0; pCbFunc (AG_CB_DISASM, (void *) &parms); // disassemble... //--- on return: parms.OpcLen := length of opcode in bytes //--- parms.szB[] := disassembled instruction in ascii //--- Note: parms.Adr is used for ascii-address and relative jmps only. //--- parms.Result always 0. //---Example for DisAssemble to file: /11.1.2005/ DAS_MIXED parms; memset (&parms, 0, sizeof (parms)); // clear parms.nStart = (amCODE << 24) | (amCODE << 16) | 0x0C6A; // start at C:0x0C6A parms.nEnd = (amCODE << 24) | (amCODE << 16) | 0x0DE7; // end at C:0x0DE7 parms.nMode = 1; // use 'mixed' mode strcpy (parms.szN, "MixDis.Dis"); // Name of file to create and write pCbFunc (AG_CB_DISASM_EXT, (void *) &parms); // disassemble to file... switch (parms.Result) { case 0: // Ok. break; case 1: // could not create file // TODO: error handling break; case 2: // could not write to file (disk full etc.) // TODO: error handling break; } //------------------------------------------------ typedef struct { // 11.1.2005, DisAssemble Mixed-Mode into File UL32 nStart; // Start-Address for disassemble UL32 nEnd; // Stop-Address for disassemble I32 Result; // 0:=Ok, 1:=can't create file, 2:=file write error I32 nMode; // 0:=Asm-Mode, 1:=Mixed-Mode UL32 nRes[8]; // reserved char szN [300]; // name of file to create and write disassembly } DAS_MIXED; //--- Example for Inline Assemble: DAAS parms; parms.Adr = 0x10000; // inline assemble address strcpy (parms.szB, "MOV [R8+#0x1200],R1"); // instruction to assemble pCbFunc (AG_CB_INLASM, (void *) &parms); // assemble... //--- on return: //--- parms.Result = 0 if successful //--- parms.OpcLen := length of opcode in bytes //--- parms.Opc[] := 'parms.OpcLen' Opcode bytes //--- parms.Result != 0 if inline assembly failed //--- everything of parms but 'Result' is invalid. //--- Example for GetDeviceInfo: DEV_X66 parms; memset (&parms, 0, sizeof (parms)); pCbFunc (AG_CB_INLASM, (void *) &parms); // get device info //--- On return: //--- values in DEV_X66 structure. //--- Note: //--- AppName[] may be used to store a project target specific ini file //--- AppName[] should be renamed (example: strcat (AppName, "hitex") //--- before read or write operations can take place. //--- Example for Find Symbol by value: SYMDSC parms; parms.nMask = AG_SYM_LOC | AG_SYMCON; // functions and constants parms.val = 0x10000; // some value pCbFunc (AG_CB_SYMBYVAL, (void *) &parms); // search for symbol //--- On return: //--- parms.Ok = 1, search was successful //--- parms.szName[] = name of symbol ('main' for example) //--- parms.type = type of symbol (AG_TP_FUNC for example) //--- parms.val = value of symbol //--- parms.Ok = 0, search failed. //--- Note: publics are searched only //--- Example for Find Symbol by name: SYMDSC parms; strcpy (parms.szName, "main"); pCbFunc (AG_CB_SYMBYNAME, (void *) &parms); // search for symbol by name //--- On return: //--- parms.Ok = 1, search was successful //--- parms.szName[] = name of symbol ('main' for example) //--- parms.type = type of symbol (AG_TP_FUNC for example) //--- parms.val = value of symbol //--- parms.Ok = 0, search failed. //--- Note: publics are searched only //--- Example for Progress-Bar handling: static OIL ProgressBar; //--- initialize progress bar ProgressBar.pos = 0; // initial position ProgressBar.low = 0; // low position percent (0%) ProgressBar.hig = 100; // high position percent (100%) ProgressBar.label = "Loading Monitor..."; // progress label text ProgressBar.Job = PROGRESS_INIT; // initialize pCbFunc (AG_CB_PROGRESS, &ProgressBar); // do initialization. //--- Step 1: display progress bar position: while (processing) { // ... ProgressBar.Job = PROGRESS_SETPOS; ProgressBar.pos++; pCbFunc (AG_CB_PROGRESS, &ProgressBar); // set bar to position // ... } //--- Step 2: remove progress bar: ProgressBar.Job = PROGRESS_KILL; pCbFunc (AG_CB_PROGRESS, &ProgressBar); // kill Progress Bar. #endif // End of CallBack Samples. #if 0 // /30.1.2005/ Logic-Analyzer Example static DWORD SaveAdr; I32 QueryLaSig (AGDI_LA *pLA) { DWORD nAdr; DWORD nSize; nAdr = (U32) pLA->nAdr; // Memory-Address nSize = (U32) pLA->nSize; // Size in Bytes SaveAdr = nAdr; // Note: this is a hook for the example-code below. //---TODO: //if (cannot_set tracking-range nAdr...nAdr+nSize-1) { // strcpy (pLA->szError, "Error-Text"); // Reason for 'not supported' // return (AGDI_LA_NOTSUPPORTED); //} //---OK: return (AGDI_LA_OK); // LA-Signal accepted } /* * Given LA-Signal has been killed. */ U32 KilledLaSig (AGDI_LA *pLA) { //---TODO: whatever cleanup is required. return (AGDI_LA_OK); } /* * Send a Data-Record to uVision * uVision will look for the matching LA-Signal based on the write-address * and assign the data record to that La-signal. */ U32 SendLaDataRecord (AGDI_LAREC *pLA) { U32 nE; nE = pCbFunc (AG_CB_LAREC_DATA, (void *) pLA); // send data to uVision switch (nE) { default: case 0: // could not find a matching Signal (pLA->nAdr) break; case AGDI_LA_OK: break; } return (nE); } //---TODO: whenever the target detects a write to an address // specified by one or more LA-definition specifed address // ranges, then a data record needs to be prepared and // sent to uVision // Here is an example which simulates a 1000 hertz sine wave. It is // assumed that the loaded user program contains a float variable // such as: // float f32Test; // // That variable can then be specified for logic analyzer in uVision // Debugging mode in the command window: // // LA f32Test; // some float variable in user application // // The hooked address 'SaveAdr' is the location of 'f32Test' in memory. static AGDI_LAREC la; static void SineSig (void) { int i; double volts, frequ, offs, dur, val; volts = 2.0; // peak-to-peak voltage offs = 2.5; // voltage offset frequ = 1000; // frequency dur = 0.2; // duration in seconds memset (&la, 0, sizeof (la)); la.nAdr = SaveAdr; // use the previously hooked memory address '&f32Test' la.tStamp = 10; // simulate the time-stamp la.totTime = 10; // simulate the total running time for ( i = 0 ; i < (dur * 100000) ; ++i ) { val = (float) sin (frequ * (((double) la.totTime) / 33e6) * 2 * 3.14159); la.v.f32 = (float) ((val * volts) + offs); // setup the 'written' value SendLaDataRecord (&la); // send data to uVision la.totTime += 10; // and incrase 'total time' la.tStamp += 10; // simulate next time-stamp } // Note: total Time and time-stamp } U32 _EXPO_ AG_Init (U16 nCode, void *vp) { U32 nE; nE = 0; switch (nCode & 0xFF00) { case AG_INITFEATURES: // Initialize & start the target PlayDead = 0; // clear some variables... ... case AG_EXECITEM: // execute various commands switch (nCode & 0x00FF) { case AG_QUERY_LASIG: // is LA-Signal acceptable ? if (vp == NULL) { // NOTE: just for Test... //---NOTE: vp == NULL is just for test only, it is not a real case !!! SineSig(); // generate a sine Wave for test data break; // LA should show the sine wave... } nE = QueryLaSig ((AGDI_LA *) vp); break; case AG_KILLED_LASIG: // LA-Signal was killed nE = KilledLaSig ((AGDI_LA *) vp); break; ... } return (nE); } #endif #if 0 // /26.1.2005/ LOADPARMS-Example /* * AG_INITSTARTLOAD with load-parameters Example */ LOADPARMS lParms; // LOAD-Parameters U32 _EXPO_ AG_Init (U16 nCode, void *vp) { U32 nE; nE = 0; switch (nCode & 0xFF00) { case AG_INITFEATURES: // Initialize & start the target PlayDead = 0; // clear some variables... // ... break; case AG_INITITEM: // init item switch (nCode & 0x00FF) { case AG_INITMENU: // init extension menu *((DYMENU **) vp) = (DYMENU *) Menu; break; // ... case AG_INITCALLBACK: // pointer to callback function pCbFunc = (pCBF) vp; // call-back function of s166 break; case AG_INITSTARTLOAD: // about to start 'load file' if (vp != NULL) { // Load-Parameters specified lParms = *((LOADPARMS *) vp); // lParms.szFile[] : full path name of App to load // lParms.Incremental : 1:= incremental load // lParms.NoCode : 1:= load debug info only, no code (currently not used by uVision) // TODO: process the given load parameters if required... } break; case AG_INITENDLOAD: // Load is now completed. break; } break; // ... case AG_GETFEATURE: // uVision2 want's details about features... // ... } return (nE); } #endif // menu item identifiers for external target DLLs: #define AG_EXT_CMD_DEBUG_VIEW_TRACE_RECORDING 32000 #define AG_EXT_CMD_DEBUG_ENA_DISA_BREAKPOINTS 32001 #define AG_EXT_CMD_DEBUG_BREAKPOINTS 32002 #ifdef __cplusplus } #endif #endif // __AGDI__INCED___