using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace Abatron { internal class bdiAccess { //************************************************************************* // Constants //************************************************************************* //************************************************************************* // CPU Types //************************************************************************* public const UInt16 BDI_CT_FAMILY_MASK = 0xFF00; /* CPU family mask */ public const UInt16 BDI_CT_UNKNOWN = 0xFFFF; /* unknown target CPU */ public const UInt16 BDI_CT_CPU12 = 0x80C0; /* CPU12: */ public const UInt16 BDI_CT_HC812A4 = 0x03C0; /* CPU12: HC812A4 */ public const UInt16 BDI_CT_HC912B32 = 0x03C1; /* CPU12: HC912B32 */ public const UInt16 BDI_CT_HC912D60 = 0x03C3; /* CPU12: HC912D60 */ public const UInt16 BDI_CT_HC912DG128 = 0x03C4; /* CPU12: HC912DG128 */ public const UInt16 BDI_CT_HC912DA128 = 0x03C5; /* CPU12: HC912DA128 */ public const UInt16 BDI_CT_HC912D60A = 0x03C6; /* CPU12: HC912D60A */ public const UInt16 BDI_CT_HC912DG128A = 0x03C7; /* CPU12: HC912DG128A */ public const UInt16 BDI_CT_HC912DT128A = 0x03C8; /* CPU12: HC912DT128A */ public const UInt16 BDI_CT_MC9S12D256 = 0x03C9; /* CPU12: MC9S12Dx256 */ public const UInt16 BDI_CT_MC9S12D128 = 0x03CA; /* CPU12: MC9S12Dx128 */ public const UInt16 BDI_CT_MC9S12D64 = 0x03CB; /* CPU12: MC9S12Dx64 */ public const UInt16 BDI_CT_MC9S12D32 = 0x03CC; /* CPU12: MC9S12Dx32 */ public const UInt16 BDI_CT_MC9S12D512 = 0x03CD; /* CPU12: MC9S12Dx512 */ public const UInt16 BDI_CT_MC9S12E256 = 0x03CE; /* CPU12: MC9S12E256 */ public const UInt16 BDI_CT_MC9S12E128 = 0x03CF; /* CPU12: MC9S12E128 */ public const UInt16 BDI_CT_S12X_128K1 = 0x03E0; /* CPU12: MC9S12X_128 */ public const UInt16 BDI_CT_S12X_256K2 = 0x03E1; /* CPU12: MC9S12X_256 */ public const UInt16 BDI_CT_S12X_512K4 = 0x03E2; /* CPU12: MC9S12X_512 */ public const UInt16 BDI_CT_S12_256K2_2K = 0x03E3; /* CPU12: S12 256K 2K */ public const UInt16 BDI_CT_S12XE = 0x03E4; /* CPU12: S12XE */ public const UInt16 BDI_CT_CUSTOM_1 = 0x80C1; /* CPU12: Custom 1 */ public const UInt16 BDI_CT_CPU16 = 0x8100; /* CPU16: */ public const UInt16 BDI_CT_CPU32 = 0x8200; /* CPU32: */ public const UInt16 BDI_CT_MCF = 0x8300; /* ColdFire: */ public const UInt16 BDI_CT_MCF5202 = 0x8301; /* ColdFire: MCF5202 */ public const UInt16 BDI_CT_MCF5203 = 0x8302; /* ColdFire: MCF5203 */ public const UInt16 BDI_CT_MCF5204 = 0x8303; /* ColdFire: MCF5204 */ public const UInt16 BDI_CT_MCF5206 = 0x8304; /* ColdFire: MCF5206 */ public const UInt16 BDI_CT_MCF5307 = 0x8305; /* ColdFire: MCF5307 */ public const UInt16 BDI_CT_MCF5407 = 0x8306; /* ColdFire: MCF5407 */ public const UInt16 BDI_CT_MCF5272 = 0x8307; /* ColdFire: MCF5272 */ public const UInt16 BDI_CT_MCF5249 = 0x8308; /* ColdFire: MCF5249 */ public const UInt16 BDI_CT_MCF5282 = 0x8309; /* ColdFire: MCF5282 */ public const UInt16 BDI_CT_MCF5480 = 0x830A; /* ColdFire: MCF5480 family */ public const UInt16 BDI_CT_MCF5213 = 0x830B; /* ColdFire: MCF5213 family */ public const UInt16 BDI_CT_MCF5445 = 0x830C; /* ColdFire: MCF5445 family */ public const UInt16 BDI_CT_MPC8XX = 0x8400; /* PowerPC: MPC8xx */ public const UInt16 BDI_CT_MPC860 = 0x8401; /* PowerPC: MPC860 */ public const UInt16 BDI_CT_MPC821 = 0x8402; /* PowerPC: MPC821 */ public const UInt16 BDI_CT_MPC823 = 0x8403; /* PowerPC: MPC823 */ public const UInt16 BDI_CT_MPC850 = 0x8404; /* PowerPC: MPC850 */ public const UInt16 BDI_CT_MPC801 = 0x8405; /* PowerPC: MPC801 */ public const UInt16 BDI_CT_MPC5XX = 0x8500; /* PowerPC: MPC5xx */ public const UInt16 BDI_CT_MPC505 = 0x8501; /* PowerPC: MPC505 */ public const UInt16 BDI_CT_MPC509 = 0x8502; /* PowerPC: MPC509 */ public const UInt16 BDI_CT_MPC555 = 0x8503; /* PowerPC: MPC555 */ public const UInt16 BDI_CT_MCORE = 0x8600; /* M-CORE: */ public const UInt16 BDI_CT_MMC2001 = 0x8601; /* M-CORE: MMC2001 */ public const UInt16 BDI_CT_MMC2107 = 0x8602; /* M-CORE: MMC2107 */ public const UInt16 BDI_CT_MMC2114 = 0x8603; /* M-CORE: MMC2114 */ public const UInt16 BDI_CT_ARM7TDMI = 0x8700; /* ARM7: ARM7TDMI */ public const UInt16 BDI_CT_ARM7DI = 0x8701; /* ARM7: ARM7DI */ public const UInt16 BDI_CT_ARM710T = 0x8702; /* ARM7: ARM710T */ public const UInt16 BDI_CT_ARM720T = 0x8703; /* ARM7: ARM720T */ public const UInt16 BDI_CT_ARM740T = 0x8704; /* ARM7: ARM740T */ public const UInt16 BDI_CT_MAC7100 = 0x8705; /* ARM7: MAC7100 */ public const UInt16 BDI_CT_ARM9TDMI = 0x8800; /* ARM9: ARM9TDMI */ public const UInt16 BDI_CT_ARM920T = 0x8801; /* ARM9: ARM920T */ public const UInt16 BDI_CT_ARM940T = 0x8802; /* ARM9: ARM940T */ public const UInt16 BDI_CT_TI925T = 0x8803; /* ARM9: TI925T */ public const UInt16 BDI_CT_ARM9E = 0x8810; /* ARM9: ARM9E */ public const UInt16 BDI_CT_ARM946E = 0x8811; /* ARM9: ARM946E */ public const UInt16 BDI_CT_ARM966E = 0x8812; /* ARM9: ARM966E */ public const UInt16 BDI_CT_ARM926E = 0x8813; /* ARM9: ARM926E */ public const UInt16 BDI_CT_FA526 = 0x8814; /* ARM9: Farady FA526 */ public const UInt16 BDI_CT_FERO926 = 0x8815; /* ARM9: Marvell Feroceon 926 */ public const UInt16 BDI_CT_FERO946 = 0x8816; /* ARM9: Marvell Feroceon 946 */ public const UInt16 BDI_CT_FERO966 = 0x8817; /* ARM9: Marvell Feroceon 966 */ public const UInt16 BDI_CT_ARM11 = 0x8820; /* ARM11: ARM11 */ public const UInt16 BDI_CT_ARM1136 = 0x8821; /* ARM11: ARM1136 */ public const UInt16 BDI_CT_CORTEX_A8 = 0x8830; /* Cortex-A8: */ public const UInt16 BDI_CT_OMAP3430 = 0x8831; /* Cortex-A8: OMAP3430 */ public const UInt16 BDI_CT_XSCALE = 0x8880; /* XSCALE: XSCALE */ public const UInt16 BDI_CT_TRICORE = 0x8900; /* TriCore: */ public const UInt16 BDI_CT_PPC603E = 0x8A00; /* PowerPC 603E */ public const UInt16 BDI_CT_PPC603EV = 0x8A01; /* PowerPC: PPC603ev */ public const UInt16 BDI_CT_MPC8260 = 0x8A02; /* PowerPC: MPC8260 */ public const UInt16 BDI_CT_MPC8240 = 0x8A03; /* PowerPC: MPC8240 */ public const UInt16 BDI_CT_MPC4200 = 0x8A04; /* PowerPC: MPC4200 */ public const UInt16 BDI_CT_MPC8280 = 0x8A05; /* PowerPC: MPC8280 */ public const UInt16 BDI_CT_MGT5200 = 0x8A06; /* PowerPC: MGT5200 */ public const UInt16 BDI_CT_MPC8220 = 0x8A07; /* PowerPC: MPC8220 */ public const UInt16 BDI_CT_MPC8300 = 0x8A08; /* PowerPC: MPC8300 */ public const UInt16 BDI_CT_PPC750 = 0x8B00; /* PowerPC PPC750/740 */ public const UInt16 BDI_CT_PPC403 = 0x8C00; /* IBM PowerPC 403 */ public const UInt16 BDI_CT_PPC405 = 0x8D00; /* IBM PowerPC 405 */ public const UInt16 BDI_CT_PPC7400 = 0x8E00; /* PowerPC PPC7400 */ public const UInt16 BDI_CT_PPC401 = 0x8F00; /* IBM PowerPC 401 */ public const UInt16 BDI_CT_PPC440 = 0x9000; /* IBM PowerPC 440 */ public const UInt16 BDI_CT_MIPS32 = 0x9100; /* MIPS32 */ public const UInt16 BDI_CT_RC32300 = 0x9101; /* IDT RC32300 */ public const UInt16 BDI_CT_AU1000 = 0x9102; /* Alchemy AU1000 */ public const UInt16 BDI_CT_M4K = 0x9103; /* MIPS32 4K */ public const UInt16 BDI_CT_M4KE = 0x9104; /* MIPS32 4KE */ public const UInt16 BDI_CT_M24K = 0x9105; /* MIPS32 24K */ public const UInt16 BDI_CT_MPC8500 = 0x9200; /* PowerPC MPC85xx */ public const UInt16 BDI_CT_MPC8560 = 0x9201; /* PowerPC: MPC8560 */ public const UInt16 BDI_CT_MPC8540 = 0x9202; /* PowerPC: MPC8540 */ public const UInt16 BDI_CT_MPC8548 = 0x9203; /* PowerPC: MPC8548 */ public const UInt16 BDI_CT_MPC8572 = 0x9204; /* PowerPC: MPC8572 */ public const UInt16 BDI_CT_MPC5500 = 0x9300; /* PowerPC MPC55xx */ //************************************************************************* // Init list commands //************************************************************************* /* Init list commands for PPC targets */ public const UInt16 BDI_INIT_PPC_NOP = 0; public const UInt16 BDI_INIT_PPC_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_PPC_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_PPC_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_PPC_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_PPC_WGPR = 5; /* write to a GPR */ public const UInt16 BDI_INIT_PPC_WSPR = 6; /* write to a SPR */ public const UInt16 BDI_INIT_PPC_WMSR = 7; /* write to the MSR */ public const UInt16 BDI_INIT_PPC_WCR = 8; /* write to the CR */ public const UInt16 BDI_INIT_PPC_SUPM = 9; /* set the addresses of MCR MDR */ public const UInt16 BDI_INIT_PPC_WUPM = 10; /* writes an entry UInt16o the UPM RAM array */ public const UInt16 BDI_INIT_PPC_TSZ1 = 11; /* COP: maximal transfer size 1 byte */ public const UInt16 BDI_INIT_PPC_TSZ2 = 12; /* COP: maximal transfer size 2 byte */ public const UInt16 BDI_INIT_PPC_TSZ4 = 13; /* COP: maximal transfer size 4 byte */ public const UInt16 BDI_INIT_PPC_TSZ8 = 14; /* COP: maximal transfer size 8 byte */ public const UInt16 BDI_INIT_COP_MMAP = 15; /* COP: define a valid memory range */ public const UInt16 BDI_INIT_PPC_WM64 = 16; /* COP: write a 64 bit value to target memory */ public const UInt16 BDI_INIT_PPC_WDCR = 9; /* PPC400: device control register */ public const UInt16 BDI_INIT_PPC_MMAP = 10; /* PPC400: define a valid memory range */ public const UInt16 BDI_INIT_PPC_WTLB = 11; /* PPC440: add a TLB entry */ /* Init list commands for M-CORE targets */ public const UInt16 BDI_INIT_MMC_NOP = 0; public const UInt16 BDI_INIT_MMC_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_MMC_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_MMC_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_MMC_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_MMC_WGPR = 5; /* write to a GPR */ public const UInt16 BDI_INIT_MMC_WAFR = 6; /* write to a AFR */ public const UInt16 BDI_INIT_MMC_WCR = 7; /* write to the CR */ public const UInt16 BDI_INIT_MMC_WPC = 8; /* write to the PC */ /* Init list commands for ARM targets */ public const UInt16 BDI_INIT_ARM_NOP = 0; public const UInt16 BDI_INIT_ARM_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_ARM_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_ARM_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_ARM_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_ARM_WGPR = 5; /* write to a GPR */ public const UInt16 BDI_INIT_ARM_WCPSR = 6; /* write to the CPSR */ public const UInt16 BDI_INIT_ARM_CP15 = 7; /* write to a CP15 register */ public const UInt16 BDI_INIT_ARM_MMAP = 8; /* define a valid memory range */ public const UInt16 BDI_INIT_ARM_RM8 = 9; /* read a 8bit value from target memory */ public const UInt16 BDI_INIT_ARM_RM16 = 10; /* read a 16bit value from target memory */ public const UInt16 BDI_INIT_ARM_RM32 = 11; /* read a 32bit value from target memory */ public const UInt16 BDI_INIT_ARM_EXEC = 12; /* execute some helper code */ /* Init list commands for ARM11 targets */ public const UInt16 BDI_INIT_ARM11_NOP = 0; public const UInt16 BDI_INIT_ARM11_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_ARM11_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_ARM11_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_ARM11_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_ARM11_WGPR = 5; /* write to a GPR */ public const UInt16 BDI_INIT_ARM11_WCPSR = 6; /* write to the CPSR */ public const UInt16 BDI_INIT_ARM11_CP15 = 7; /* write to a CP15 register */ public const UInt16 BDI_INIT_ARM11_CP14 = 8; /* write to a CP14 register */ public const UInt16 BDI_INIT_ARM11_CP13 = 9; /* write to a CP13 register */ public const UInt16 BDI_INIT_ARM11_CP12 = 10; /* write to a CP12 register */ public const UInt16 BDI_INIT_ARM11_CP11 = 11; /* write to a CP11 register */ public const UInt16 BDI_INIT_ARM11_CP10 = 12; /* write to a CP10 register */ public const UInt16 BDI_INIT_ARM11_CP9 = 13; /* write to a CP9 register */ public const UInt16 BDI_INIT_ARM11_CP8 = 14; /* write to a CP8 register */ public const UInt16 BDI_INIT_ARM11_CP7 = 15; /* write to a CP7 register */ public const UInt16 BDI_INIT_ARM11_CP6 = 16; /* write to a CP6 register */ public const UInt16 BDI_INIT_ARM11_CP5 = 17; /* write to a CP5 register */ public const UInt16 BDI_INIT_ARM11_CP4 = 18; /* write to a CP4 register */ public const UInt16 BDI_INIT_ARM11_CP3 = 19; /* write to a CP3 register */ public const UInt16 BDI_INIT_ARM11_CP2 = 20; /* write to a CP2 register */ public const UInt16 BDI_INIT_ARM11_CP1 = 21; /* write to a CP1 register */ public const UInt16 BDI_INIT_ARM11_CP0 = 22; /* write to a CP0 register */ /* Init list commands for XScale targets */ public const UInt16 BDI_INIT_XSC_NOP = 0; public const UInt16 BDI_INIT_XSC_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_XSC_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_XSC_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_XSC_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_XSC_WGPR = 5; /* write to a GPR */ public const UInt16 BDI_INIT_XSC_WCPSR = 6; /* write to the CPSR */ public const UInt16 BDI_INIT_XSC_CP15 = 7; /* write to a CP15 register */ public const UInt16 BDI_INIT_XSC_CP14 = 8; /* write to a CP14 register */ public const UInt16 BDI_INIT_XSC_CP13 = 9; /* write to a CP13 register */ public const UInt16 BDI_INIT_XSC_CP12 = 10; /* write to a CP12 register */ public const UInt16 BDI_INIT_XSC_CP11 = 11; /* write to a CP11 register */ public const UInt16 BDI_INIT_XSC_CP10 = 12; /* write to a CP10 register */ public const UInt16 BDI_INIT_XSC_CP9 = 13; /* write to a CP9 register */ public const UInt16 BDI_INIT_XSC_CP8 = 14; /* write to a CP8 register */ public const UInt16 BDI_INIT_XSC_CP7 = 15; /* write to a CP7 register */ public const UInt16 BDI_INIT_XSC_CP6 = 16; /* write to a CP6 register */ public const UInt16 BDI_INIT_XSC_CP5 = 17; /* write to a CP5 register */ public const UInt16 BDI_INIT_XSC_CP4 = 18; /* write to a CP4 register */ public const UInt16 BDI_INIT_XSC_CP3 = 19; /* write to a CP3 register */ public const UInt16 BDI_INIT_XSC_CP2 = 20; /* write to a CP2 register */ public const UInt16 BDI_INIT_XSC_CP1 = 21; /* write to a CP1 register */ public const UInt16 BDI_INIT_XSC_CP0 = 22; /* write to a CP0 register */ /* Init list commands for HC12 targets */ public const UInt16 BDI_INIT_CPU12_NOP = 0; public const UInt16 BDI_INIT_CPU12_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_CPU12_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_CPU12_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_CPU12_WM32 = 4; /* write a 32bit value to target memory */ /* Init list commands for TriCore targets */ public const UInt16 BDI_INIT_TRI_NOP = 0; public const UInt16 BDI_INIT_TRI_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_TRI_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_TRI_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_TRI_WM32 = 4; /* write a 32bit value to target memory */ /* Init list commands for MIPS32 targets */ public const UInt16 BDI_INIT_MIPS_NOP = 0; public const UInt16 BDI_INIT_MIPS_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_MIPS_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_MIPS_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_MIPS_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_MIPS_WGPR = 5; /* write to a GPR */ public const UInt16 BDI_INIT_MIPS_WCP0 = 6; /* write to the CP0 registers */ /* Init list commands for ColdFire targets */ public const UInt16 BDI_INIT_MCF_NOP = 0; public const UInt16 BDI_INIT_MCF_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_MCF_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_MCF_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_MCF_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_MCF_WDREG = 5; /* write to a data register */ public const UInt16 BDI_INIT_MCF_WAREG = 6; /* write to a address registers */ public const UInt16 BDI_INIT_MCF_WCREG = 7; /* write to a control register */ public const UInt16 BDI_INIT_MCF_MMAP = 8; /* define a valid memory range */ /* Init list commands for MPC85xx targets */ public const UInt16 BDI_INIT_PQ3_NOP = 0; public const UInt16 BDI_INIT_PQ3_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_PQ3_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_PQ3_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_PQ3_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_PQ3_WM64 = 5; /* write a 64 bit value to target memory */ public const UInt16 BDI_INIT_PQ3_WGPR = 6; /* write to a GPR */ public const UInt16 BDI_INIT_PQ3_WSPR = 7; /* write to a SPR */ public const UInt16 BDI_INIT_PQ3_WMSR = 8; /* write to the MSR */ public const UInt16 BDI_INIT_PQ3_WCR = 9; /* write to the CR */ public const UInt16 BDI_INIT_PQ3_SUPM = 10; /* set the addresses of MCR MDR */ public const UInt16 BDI_INIT_PQ3_WUPM = 11; /* writes an entry UInt16o the UPM RAM array */ public const UInt16 BDI_INIT_PQ3_TSZ1 = 12; /* maximal transfer size 1 byte */ public const UInt16 BDI_INIT_PQ3_TSZ2 = 13; /* maximal transfer size 2 byte */ public const UInt16 BDI_INIT_PQ3_TSZ4 = 14; /* maximal transfer size 4 byte */ public const UInt16 BDI_INIT_PQ3_TSZ8 = 15; /* maximal transfer size 8 byte */ public const UInt16 BDI_INIT_PQ3_MMAP = 16; /* define a valid memory range */ public const UInt16 BDI_INIT_PQ3_EXEC = 17; /* execute some helper code */ /* Init list commands for MPC55xx targets */ public const UInt16 BDI_INIT_P55_NOP = 0; public const UInt16 BDI_INIT_P55_DELAY = 1; /* delay, value in milliseconds */ public const UInt16 BDI_INIT_P55_WM8 = 2; /* write a 8bit value to target memory */ public const UInt16 BDI_INIT_P55_WM16 = 3; /* write a 16bit value to target memory */ public const UInt16 BDI_INIT_P55_WM32 = 4; /* write a 32bit value to target memory */ public const UInt16 BDI_INIT_P55_FILL = 5; /* fill a memory range with 64-bit writes */ public const UInt16 BDI_INIT_P55_RM8 = 6; /* read a 8bit value from target memory */ public const UInt16 BDI_INIT_P55_RM16 = 7; /* read a 16bit value from target memory */ public const UInt16 BDI_INIT_P55_RM32 = 8; /* read a 32bit value from target memory */ public const UInt16 BDI_INIT_P55_WGPR = 9; /* write to a GPR */ public const UInt16 BDI_INIT_P55_WSPR = 10; /* write to a SPR */ public const UInt16 BDI_INIT_P55_WMSR = 11; /* write to the MSR */ public const UInt16 BDI_INIT_P55_WCR = 12; /* write to the CR */ public const UInt16 BDI_INIT_P55_WPC = 13; /* write to the PC */ public const UInt16 BDI_INIT_P55_MMAP = 14; /* define a valid memory range */ public const UInt16 BDI_INIT_P55_WTLB = 15; /* add a TLB entry */ public const UInt16 BDI_INIT_P55_EXEC = 16; /* execute some helper code */ //************************************************************************* // Register Types //************************************************************************* /* Register types for PPC targets */ public const UInt16 BDI_RT_PPC_GPR = 100; /* General-purpose registers */ public const UInt16 BDI_RT_PPC_FPR = 101; /* Floating-poUInt16 registers (currently not supported) */ public const UInt16 BDI_RT_PPC_SPR = 102; /* Special-purpose registers */ public const UInt16 BDI_RT_PPC_CR = 103; /* Condition Register */ public const UInt16 BDI_RT_PPC_MSR = 104; /* Machine State Register */ public const UInt16 BDI_RT_PPC_FPSCR = 105; /* Floating-poUInt16 Status and Control Register */ public const UInt16 BDI_RT_PPC_MM8 = 106; /* Memory mapped 8bit register */ public const UInt16 BDI_RT_PPC_MM16 = 107; /* Memory mapped 16bit register */ public const UInt16 BDI_RT_PPC_MM32 = 108; /* Memory mapped 32bit register */ public const UInt16 BDI_RT_PPC_IAR = 109; /* Instruction Address Register */ public const UInt16 BDI_RT_PPC_SR = 110; /* Segment Register */ public const UInt16 BDI_RT_PPC_DCR = 111; /* Device Control registers (PPC400) */ public const UInt16 BDI_RT_PPC_PMR = 112; /* Performance Monitor registers (MPC85xx) */ /* Register types for ColdFire targets */ public const UInt16 BDI_RT_MCF_DATA = 200; /* Data Registers */ public const UInt16 BDI_RT_MCF_ADDR = 201; /* Address Registers */ public const UInt16 BDI_RT_MCF_CTRL = 202; /* Control Registers */ public const UInt16 BDI_RT_MCF_DBUG = 203; /* Debug Module Registers */ /* Register addresses for ColdFire targets */ public const UInt16 BDI_RA_MCF_CACR = 0x002; /* Cache Control Register */ public const UInt16 BDI_RA_MCF_ACR0 = 0x004; /* Access Control Unit 0 */ public const UInt16 BDI_RA_MCF_ACR1 = 0x005; /* Access Control Unit 1 */ public const UInt16 BDI_RA_MCF_VBR = 0x801; /* Vector Base Register */ public const UInt16 BDI_RA_MCF_SR = 0x80E; /* Status Register */ public const UInt16 BDI_RA_MCF_PC = 0x80F; /* Program Counter */ public const UInt16 BDI_RA_MCF_CSR = 0x000; /* Debug: Configuration/Status */ public const UInt16 BDI_RA_MCF_BAAR = 0x005; /* Debug: BDM Address Attribute */ public const UInt16 BDI_RA_MCF_AATR = 0x006; /* Debug: Bus Address Attribute */ public const UInt16 BDI_RA_MCF_TDR = 0x007; /* Debug: Trigger Definition */ public const UInt16 BDI_RA_MCF_PBR = 0x008; /* Debug: PC BreakpoUInt16 */ public const UInt16 BDI_RA_MCF_PBMR = 0x009; /* Debug: PC BreakpoUInt16 Mask */ public const UInt16 BDI_RA_MCF_ABHR = 0x00C; /* Debug: Operand Address High BreakpoUInt16 */ public const UInt16 BDI_RA_MCF_ABLR = 0x00D; /* Debug: Operand Address Low BreakpoUInt16 */ public const UInt16 BDI_RA_MCF_DBR = 0x00E; /* Debug: Data BreakpoUInt16 */ public const UInt16 BDI_RA_MCF_DBMR = 0x00F; /* Debug: Data BreakpoUInt16 Mask */ /* Register types for CPU32 targets */ public const UInt16 BDI_RT_CPU32_DATA = 200; /* Data Registers */ public const UInt16 BDI_RT_CPU32_ADDR = 201; /* Address Registers */ public const UInt16 BDI_RT_CPU32_PC = 202; /* Program Counter */ public const UInt16 BDI_RT_CPU32_SR = 203; /* Status Register (32bit transfer) */ public const UInt16 BDI_RT_CPU32_USP = 204; /* User Stack PoUInt16er */ public const UInt16 BDI_RT_CPU32_SSP = 205; /* Supervisor Stack PoUInt16er */ public const UInt16 BDI_RT_CPU32_VBR = 206; /* Vector Base Register */ public const UInt16 BDI_RT_CPU32_SFC = 207; /* Source Function Code Register */ public const UInt16 BDI_RT_CPU32_DFC = 208; /* Destination Function Code Register */ /* Register types for CPU16 targets */ public const UInt16 BDI_RT_CPU16_D = 300; /* Register D */ public const UInt16 BDI_RT_CPU16_E = 301; /* Register E */ public const UInt16 BDI_RT_CPU16_IX = 302; /* Index Register X */ public const UInt16 BDI_RT_CPU16_IY = 303; /* Index Register Y */ public const UInt16 BDI_RT_CPU16_IZ = 304; /* Index Register Z */ public const UInt16 BDI_RT_CPU16_K_EXT = 305; /* Address Exzension (K) Register */ public const UInt16 BDI_RT_CPU16_CCR = 306; /* Condition Code Register [15:4] */ public const UInt16 BDI_RT_CPU16_SP = 307; /* Stack PoUInt16er (includes extension SK) */ public const UInt16 BDI_RT_CPU16_PC = 308; /* Program Counter (includes extension PK) */ public const UInt16 BDI_RT_MAC_HR = 310; /* MAC Register H */ public const UInt16 BDI_RT_MAC_IR = 311; /* MAC Register I */ public const UInt16 BDI_RT_MAC_AM = 312; /* MAC Register AM [31:0] */ public const UInt16 BDI_RT_MAC_SL_AM = 313; /* MAC Register SL and AM[35:32] */ public const UInt16 BDI_RT_MAC_XM_YM = 314; /* MAC Register XM:YM */ /* Register types for CPU12 targets */ public const UInt16 BDI_RT_CPU12_D = 400; /* Register D */ public const UInt16 BDI_RT_CPU12_IX = 401; /* Index Register X */ public const UInt16 BDI_RT_CPU12_IY = 402; /* Index Register Y */ public const UInt16 BDI_RT_CPU12_SP = 403; /* Stack PoUInt16er */ public const UInt16 BDI_RT_CPU12_PC = 404; /* Program Counter */ public const UInt16 BDI_RT_CPU12_CCR = 405; /* Condition Code Register */ public const UInt16 BDI_RT_CPU12_RPOS = 406; /* Address of UInt16ernal register space */ public const UInt16 BDI_RT_CPU12_REG = 407; /* Access a byte in the register space */ public const UInt16 BDI_RT_CPU12_BDMB = 408; /* Access a byte in BDM address space */ public const UInt16 BDI_RT_CPU12_BDMW = 409; /* Access a ushort in BDM address space */ /* Register types for M-CORE targets */ public const UInt16 BDI_RT_MCORE_GPR = 500; /* General-purpose registers */ public const UInt16 BDI_RT_MCORE_AFR = 501; /* Alternate register file */ public const UInt16 BDI_RT_MCORE_PC = 502; /* Program Counter */ public const UInt16 BDI_RT_MCORE_PSR = 503; /* Program Status Register */ public const UInt16 BDI_RT_MCORE_CR = 504; /* Control Registers */ public const UInt16 BDI_RT_MCORE_ONCE = 505; /* OnCE Registers */ /* Register addresses for M-CORE targets */ public const UInt16 BDI_RA_MCORE_VBR = 1; public const UInt16 BDI_RA_MCORE_EPSR = 2; public const UInt16 BDI_RA_MCORE_FPSR = 3; public const UInt16 BDI_RA_MCORE_EPC = 4; public const UInt16 BDI_RA_MCORE_FPC = 5; public const UInt16 BDI_RA_MCORE_SS0 = 6; public const UInt16 BDI_RA_MCORE_SS1 = 7; public const UInt16 BDI_RA_MCORE_SS2 = 8; public const UInt16 BDI_RA_MCORE_SS3 = 9; public const UInt16 BDI_RA_MCORE_SS4 = 10; public const UInt16 BDI_RA_MCORE_GCR = 11; public const UInt16 BDI_RA_MCORE_GSR = 12; /* Register types for ARM targets */ public const UInt16 BDI_RT_ARM_GPR = 600; /* General-purpose registers */ public const UInt16 BDI_RT_ARM_CPSR = 601; /* Current process status register */ public const UInt16 BDI_RT_ARM_ICEB = 602; /* ICEBreaker registers */ public const UInt16 BDI_RT_ARM_USR = 603; /* user registers */ public const UInt16 BDI_RT_ARM_FIQ = 604; /* FIQ banked registers */ public const UInt16 BDI_RT_ARM_SPSR_FIQ = 605; /* FIQ saved process status register */ public const UInt16 BDI_RT_ARM_SVC = 606; /* supervisor banked registers */ public const UInt16 BDI_RT_ARM_SPSR_SVC = 607; /* supervisor saved process status register */ public const UInt16 BDI_RT_ARM_ABT = 608; /* abort banked registers */ public const UInt16 BDI_RT_ARM_SPSR_ABT = 609; /* abort saved process status register */ public const UInt16 BDI_RT_ARM_IRQ = 610; /* IRQ banked registers */ public const UInt16 BDI_RT_ARM_SPSR_IRQ = 611; /* IRQ saved process status register */ public const UInt16 BDI_RT_ARM_UND = 612; /* undefined banked registers */ public const UInt16 BDI_RT_ARM_SPSR_UND = 613; /* undefined saved process status register */ public const UInt16 BDI_RT_ARM_CP15 = 614; /* CP15 registers */ public const UInt16 BDI_RT_ARM_CP14 = 615; /* CP14 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP13 = 616; /* CP13 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP12 = 618; /* CP12 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP11 = 617; /* CP11 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP10 = 619; /* CP10 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP9 = 620; /* CP9 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP8 = 621; /* CP8 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP7 = 622; /* CP7 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP6 = 623; /* CP6 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP5 = 624; /* CP5 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP4 = 625; /* CP4 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP3 = 626; /* CP3 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP2 = 627; /* CP2 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP1 = 628; /* CP1 registers (only XScale and ARM11) */ public const UInt16 BDI_RT_ARM_CP0 = 629; /* CP0 registers (only XScale and ARM11) */ /* Register types for TriCore targets */ public const UInt16 BDI_RT_TRICORE_DGPR = 700; /* Data Registers */ public const UInt16 BDI_RT_TRICORE_AGPR = 701; /* Address Registers */ public const UInt16 BDI_RT_TRICORE_PC = 702; /* Program Counter */ public const UInt16 BDI_RT_TRICORE_PSW = 703; /* Status Register PSW*/ public const UInt16 BDI_RT_TRICORE_PCXI = 704; /* Status Register PCXI */ /* Register types for MIPS32 targets */ public const UInt16 BDI_RT_MIPS_GPR = 800; /* General-purpose registers */ public const UInt16 BDI_RT_MIPS_PC = 801; /* Current Program Counter */ public const UInt16 BDI_RT_MIPS_HI = 802; /* HI registers */ public const UInt16 BDI_RT_MIPS_LO = 803; /* LO registers */ public const UInt16 BDI_RT_MIPS_CP0 = 804; /* CP0 registers */ public const UInt16 BDI_RT_MIPS_CP1 = 805; /* CP1 registers */ public const UInt16 BDI_RT_MIPS_FPR = 806; /* Floating-poUInt16 registers */ //************************************************************************* // Other defines //************************************************************************* /* address types */ public const UInt16 BDI_AT_DEFAULT = 0; /* default address space */ public const UInt16 BDI_AT_GLOBAL = 1; /* S12X: global address space */ public const UInt16 BDI_AT_PHYSICAL = 2; /* HC12: physical address space */ /* watch mode bits */ public const UInt16 BDI_WATCH_EXECUTE = (1 << 0); public const UInt16 BDI_WATCH_READ = (1 << 1); public const UInt16 BDI_WATCH_WRITE = (1 << 2); public const UInt16 BDI_WATCH_DATA = (1 << 3); public const UInt16 BDI_WATCH_COMP = (1 << 4); public const UInt16 BDI_WATCH_SIZE = (1 << 6); public const UInt16 BDI_WATCH_MASK = (1 << 7); /* other defines */ public const Int16 BDI_BREAK_ALL = -1; /* used to select all breakpoUInt16s */ public const Int16 BDI_WATCH_ALL = -1; /* used to select all watchpoUInt16s */ public const UInt16 BDI_MAX_ID_SIZE = 40; /* maximal size of setup ID */ /* Flash Types */ public const UInt16 BDI_FLASH_AM29F0X0 = 2; /* e.g. Am29F010, Am29F040 */ public const UInt16 BDI_FLASH_AM29F = 2; public const UInt16 BDI_FLASH_I28FBXB = 5; /* e.g. i28F001BX, i28F400BX (byte-mode) */ public const UInt16 BDI_FLASH_I28BX8 = 5; public const UInt16 BDI_FLASH_I28FBXW = 6; /* e.g. i28F400BX (ushort-mode) */ public const UInt16 BDI_FLASH_I28BX16 = 6; public const UInt16 BDI_FLASH_AM29FX00B = 11; /* e.g. Am29F100 (byte-mode) */ public const UInt16 BDI_FLASH_AM29BX8 = 11; public const UInt16 BDI_FLASH_AM29FX00W = 12; /* e.g. Am29F100 (ushort-mode) */ public const UInt16 BDI_FLASH_AM29BX16 = 12; public const UInt16 BDI_HC12_EEPROM = 14; /* HC12 UInt16ernal EEPROM */ public const UInt16 BDI_HC12_FLASH = 15; /* HC12 UInt16ernal Flash */ public const UInt16 BDI_MPC555_FLASH = 16; /* MPC555 flash array */ public const UInt16 BDI_MPC555_SHADOW = 17; /* MPC555 flash shadow information */ public const UInt16 BDI_HC12A_EEPROM = 18; /* UInt16ernal EEPROM of HC12A targets */ public const UInt16 BDI_HC12A_FLASH = 19; /* UInt16ernal Flash of HC12A targets */ public const UInt16 BDI_STAR12_EEPROM = 20; /* UInt16ernal EEPROM of STAR12 targets */ public const UInt16 BDI_STAR12_FLASH = 21; /* UInt16ernal Flash of STAR2 targets */ public const UInt16 BDI_MCORE_SGFM = 21; /* UInt16ernal Flash of MMC2114,MMC2113 */ public const UInt16 BDI_FLASH_AT49 = 22; /* Atmel AT49 byte mode only chip */ public const UInt16 BDI_FLASH_AT49X8 = 23; /* Atmel AT49 byte/ushort chip in byte mode */ public const UInt16 BDI_FLASH_AT49X16 = 24; /* Atmel AT49 byte/ushort chip in ushort mode */ public const UInt16 BDI_UC3F_FLASH = 25; /* UC3F flash array */ public const UInt16 BDI_UC3F_SHADOW = 26; /* UC3F shadow information */ public const UInt16 BDI_FLASH_STRATAX8 = 29; /* UInt16el StrataFlash x8 mode */ public const UInt16 BDI_FLASH_STRATAX16 = 30; /* UInt16el StrataFlash x16 mode */ public const UInt16 BDI_FLASH_MIRROR = 31; /* AMD MirrorBit Flash byte mode only chip */ public const UInt16 BDI_FLASH_MIRRORX8 = 32; /* AMD MirrorBit Flash byte/ushort chip in byte mode */ public const UInt16 BDI_FLASH_MIRRORX16 = 33; /* AMD MirrorBit Flash byte/ushort chip in ushort mode */ public const UInt16 BDI_FLASH_I28FBXD = 34; /* UInt16el algorithm for x32 chip */ public const UInt16 BDI_FLASH_AM29DX16 = 35; /* AMD x32 chip in x16 mode */ public const UInt16 BDI_FLASH_AM29DX32 = 36; /* AMD x32 chip in x32 mode */ public const UInt16 BDI_FLASH_AM29BDDX16 = 37; /* Am29BDD160G chip in x16 mode */ public const UInt16 BDI_FLASH_AM29BDDX32 = 38; /* Am29BDD160G chip in x32 mode */ public const UInt16 BDI_FLASH_CFM = 39; /* ColdFire Flash Module (MCF5282) */ public const UInt16 BDI_FLASH_CFM32 = 40; /* MAC7100 Code Flash Module */ public const UInt16 BDI_FLASH_CFM16 = 41; /* MAC7100 Data Flash Module */ public const UInt16 BDI_FLASH_LPC2000 = 42; /* Philips LPC2000 Flash Module */ public const UInt16 BDI_FLASH_STA2051 = 43; /* ST STA2051 UInt16ernal flash */ public const UInt16 BDI_FLASH_STR710 = 43; /* ST STR71x UInt16ernal flash */ public const UInt16 BDI_FLASH_ADUC7000 = 44; /* Analog Device ADuC7000 UInt16ernal flash */ public const UInt16 BDI_FLASH_ST30F = 45; /* ST ST30F UInt16ernal flash */ public const UInt16 BDI_FLASH_AT91SAM7S = 46; /* Atmel AT91SAM7Sxx UInt16ernal flash */ public const UInt16 BDI_FLASH_S29M64X8 = 47; /* Spansion MirrorBit Flash 64 byte write buffer */ public const UInt16 BDI_FLASH_S29M32X16 = 48; /* Spansion MirrorBit Flash 32 ushort write buffer */ public const UInt16 BDI_FLASH_STR910F = 49; /* ST STR91xF UInt16ernal flash */ public const UInt16 BDI_FLASH_H7F = 50; /* MPC55xx flash array */ public const UInt16 BDI_S12XE_PFLASH = 51; /* S12XE FTM P-Flash */ public const UInt16 BDI_S12XE_DFLASH = 52; /* S12XE FTM D-Flash */ /* Firmware type, used to select correct firmware */ public const UInt16 BDI_FWT_CPU32 = 0; /* CPU32/CPU16 targets */ public const UInt16 BDI_FWT_MPC = 5; /* MPC8xx / MPC5xx targets */ public const UInt16 BDI_FWT_MCF = 6; /* ColdFire targets */ public const UInt16 BDI_FWT_CPU12 = 7; /* CPU12 targets */ public const UInt16 BDI_FWT_MCORE = 8; /* M-CORE targets */ public const UInt16 BDI_FWT_ARM = 10; /* ARM7TDMI targets */ public const UInt16 BDI_FWT_TRICORE = 11; /* TriCore targets */ public const UInt16 BDI_FWT_COP = 17; /* PPC6xx/7xx/82xx/74xx targets */ public const UInt16 BDI_FWT_PPC400 = 20; /* PPC4xx targets */ public const UInt16 BDI_FWT_MPC7450 = 27; /* MPC7450 targets */ public const UInt16 BDI_FWT_MIPS32 = 30; /* MIPS32 targets */ public const UInt16 BDI_FWT_XSCALE = 33; /* XScale targets */ public const UInt16 BDI_FWT_MPC8500 = 37; /* MPC85xx targets */ public const UInt16 BDI_FWT_ARM11 = 40; /* ARM11 targets */ /* Firmware update mode */ public const UInt16 BDI_UPDATE_AUTO = 0; /* update firmware/logic only needed */ public const UInt16 BDI_UPDATE_FIRMWARE = 1; /* update firmware in any case */ public const UInt16 BDI_UPDATE_LOGIC = 2; /* update logic in any case */ public const UInt16 BDI_UPDATE_ALL = 3; /* update firmware and logic in any case */ /* Option ID's */ public const UInt16 BDI_OPT_ARM_SCANINIT = 1; /* define ARM JTAG scan init string */ public const UInt16 BDI_OPT_ARM_SCANPOST = 2; /* define ARM JTAG scan post string */ //************************************************************************* // Low level JTAG access //************************************************************************* public const int JTAG_CMD_CLOSE = 0; public const int JTAG_CMD_OPEN = 1; public const int JTAG_CMD_SPEED = 2; public const int JTAG_CMD_PORT = 3; public const int JTAG_CMD_CLOCK = 4; public const int JTAG_CMD_SCAN = 5; public const int JTAG_CMD_IRSCAN = 6; public const int JTAG_CMD_DRSCAN = 7; public const int JTAG_PORT_MASK = 3; public const int JTAG_PORT_KEEP = 0; public const int JTAG_PORT_LOW = 1; public const int JTAG_PORT_HIGH = 2; public const int JTAG_PORT_OPENDRAIN = 1; public const int JTAG_PORT_PUSHPULL = 2; public const int JTAG_CLOCK_TDO = (1 << 1); public const int JTAG_CLOCK_TMS = (1 << 0); public const int JTAG_SCAN_LAST = (1 << 2); public const int JTAG_SCAN_DATA = (1 << 1); public const int JTAG_SCAN_TMS = (1 << 0); public const int JTAG_MAX_SCAN = 8192; //************************************************************************* // HC12 Flash/EEPROM Programming Functions //************************************************************************* public const int BDI_CPU_HC812A4 = 0; public const int BDI_CPU_HC912B32 = 1; public const int BDI_CPU_HC912D60 = 2; public const int BDI_CPU_HC912DG128 = 3; public const int BDI_CPU_HC912DA128 = 4; public const int BDI_CPU_HC912D60A = 5; public const int BDI_CPU_HC912DG128A = 6; public const int BDI_CPU_HC912DT128A = 7; public const int BDI_CPU_MC9S12D256 = 8; public const int BDI_CPU_MC9S12D128 = 9; public const int BDI_CPU_MC9S12D64 = 10; public const int BDI_CPU_MC9S12D32 = 11; public const int BDI_CPU_CUSTOM_1 = 12; public const int BDI_CPU_MC9S12D512 = 13; public const int BDI_CPU_MC9S12E256 = 14; public const int BDI_CPU_MC9S12E128 = 15; /* alternate defines */ public const int BDI_CPU_S12_256K4_4K = 8; public const int BDI_CPU_S12_128K2_2K = 9; public const int BDI_CPU_S12_64K1_1K = 10; public const int BDI_CPU_S12_32K1_1K = 11; public const int BDI_CPU_S12_512K4_4K = 13; public const int BDI_CPU_S12_256K2_4K = 14; public const int BDI_CPU_S12_128K1_2K = 15; public const int BDI_CPU_S12X_128K1 = 16; public const int BDI_CPU_S12X_256K2 = 17; public const int BDI_CPU_S12X_512K4 = 18; public const int BDI_CPU_S12_256K2_2K = 19; /* 256k flash, 2k EPROM */ public const int BDI_CPU_S12XE = 20; public const int BDI_HC12_PAGED = (1 << 15); /* Paged addresses in S-record file */ //************************************************************************* // Flash Programming Functions //************************************************************************* public const int BDI_ERASE_SECTOR = 0; public const int BDI_ERASE_PAGE = 0; public const int BDI_ERASE_BLOCK = 1; public const int BDI_ERASE_CHIP = 2; public const int BDI_ERASE_LOW = 0; /* select MPC55xx flash space */ public const int BDI_ERASE_MID = 1; public const int BDI_ERASE_HIGH = 2; public const int BDI_ERASE_SHADOW = 3; //************************************************************************* // Typedefs //************************************************************************* public struct BDI_RegTypeT { public UInt16 regType; public UInt16 regAddr; } public struct BDI_InitTypeT { public UInt16 command; public UInt32 address; public UInt32 value; } public struct BDI_InfoT { public ushort fwType; public ushort fwVersion; public ushort cpuType; public ulong setupTimeStamp; public char[] setupId; // = new char[BDI_MAX_ID_SIZE]; } //typedef int BDI_ProgressCallbackT(UInt32); //************************************************************************* // Methodes //************************************************************************* [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_Connect( char* parameter); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_Connect( char* host, UInt32 param); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_Disconnect(); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_RegisterGet( UInt16 count, BDI_RegTypeT[] pRegList, UInt32* pValues); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_RegisterSet( UInt16 count, BDI_RegTypeT[] pRegList, UInt32* pValues); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FPRegGet( UInt16 first, UInt16 last, byte[] data); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FPRegSet( UInt16 first, UInt16 last, byte[] data); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_VRegGet( UInt16 first, UInt16 last, byte[] data); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_VRegSet( UInt16 first, UInt16 last, byte[] data); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_GetByte( UInt32 addr, byte* value); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_GetWord( UInt32 addr, UInt16* value); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_GetLong( UInt32 addr, UInt32* value); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_SetByte( UInt32 addr, byte value); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_SetWord( UInt32 addr, UInt16 value); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_SetLong( UInt32 addr, UInt32 value); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_DumpBlock( UInt32 addr, UInt16 count, byte[] block); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_DumpFile( char* filename, UInt32 addr, UInt32 count); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_DumpBinary( char* filename, UInt32 addr, UInt32 count); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_LoadBlock( UInt32 addr, UInt16 count, byte[] block, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_LoadFile( char* filename, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_LoadFile2( char* filename, UInt32 offset, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_LoadBinary( char* filename, UInt32 startAddr, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_VerifyBlock( UInt32 addr, UInt16 count, byte[] block, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_VerifyFile( char* filename, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_VerifyFile2( char* filename, UInt32 offset, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_VerifyBinary( char* fileName, UInt32 startAddr, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_TargetReset(); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_SetBdmSpeed( UInt32 cpuClock); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_SetOption( byte id, char* data); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_TargetStartup( Int16 resetTime, UInt32 cpuClock, Int16 initCount, BDI_InitTypeT[] pInitList); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_InitListReset(); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_InitListAdd( UInt16 command, UInt32 address, UInt32 value); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_TargetStart(); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_TargetHalt(); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_StateGet( UInt16* state, int* error, UInt32* timeStamp, UInt16* count, UInt32* info); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashSetType( UInt16 flashType, UInt32 flashSize, UInt16 pageSize, UInt16 memoryWidth, UInt32 workSpace); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashEraseSector( UInt32 sectorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashErase( UInt16 mode, UInt32 addr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashWriteBlock( UInt32 addr, UInt16 count, byte[] block, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashWriteFile( char* filename, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashWriteFile2( char* filename, UInt32 offset, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashWriteBinary( char* filename, UInt32 startAddr, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashSetupHC12( UInt16 cpuType, UInt16 flashType, UInt16 memoryWidth, UInt32 flashSize, UInt32 workSpace); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashEraseHC12( UInt32 flashAddr, UInt32 flashSize); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_EnableAutoProgHC12( char* commPort, UInt16 cpuType, UInt16 bdmClock, UInt16 regAddr, UInt16 ramAddr, UInt16 initCount, BDI_InitTypeT[] pInitList, bool flashErase, bool flashVerify, char* flashName, bool eepErase, bool eepVerify, char* eepName); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_DisableAutoProgHC12( char* commPort); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashSetup555( UInt16 flashType, UInt32 cpuClock, UInt32 workSpace); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashErase555( UInt32 flashBase, UInt32 blockMask, bool clearCensor, UInt32 cpuClock, UInt32 workSpace); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashWrite555( char* fileName, UInt32* errorAddr); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashSetupUC3F( UInt16 flashType, UInt32 workSpace); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashEraseUC3F( UInt32 flashBase, UInt32 blockMask, bool clearCensor, UInt32 workSpace); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashSetupSGFM( UInt32 cpuClock, UInt32 workSpace); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FlashSetupLPC2000( UInt32 flashSize, UInt32 sysClock, UInt32 workSpace); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_InfoGet( BDI_InfoT[] bdiInfo); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_TypeGet( UInt16* bdiType, UInt16 fwType, UInt16* fwVersion); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_UpdateFirmwareLogic( char* szPort, char* szPath, UInt16 targetType, UInt16 updateMode); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_ConfigNetwork( char* szPort, char* szBdiIP, char* szSubnetMask, char* szDefaultGateway); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_GetConfiguation( char* szPort, char* szBdiType, char* szBdiTarget, char* szBdiVersions, char* szBdiMAC, char* szBdiIP, char* szSubnetMask, char* szDefaultGateway); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern string BDI_ErrorTextGet( int error); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_ChannelRead( UInt16 channel, UInt16 count, byte[] data); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_ChannelWrite( UInt16 channel, UInt16 count, byte[] data); //[DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] //public unsafe static extern void BDI_InstallCallback(BDI_ProgressCallbackT* cb); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_FileSize( char* fileName); [DllImport("bdiifc32.dll", CharSet = CharSet.Ansi)] public unsafe static extern int BDI_DoJtag( byte command, byte control, UInt16 count, byte[] pScanOut, byte[] pScanIn); } }