GPIO驱动程序及测试程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
GPIO驱动程序,主要是GIO_Control :
BOOL GIO_IOControl(DWORD hOpenContext,
DWORD dwCode,
PBYTE pBufIn,
DWORD dwLenIn,
PBYTE pBufOut,
DWORD dwLenOut,
PDWORD pdwActualOut)
{
switch(dwCode)
{
case IO_CTL_GPIO_A_CON:
v_plOPregs->GPACON= *(DWORD*)pBufln;//GPACON SET
break;
case IO_CTL_GPIO_A_DAT_OUTPUT:
v_pIOPregs->GPADAT= *(DWORD*)pBufln; //GPADAT SET (OUTPUT) also for Functional Pin break;
case IO_CTL_GPIO_B_CON:
v_pIOPregs->GPBCON= *(DWORD*)pBufln;//GPBCON SET
break;
case IO_CTL_GPIO_B_DAT_INPUT:
*(DWORD*)pBufOut=v_plOPregs->GPBDAT; //GPBDAT SET (INPUT) also for Functional break;
Pin case IO_CTL_GPIO_B_DAT_OUTPUT:
v_pIOPregs->GPBDAT= *(DWORD*)pBufln; //GPBDAT SET (OUTPUT) also for Functional Pin break;
case IO_CTL_GPIO_B_UP:
v_pIOPregs->GPBUP= *(DWORD*)pBufln;//GPBUP SET break;
case IO_CTL_GPIO_C_CON:
v_pIOPregs->GPCCON= *(DWORD*)pBufln;//GPCCON SET
break;
case IO_CTL_GPIO_C_DAT_INPUT:
*(DWORD*)pBufOut=v_plOPregs->GPCDAT; //GPCDATSET (INPUT) also for Functional break;
case IO_CTL_GPIO_C_DAT_OUTPUT:
v_pIOPregs->GPCDAT= *(DWORD*)pBufln; //GPCDAT SET (OUTPUT) also for Functional Pin break;
case IO_CTL_GPIO_C_UP:
v_pIOPregs->GPCUP= *(DWORD*)pBufIn;//GPCUP SET
break;
case IO_CTL_GPIO_D_DAT_INPUT:
*(DWORD*)pBufOut=v_plOPregs->GPDDAT; //GPDDATSET (INPUT) also for Functional break;
case IO_CTL_GPIO_D_DAT_OUTPUT:
v_pIOPregs->GPDDAT= *(DWORD*)pBufln; //GPDDAT SET (OUTPUT) also for Functional Pin break;
case IO_CTL_GPIO_D_UP:
v_plOPregs->GPDUP= *(DWORD*)pBufln;//GPDUP SET break;
case IO_CTL_GPIO_E_CON:
v_plOPregs->GPECON= *(DWORD*)pBufln;//GPECON SET
break;
case IO_CTL_GPIO_E_DAT_INPUT:
*(DWORD*)pBufOut=v_plOPregs->GPEDAT; //GPEDAT SET (INPUT) also for Functional break;
case IO_CTL_GPIO_E_DAT_OUTPUT:
v_pIOPregs->GPEDAT= *(DWORD*)pBufln; //GPEDAT SET (OUTPUT) also for Functional Pin break;
case IO_CTL_GPIO_E_UP:
v_pIOPregs->GPEUP= *(DWORD*)pBufln;//GPEUP SET break;
case IO_CTL_GPIO_F_CON:
v_plOPregs->GPFCON= *(DWORD*)pBufln;//GPFCON SET
break;
case IO_CTL_GPIO_F_DAT_INPUT:
*(DWORD*)pBufOut=v_plOPregs->GPFDAT;//GPFDAT SET (INPUT) also for Functional break;
case IO_CTL_GPIO_F_DAT_OUTPUT:
v_pIOPregs->GPFDAT= *(DWORD*)pBufln; //GPFDAT SET (OUTPUT) also for Functional Pin break;
case IO_CTL_GPIO_F_UP:
v_pIOPregs->GPFUP= *(DWORD*)pBufln;//GPFUP SET Pin Pin