阅读:1541回复:2
请教斑竹及各位高手,谢谢
小弟最近在写基于S3C2410的无线芯片nRF2401的底层驱动,在编译流驱动的时候出现了下面问题,还请各位赐教啊:
/******************************************************************************* 函数名称: NRF_Read 描 述:从NRF2401读取数据 输入参数: DWORD Handle : 驱动程序引用事例句柄 LPVOID pBuffer : 接收缓冲区 DWORD dwNumBytes: 要读的字节数 输出参数: 无 返 回: 实际读到字节数 *******************************************************************************/ DWORD NRF_Read(DWORD hOpenContext, LPCVOID pBuffer, DWORD Count) { UINT32 i; if (!g_OpenCount) return 0; LPCVOID pReadBuffer; if ((pBuffer == NULL) || (Count <= 0)) return 0; pReadBuffer = MapPtrToProcess((UCHAR *)pBuffer, GetCallerProcess()); for(i=0;i<10;i++){ RxBuf = 0;} SetRxMode(); // 设置为接收模式 Sleep(5); NRF_RxPacket(); memcpy(pReadBuffer,RxBuf,sizeof(RxBuf)); return Count; } void NRF_RxPacket() //接收数据包 { UINT32 i; if(v_pIOPregs->GPHDAT&(1<<4)) //判断GPH4(DR1)是否为1高电平,DR1=1表示nRF2401已经收到有效数据 { for (i=0; i<(10); i++) { RxBuf = ByteRead(); } } v_pIOPregs->GPHDAT &= ~(1<<0); //设置GPH0(CE)为0低电平,使接收有效 Sleep(1); //时钟信号高电平有效 } 编译错误如下: BUILD: [01:0000000021:ERRORE] c:\WINCE500\PLATFORM\SMDK2410\SRC\DRIVERS\NRF\NRF.c(439) : error C2275: 'LPCVOID' : illegal use of this type as an expression BUILD: [01:0000000023:ERRORE] c:\WINCE500\PLATFORM\SMDK2410\SRC\DRIVERS\NRF\NRF.c(439) : error C2146: syntax error : missing ';' before identifier 'pReadBuffer' BUILD: [01:0000000024:ERRORE] c:\WINCE500\PLATFORM\SMDK2410\SRC\DRIVERS\NRF\NRF.c(439) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' BUILD: [01:0000000025:ERRORE] c:\WINCE500\PLATFORM\SMDK2410\SRC\DRIVERS\NRF\NRF.c(439) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' BUILD: [01:0000000026:ERRORE] c:\WINCE500\PLATFORM\SMDK2410\SRC\DRIVERS\NRF\NRF.c(439) : error C2143: syntax error : missing ';' before 'identifier' BUILD: [01:0000000027:ERRORE] c:\WINCE500\PLATFORM\SMDK2410\SRC\DRIVERS\NRF\NRF.c(439) : error C2065: 'pReadBuffer' : undeclared identifier BUILD: [01:0000000028:WARNN ] c:\WINCE500\PLATFORM\SMDK2410\SRC\DRIVERS\NRF\NRF.c(444) : warning C4047: '=' : 'int' differs in levels of indirection from 'LPVOID' BUILD: [01:0000000029:WARNN ] c:\WINCE500\PLATFORM\SMDK2410\SRC\DRIVERS\NRF\NRF.c(454) : warning C4022: 'memcpy' : pointer mismatch for actual parameter 1 我实在不清楚这是怎么回事,还请大家指点下啊,谢谢了 |
|
沙发#
发布于:2008-06-24 15:03
编译错误, 试试头文件 windev.h
|
|
板凳#
发布于:2008-06-24 15:39
我已经包含了这个头文件的啊,谢谢
|
|