bsptcled.cpp

来自「mx27 f14v2 源代码。包括ADS板上诸多驱动的源码。」· C++ 代码 · 共 582 行 · 第 1/2 页

CPP
582
字号
            {
                if(PmicTCLEDFunLightGetCurrentLevel(pFunCurrentPkt->bank, pFunCurrentPkt->channel, &pFunCurrentPkt->level) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightGetCurrentLevel failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_SETCYCLETIME:
            if (pInBuf != NULL)
                pFunCycleTimePkt = (PFUN_CYCLETIME_PKT)pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightSetCycleTime(pFunCycleTimePkt->bank, pFunCycleTimePkt->ct) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightSetCycleTime failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_GETCYCLETIME:
            if (pOutBuf != NULL)
                pFunCycleTimePkt = (PFUN_CYCLETIME_PKT)pOutBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightGetCycleTime(pFunCycleTimePkt->bank, &pFunCycleTimePkt->ct) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightGetCycleTime failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_SETDUTYCYCLE:
            if (pInBuf != NULL)
                pFunDutyCyclePkt = (PFUN_DUTYCYCLE_PKT)pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightSetDutyCycle(pFunDutyCyclePkt->bank, pFunDutyCyclePkt->channel, pFunDutyCyclePkt->dc) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightSetDutyCycle failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_GETDUTYCYCLE:
            if (pOutBuf != NULL)
                pFunDutyCyclePkt = (PFUN_DUTYCYCLE_PKT)pOutBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightGetDutyCycle(pFunDutyCyclePkt->bank, pFunDutyCyclePkt->channel, &pFunDutyCyclePkt->dc) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightGetDutyCycle failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_SETBLENDEDRAMPS:
            if (pInBuf != NULL)
                pFunPatternPkt = (PFUN_PATTERN_PKT)pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightBlendedRamps(pFunPatternPkt->bank, TC_OFF) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightBlendedRamps failed\r\n")));
                    rc = FALSE;
                }
                if(PmicTCLEDFunLightBlendedRamps(pFunPatternPkt->bank, pFunPatternPkt->speed) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightBlendedRamps failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_SETSAWRAMPS:
            if (pInBuf != NULL)
                pFunPatternPkt = (PFUN_PATTERN_PKT)pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightSawRamps(pFunPatternPkt->bank, TC_OFF) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightSawRamps failed\r\n")));
                    rc = FALSE;
                }
                if(PmicTCLEDFunLightSawRamps(pFunPatternPkt->bank, pFunPatternPkt->speed) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightSawRamps failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_SETBLENDEDBOWTIE:
            if (pInBuf != NULL)
                pFunPatternPkt = (PFUN_PATTERN_PKT)pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightBlendedBowtie(pFunPatternPkt->bank, TC_OFF) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightBlendedBowtie failed\r\n")));
                    rc = FALSE;
                }
                if(PmicTCLEDFunLightBlendedBowtie(pFunPatternPkt->bank, pFunPatternPkt->speed) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightBlendedBowtie failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_STROBE:
            if (pInBuf != NULL)
                pFunStrobePkt = (PFUN_STROBE_PKT)pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightStrobe(pFunStrobePkt->channel, TC_STROBE_OFF) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightStrobe failed\r\n")));
                    rc = FALSE;
                }
                if(PmicTCLEDFunLightStrobe(pFunStrobePkt->channel, pFunStrobePkt->speed) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightStrobe failed\r\n")));
                    rc = FALSE;
                }
                
            }
            break;
        case TCLED_IOCTL_FUN_RAMPUP:
            if (pInBuf != NULL)
                pFunSpeedPkt = (PFUN_SPEED_PKT )pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightRampOff(pFunSpeedPkt->bank, pFunSpeedPkt->channel) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightRampOff failed\r\n")));
                    rc = FALSE;
                }
                if(PmicTCLEDFunLightRampUp(pFunSpeedPkt->bank, pFunSpeedPkt->channel) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightRampUp failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_RAMPDOWN:
            if (pInBuf != NULL)
                pFunSpeedPkt = (PFUN_SPEED_PKT )pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightRampOff(pFunSpeedPkt->bank, pFunSpeedPkt->channel) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightRampOff failed\r\n")));
                    rc = FALSE;
                }
                if(PmicTCLEDFunLightRampDown(pFunSpeedPkt->bank, pFunSpeedPkt->channel) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightRampDown failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_RAMPOFF:
            if (pInBuf != NULL)
                pFunSpeedPkt = (PFUN_SPEED_PKT )pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightRampOff(pFunSpeedPkt->bank, pFunSpeedPkt->channel) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightRampOff failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_TRIODEON:
            if (pInBuf != NULL)
                pFunSpeedPkt = (PFUN_SPEED_PKT )pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightTriodeOn(pFunSpeedPkt->bank, pFunSpeedPkt->channel) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightTriodeOn failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_TRIODEOFF:
            if (pInBuf != NULL)
                pFunSpeedPkt = (PFUN_SPEED_PKT )pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightTriodeOff(pFunSpeedPkt->bank, pFunSpeedPkt->channel) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightTriodeOff failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_CHASINGLIGHTSPATTERN:
            if (pInBuf != NULL)
                pFunPatternPkt = (PFUN_PATTERN_PKT )pInBuf;
            else
                rc = FALSE;

            if (rc == TRUE)
            {
                if(PmicTCLEDFunLightChasingLightsPattern(pFunPatternPkt->bank, pFunPatternPkt->pattern, TC_OFF) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightChasingLightsPattern failed\r\n")));
                    rc = FALSE;
                }
                if(PmicTCLEDFunLightChasingLightsPattern(pFunPatternPkt->bank, pFunPatternPkt->pattern, pFunPatternPkt->speed) != PMIC_SUCCESS)
                {
                    ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDFunLightChasingLightsPattern failed\r\n")));
                    rc = FALSE;
                }
            }
            break;
        case TCLED_IOCTL_FUN_ENABLEEDGESLOW:
            if(PmicTCLEDEnableEdgeSlow() != PMIC_SUCCESS)
            {
                ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDEnableEdgeSlow failed\r\n")));
                rc = FALSE;
            }
            break;
        case TCLED_IOCTL_FUN_DISABLEEDGESLOW:
            if(PmicTCLEDDisableEdgeSlow() != PMIC_SUCCESS)
            {
                ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDDisableEdgeSlow failed\r\n")));
                rc = FALSE;
            }
            break;
        case TCLED_IOCTL_FUN_ENABLEHALFCURRENT:
            if(PmicTCLEDEnableHalfCurrent() != PMIC_SUCCESS)
            {
                ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDEnableHalfCurrent failed\r\n")));
                rc = FALSE;
            }
            break;
        case TCLED_IOCTL_FUN_DISABLEHALFCURRENT:
            if(PmicTCLEDDisableHalfCurrent() != PMIC_SUCCESS)
            {
                ERRORMSG(TRUE, (TEXT("pfnPmicTCLEDDisableHalfCurrent failed\r\n")));
                rc = FALSE;
            }
            break;

    }

    DEBUGMSG(BSP_TCLED_DEBUG, (TEXT("-BSPTcledIOControl \r\n")));

    return rc;
}

⌨️ 快捷键说明

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