阅读:1604回复:3
请教变量问题
OEMAddressTable
;;;------------------------------------------------------------- ;;; Virt Addr Phys Addr MB ;;;------------------------------------------------------------- DCD 0x80000000, 0x02000000, 30 ; 30 MB SRAM(SRAM/ROM) BANK 0 DCD 0x82000000, 0x08000000, 32 ; 32 MB SROM(SRAM/ROM) BANK 1 DCD 0x84000000, 0x10000000, 32 ; 32 MB SROM(SRAM/ROM) BANK 2 DCD 0x86000000, 0x18000000, 32 ; 32 MB SROM(SRAM/ROM) BANK 3 DCD 0x88000000, 0x20000000, 32 ; 32 MB SROM(SRAM/ROM) BANK 4 DCD 0x8A000000, 0x28000000, 32 ; 32 MB SROM(SRAM/ROM) BANK 5 DCD 0x8C000000, 0x30000000, 64 ; 64 MB DRAM BANK 0, 1 config.bib NK 8C200000 01D00000 RAMIMAGE RAM 8E000000 01F00000 RAM ; Common RAM areas AUD_DMA 8c002000 00002000 RESERVED DRV_GLB 8c010000 00010000 RESERVED DBGSER_DMA 8c022000 00002000 RESERVED SER_DMA 8c024000 00002000 RESERVED IR_DMA 8c026000 00002000 RESERVED SD_DMA 8c028000 00008000 RESERVED DISPLAY 8c032000 001a0000 RESERVED GLOBALS 8c1D2000 0002E000 RESERVED 请教在驱动里面,如何使用 GLOBALS 作全局变量? volatile int *P; P = (volatile int *)VirtualAlloc((PVOID)0x8c1D2000, sizeof(int), MEM_RESERVE, PAGE_READWRITE); 为什么这样总是分配内存失败? 要在两个驱动间共享一个全局变量如何实现? |
|
沙发#
发布于:2009-08-24 09:27
你用 VirtualAlloc(0, sizeof(int), MEM_RESERVE, PAGE_NOACCESS);然后调用
VirtualCopy((PVOID)p, (PVOID)(0x8c1D2000>> 8), sizeof(int), PAGE_PHYSICAL|PAGE_READWRITE|PAGE_NOCACHE) 试一下。 两个驱动之间还可以通过共享内存来实现 |
|
板凳#
发布于:2009-08-25 17:53
不行试过了~~~~~~还是thanks
|
|
地板#
发布于:2009-08-28 17:48
wince_lover的方法肯定可以,楼主应该是你用法问题。
要不你试试下面这种写法。 pointer = VirtualAlloc(0, sizeof(int), MEM_RESERVE, PAGE_NOACCESS); VirtualCopy((PVOID)pointer, (PVOID)0xac1D2000, sizeof, PAGE_READWRITE|PAGE_NOCACHE) |
|