|
我的一个代码如下:
......
#include "s2440.h"
......
volatile IOPreg *s2440IOP = (IOPreg *)IOP_BASE;
volatile INTreg *s2440INT = (INTreg *)INT_BASE;
void Virtual_Alloc()
{
s2440IOP = (volatile IOPreg *) VirtualAlloc(0,sizeof(IOPreg),MEM_RESERVE, PAGE_NOACCESS);
if(s2440IOP == NULL) {
RETAILMSG(1,(TEXT("For s2440IOP: VirtualAlloc faiLED!\r\n")));
}
else {
if(!VirtualCopy((PVOID)s2440IOP,(PVOID)(IOP_BASE),sizeof(IOPreg),PAGE_READWRITE | PAGE_NOCACHE )) {
RETAILMSG(1,(TEXT("For s2440IOP: VirtualCopy faiLED!\r\n")));
}
}
}
编译器出错:
BUILD: [01:0000000021:ERRORE] c:\WINCE420\PBWorkspaces\mini2440\HGPIO\IO_pin.cpp(33) : error C2143: syntax error : missing ';' before '*'
错误就在 volatile IOPreg *s2440IOP = (IOPreg *)IOP_BASE;这一行
但是我查看"s2440.h"关于IOP_BASE的定义是这样的
#define IOP_BASE 0xB1600000 // 0x56000000
typedef struct {
unsigned int rGPACON; // 00
unsigned int rGPADAT;
unsigned int rPAD1[2];
unsigned int rGPBCON; // 10
unsigned int rGPBDAT;
unsigned int rGPBUP;
unsigned int rPAD2;
......
此处删除40行
......
......
unsigned int rGPJCON; // D0
unsigned int rGPJDAT;
unsigned int rGPJUP;
unsigned int rPAD9;
}IOPreg;
而volatile IOPreg *s2440IOP = (IOPreg *)IOP_BASE;这句话是我在一个demo程序里面拷贝出来的。不知道为什么不能编译,郁闷
帮我看看是什么错误?
|
|