引用: 引用 2 楼 sunrain_hjb 的回复:
从错误看,好像是没有相关函数的实现。
建议贴出sources文件和驱动代码,以便分析。
/*******************************************************************************************
函数名称: GPI_IOControl
描 述: 驱动程序 I/O 请求
输入参数: DWORD dwIoControlCode: 见本文件的头文件
输出参数:
返 回: TRUE: 操作成功 FALSE: 操作失败
*******************************************************************************************/
static BOOL GPI_IOControl(
DWORD Handle,
DWORD dwIoControlCode,
PBYTE pInBuf,
DWORD nInBufSize,
PBYTE pOutBuf,
DWORD nOutBufSize,
PDWORD pBytesReturned
)
{
BOOL bErr = FALSE;
switch(dwIoControlCode & IOCTL_GPIO_FUN_MASK)
{
/*
* 设置引脚为输出
*/
case IOCTL_GPIO_SET_PIN_OUT:
if (nInBufSize > 0)
bErr = GPIO_SetPinOut(dwIoControlCode, *pInBuf);
break;
/*
* 设置引脚为输入
*/
case IOCTL_GPIO_SET_PIN_IN:
if (nInBufSize > 0)
bErr = GPIO_SetPinIn(dwIoControlCode, *pInBuf);
break;
/*
* 设置引脚输出高电平
*/
case IOCTL_GPIO_SET_PIN:
if (nInBufSize > 0)
bErr = GPIO_SetPin(dwIoControlCode, *pInBuf);
break;
/*
* 设置引脚输出低电平
*/
case IOCTL_GPIO_CLR_PIN:
if (nInBufSize > 0)
bErr = GPIO_ClrPin(dwIoControlCode, *pInBuf);
break;
/*
* 读取引脚电平状态
*/
case IOCTL_GPIO_INP_STATE:
if ((nOutBufSize > 0) && (nInBufSize > 0))
{
bErr = GPIO_ReadPin(dwIoControlCode, *pInBuf, pOutBuf);
*pBytesReturned = 1;
}
break;
/*
* 读取引脚方向状态
*/
case IOCTL_GPIO_DIR_STATE:
if ((nOutBufSize > 0) && (nInBufSize > 0))
{
bErr = GPIO_ReadDir(dwIoControlCode, *pInBuf, pOutBuf);
*pBytesReturned = 1;
}
break;
/*
* 复用引脚设置
*/
case IOCTL_GPIO_MUX_SET:
if ((nOutBufSize > 0) && (nInBufSize > 0))
{
bErr = GPIO_MUX_SET(dwIoControlCode, *pInBuf);
*pBytesReturned = 1;
}
break;
case IOCTL_GPIO_MUX_CLR:
if ((nOutBufSize > 0) && (nInBufSize > 0))
{
bErr = GPIO_MUX_CLR(dwIoControlCode, *pInBuf);
*pBytesReturned = 1;
}
break;
case IOCTL_GPIO_MUX_STATE:
if ((nOutBufSize > 0) && (nInBufSize > 0))
{
bErr = GPIO_MUX_STATE(dwIoControlCode, *pInBuf, pOutBuf);
*pBytesReturned = 1;
}
break;
default:
break;
}
return bErr;
}
static DWORD GPI_Open(DWORD Handle, DWORD dwAccess, DWORD dwShareMode) {
if (g_OpenCount > 0)
return 0;
RETAILMSG(1, (TEXT("GPIO OPENED!BUT NOTHING\r\n")));
g_OpenCount++;
return (g_OpenCount);
}
static BOOL GPI_Close(DWORD Handle) {
RETAILMSG(1, (TEXT("GPIO CLOSED!BUT NOTHING\r\n")));
g_OpenCount = 0;
return (1);
}
static BOOL GPI_Deinit(DWORD dwData)
{
if(g_pGPIORegs)
g_pGPIORegs = NULL;
RETAILMSG(1, (TEXT("GPIO Deinitted!\r\n")));
g_OpenCount = 0;
return 1;
}
static DWORD GPI_Read(DWORD Handle, LPVOID pBuffer, DWORD dwNumBytes)
{
RETAILMSG(1, (TEXT("GPIO READ!BUT NOTHING\r\n")));
return 1;
}
static DWORD GPI_Write(DWORD Handle, LPCVOID pBuffer, DWORD dwNumBytes)
{
RETAILMSG(1, (TEXT("GPIO WRITE!BUT NOTHING\r\n")));
return 1;
}
static DWORD GPI_Seek(DWORD Handle, long lDistance, DWORD dwMoveMethod)
{
return 1;
}
static void GPI_PowerUp(void)
{
//return 1;
}
static void GPI_PowerDown(void)
{
//return 1;
}
大家帮忙看看有什么问题