⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ioctl.c

📁 Windows CE 6.0 BSP for the Beagle Board.
💻 C
📖 第 1 页 / 共 2 页
字号:
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE1_Enable: output buffer incorrect.\r\n")));
    //    return FALSE;
    //}

    //toUse = (*((DWORD *)pInpBuffer)) & 0xFFFFFFF9;
    //if (!toUse)
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE1_Enable: invalid bit set or no bits set.\r\n")));
    //    return FALSE;
    //}

    ///* now lock everyone who may want to change the reg (even ISRs, which can) */
    //saveInts = INTERRUPTS_ENABLE(FALSE);
    ///* the cheese stands alone */
    //ret = gpPRCMRegs->ulCM_AUTOIDLE1_CORE;
    //ret |= toUse;
    //gpPRCMRegs->ulCM_AUTOIDLE1_CORE = ret;
    //INTERRUPTS_ENABLE(saveInts);

    //if (pOutBuffer)
    //{
    //    *((DWORD *)pOutBuffer) = ret;
    //    *pOutSize = sizeof(DWORD);
    //}
    //else
    //    *pOutSize = 0;

    return TRUE;
}

BOOL OALIoctlAIDLE1_Disable(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer,
    UINT32 outSize, UINT32 *pOutSize)
{
//    BOOL  saveInts;
    //DWORD toUse,ret;
    //if ((!pInpBuffer) || (inpSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE1_Disable: input buffer incorrect.\r\n")));
    //    return FALSE;
    //}
    //if ((pOutBuffer) && (outSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE1_Disable: output buffer incorrect.\r\n")));
    //    return FALSE;
    //}

    //toUse = (*((DWORD *)pInpBuffer)) & 0xFFFFFFF9;
    //if (!toUse)
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE1_Disable: invalid bit set or no bits set.\r\n")));
    //    return FALSE;
    //}

    ///* now lock everyone who may want to change the reg (even ISRs, which can) */
    //saveInts = INTERRUPTS_ENABLE(FALSE);
    ///* the cheese stands alone */
    //ret = gpPRCMRegs->ulCM_AUTOIDLE1_CORE;
    //ret &= ~toUse;
    //gpPRCMRegs->ulCM_AUTOIDLE1_CORE = ret;
    //INTERRUPTS_ENABLE(saveInts);

    //if (pOutBuffer)
    //{
    //    *((DWORD *)pOutBuffer) = ret;
    //    *pOutSize = sizeof(DWORD);
    //}
    //else
    //    *pOutSize = 0;

    return TRUE;
}


BOOL OALIoctlICLK2_Enable(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer,
    UINT32 outSize, UINT32 *pOutSize)
{
//    BOOL  saveInts,doEnableWait;
    //DWORD toUse,ret;
    //if ((!pInpBuffer) || (inpSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlICLK2_Enable: input buffer incorrect.\r\n")));
    //    return FALSE;
    //}
    //if ((pOutBuffer) && (outSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlICLK2_Enable: output buffer incorrect.\r\n")));
    //    return FALSE;
    //}

    //toUse = (*((DWORD *)pInpBuffer)) & 0x00000007;
    //if (!toUse)
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlICLK2_Enable: invalid bit set or no bits set.\r\n")));
    //    return FALSE;
    //}

    ///* now lock everyone who may want to change the reg (even ISRs, which can) */
    //doEnableWait = FALSE;
    //saveInts = INTERRUPTS_ENABLE(FALSE);
    ///* the cheese stands alone */
    //ret = gpPRCMRegs->ulCM_ICLKEN2_CORE;
    //ret |= toUse;
    //gpPRCMRegs->ulCM_ICLKEN2_CORE = ret;
    //if (gpPRCMRegs->ulCM_FCLKEN2_CORE & toUse)
    //    doEnableWait = TRUE;
    //INTERRUPTS_ENABLE(saveInts);

    //if (doEnableWait)
    //{
    //    /* make sure enabled module can be accessed */
    //    while (!(gpPRCMRegs->ulCM_IDLEST2_CORE & toUse))
    //    {
    //        //cc if (saveInts)
    //        //cc     SC_Sleep(0);    /* if we turned off/reenabled interrupts, then we are preemptible */
    //    }
    //}

    //if (pOutBuffer)
    //{
    //    *((DWORD *)pOutBuffer) = ret;
    //    *pOutSize = sizeof(DWORD);
    //}
    //else
    //    *pOutSize = 0;

    return TRUE;
}

BOOL OALIoctlICLK2_Disable(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer,
    UINT32 outSize, UINT32 *pOutSize)
{
//    BOOL  saveInts;
    //DWORD toUse,ret;
    //if ((!pInpBuffer) || (inpSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlICLK2_Disable: input buffer incorrect.\r\n")));
    //    return FALSE;
    //}
    //if ((pOutBuffer) && (outSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlICLK2_Disable: output buffer incorrect.\r\n")));
    //    return FALSE;
    //}

    //toUse = (*((DWORD *)pInpBuffer)) & 0x00000007;
    //if (!toUse)
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlICLK2_Disable: invalid bit set or no bits set.\r\n")));
    //    return FALSE;
    //}

    ///* now lock everyone who may want to change the reg (even ISRs, which can) */
    //saveInts = INTERRUPTS_ENABLE(FALSE);
    ///* the cheese stands alone */
    //ret = gpPRCMRegs->ulCM_ICLKEN2_CORE;
    //ret &= ~toUse;
    //gpPRCMRegs->ulCM_ICLKEN2_CORE = ret;
    //INTERRUPTS_ENABLE(saveInts);

    //if (pOutBuffer)
    //{
    //    *((DWORD *)pOutBuffer) = ret;
    //    *pOutSize = sizeof(DWORD);
    //}
    //else
    //    *pOutSize = 0;

    return TRUE;
}

BOOL OALIoctlFCLK2_Enable(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer,
    UINT32 outSize, UINT32 *pOutSize)
{
//    BOOL  saveInts,doEnableWait;
    //DWORD toUse,ret;
    //if ((!pInpBuffer) || (inpSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlFCLK2_Enable: input buffer incorrect.\r\n")));
    //    return FALSE;
    //}
    //if ((pOutBuffer) && (outSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlFCLK2_Enable: output buffer incorrect.\r\n")));
    //    return FALSE;
    //}

    //toUse = (*((DWORD *)pInpBuffer)) & 0x00000007;
    //if (!toUse)
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlFCLK2_Enable: invalid bit set or no bits set.\r\n")));
    //    return FALSE;
    //}

    ///* now lock everyone who may want to change the reg (even ISRs, which can) */
    //doEnableWait = FALSE;
    //saveInts = INTERRUPTS_ENABLE(FALSE);
    ///* the cheese stands alone */
    //ret = gpPRCMRegs->ulCM_FCLKEN2_CORE;
    //ret |= toUse;
    //gpPRCMRegs->ulCM_FCLKEN2_CORE = ret;
    //if (gpPRCMRegs->ulCM_ICLKEN2_CORE & toUse)
    //    doEnableWait = TRUE;
    //INTERRUPTS_ENABLE(saveInts);

    //if (doEnableWait)
    //{
    //    /* make sure enabled module can be accessed */
    //    while (!(gpPRCMRegs->ulCM_IDLEST2_CORE & toUse))
    //    {
    //        //cc if (saveInts)
    //        //cc     SC_Sleep(0);    /* if we turned off/reenabled interrupts, then we are preemptible */
    //    }
    //}

    //if (pOutBuffer)
    //{
    //    *((DWORD *)pOutBuffer) = ret;
    //    *pOutSize = sizeof(DWORD);
    //}
    //else
    //    *pOutSize = 0;

    return TRUE;
}

BOOL OALIoctlFCLK2_Disable(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer,
    UINT32 outSize, UINT32 *pOutSize)
{
//    BOOL  saveInts;
    //DWORD toUse,ret;
    //if ((!pInpBuffer) || (inpSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlFCLK2_Disable: input buffer incorrect.\r\n")));
    //    return FALSE;
    //}
    //if ((pOutBuffer) && (outSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlFCLK2_Disable: output buffer incorrect.\r\n")));
    //    return FALSE;
    //}

    //toUse = (*((DWORD *)pInpBuffer)) & 0x00000007;
    //if (!toUse)
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlFCLK2_Disable: invalid bit set or no bits set.\r\n")));
    //    return FALSE;
    //}

    ///* now lock everyone who may want to change the reg (even ISRs, which can) */
    //saveInts = INTERRUPTS_ENABLE(FALSE);
    ///* the cheese stands alone */
    //ret = gpPRCMRegs->ulCM_FCLKEN2_CORE;
    //ret &= ~toUse;
    //gpPRCMRegs->ulCM_FCLKEN2_CORE = ret;
    //INTERRUPTS_ENABLE(saveInts);

    //if (pOutBuffer)
    //{
    //    *((DWORD *)pOutBuffer) = ret;
    //    *pOutSize = sizeof(DWORD);
    //}
    //else
    //    *pOutSize = 0;

    return TRUE;
}

BOOL OALIoctlAIDLE2_Enable(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer,
    UINT32 outSize, UINT32 *pOutSize)
{
//    BOOL  saveInts;
    //DWORD toUse,ret;
    //if ((!pInpBuffer) || (inpSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE2_Enable: input buffer incorrect.\r\n")));
    //    return FALSE;
    //}
    //if ((pOutBuffer) && (outSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE2_Enable: output buffer incorrect.\r\n")));
    //    return FALSE;
    //}

    //toUse = (*((DWORD *)pInpBuffer)) & 0x00000007;
    //if (!toUse)
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE2_Enable: invalid bit set or no bits set.\r\n")));
    //    return FALSE;
    //}

    ///* now lock everyone who may want to change the reg (even ISRs, which can) */
    //saveInts = INTERRUPTS_ENABLE(FALSE);
    ///* the cheese stands alone */
    //ret = gpPRCMRegs->ulCM_AUTOIDLE2_CORE;
    //ret |= toUse;
    //gpPRCMRegs->ulCM_AUTOIDLE2_CORE = ret;
    //INTERRUPTS_ENABLE(saveInts);

    //if (pOutBuffer)
    //{
    //    *((DWORD *)pOutBuffer) = ret;
    //    *pOutSize = sizeof(DWORD);
    //}
    //else
    //    *pOutSize = 0;

    return TRUE;
}

BOOL OALIoctlAIDLE2_Disable(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer,
    UINT32 outSize, UINT32 *pOutSize)
{
//    BOOL  saveInts;
    //DWORD toUse,ret;
    //if ((!pInpBuffer) || (inpSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE2_Enable: input buffer incorrect.\r\n")));
    //    return FALSE;
    //}
    //if ((pOutBuffer) && (outSize!=sizeof(DWORD)))
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlAIDLE2_Enable: output buffer incorrect.\r\n")));
    //    return FALSE;
    //}

    //toUse = (*((DWORD *)pInpBuffer)) & 0x00000007;
    //if (!toUse)
    //{
    //    RETAILMSG(1, (TEXT("OALIoctlICLK2_Disable: invalid bit set or no bits set.\r\n")));
    //    return FALSE;
    //}

    ///* now lock everyone who may want to change the reg (even ISRs, which can) */
    //saveInts = INTERRUPTS_ENABLE(FALSE);
    ///* the cheese stands alone */
    //ret = gpPRCMRegs->ulCM_AUTOIDLE2_CORE;
    //ret &= ~toUse;
    //gpPRCMRegs->ulCM_AUTOIDLE2_CORE = ret;
    //INTERRUPTS_ENABLE(saveInts);

    //if (pOutBuffer)
    //{
    //    *((DWORD *)pOutBuffer) = ret;
    //    *pOutSize = sizeof(DWORD);
    //}
    //else
    //    *pOutSize = 0;

    return TRUE;
}

BOOL OALIoCtlNotSupported(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer,
    UINT32 outSize, UINT32 *pOutSize)
{
	return FALSE;
}

//------------------------------------------------------------------------------
//
//  Global:  g_oalIoCtlTable[]
//
//  IOCTL handler table. This table includes the IOCTL code/handler pairs
//  defined in the IOCTL configuration file. This global array is exported
//  via oal_ioctl.h and is used by the OAL IOCTL component.
//
const OAL_IOCTL_HANDLER g_oalIoCtlTable[] = {
#include "ioctl_tab.h"
};

//------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -