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

📄 vndreq.c

📁 凌阳MP3 spSPCA755yuanma
💻 C
字号:
#include "general.h"
#include "vndreq.h"
#include "main.h"
#include "initio.h"
#include "ctlsetup.h"
//#include "cardusr.h"
#include "cardlink.h"

//=============================================================================
//Symbol
//=============================================================================
//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
//patch4.4.1@richie@noncompress
extern	xdata	UCHAR	G_ucNonCompFlag;

//=============================================================================
//Program
//=============================================================================
//-----------------------------------------------------------------------------
//VNDREQ_NoDataPhase
//-----------------------------------------------------------------------------
void VNDREQ_NoDataPhase(void) USING_1
/*++

Routine Description:

        process standard request without data phase

Arguments:

        none

Return Value:

        none

--*/
{
#if (USBVendor_OPTION==1)

        if (G_pCtrlCommand->bRequest)
        {
                //not register write
                if ((G_pCtrlCommand->bRequest & 0xf0) != 0x20) //Deferred Procedure Call in main lock loop
                {
                        //lock fields of request
//                        G_bRequestLock =
                                G_bRequestLog =
                                        G_pCtrlCommand->bRequest;
                        G_wValueLock = G_pCtrlCommand->wValue;
                        G_wIndexLock = G_pCtrlCommand->wIndex;

			G_ucState2 = 0x01; // F/W get the Command		
                }
                else    
                {                                //No Deferred Procedure Call in main lock loop 
                        //vendor command to stop stream
                        if (G_pCtrlCommand->bRequest == 0x2f)
                                G_btStopStream = 1;
                }
        }
        else
        {
                //register write
                //single write
//                XBYTE[G_pCtrlCommand->wIndex] = (UCHAR) (G_pCtrlCommand->wValue & 0x00ff);
        }
#endif
}

//-----------------------------------------------------------------------------
//VNDREQ_PreInDataPhase
//-----------------------------------------------------------------------------
void VNDREQ_PreInDataPhase(void) USING_1
/*++

Routine Description:

        pre-process setting of following in data phase

Arguments:

        none

Return Value:

        none

--*/
{
#if (USBVendor_OPTION==1)

        ULONG i;
        UCHAR bRequest;  
        USHORT wIndex, wValue; 

        G_pucCtrlDataPointer = G_ucCtrlData;
        bRequest = G_pCtrlCommand->bRequest;
        wIndex = G_pCtrlCommand->wIndex;
        wValue = G_pCtrlCommand->wValue;
        switch (bRequest)
        {
                case 0x21:      //get state
                        //fill data to buffer
                        switch (wIndex)
                        {
                                case 0x00:      //Get ucState
                                        G_pucCtrlDataPointer[0] = G_ucState;
                                        break;

                                case 0x01:      //Get ucState2
                                        G_pucCtrlDataPointer[0] = G_ucState2;
                                        break;

//                                case 0x02:      //Get ucState3
//                                        G_pucCtrlDataPointer[0] = G_ucState3;
//                                        break;

//                                case 0x03:      //Get FW Status
//                                        G_pucCtrlDataPointer[0] = G_bRequestLog;
//                                        G_pucCtrlDataPointer[1] = M_LoByteOfWord(wIndex);
//                                        G_pucCtrlDataPointer[2] = M_HiByteOfWord(wIndex);
//                                        G_pucCtrlDataPointer[3] = G_ucState;
//                                        G_pucCtrlDataPointer[4] = G_ucState2;
//                                        G_pucCtrlDataPointer[5] = G_ucState3;
//                                        G_pucCtrlDataPointer[6] = bRequest;
//                                        break;

                                default:
                                        break;
                        }
                        break;
                default:
                        break;
        }
#endif
}

//-----------------------------------------------------------------------------
//VNDREQ_PreOutDataPhase
//-----------------------------------------------------------------------------
void VNDREQ_PreOutDataPhase(void) USING_1
/*++

Routine Description:

        pre-process setting of following out data phase

Arguments:

        none

Return Value:

        none

--*/
{
#if (USBVendor_OPTION==1)
        G_pucCtrlDataPointer = G_ucCtrlData;
//	DbgPrint("G_ucCtrlData%bx\n",G_ucCtrlData);
#endif
}

//-----------------------------------------------------------------------------
//VNDREQ_PostInDataPhase
//-----------------------------------------------------------------------------
void VNDREQ_PostInDataPhase(void) USING_1
/*++

Routine Description:

        post-process data of complete in data phase

Arguments:

        none

Return Value:

        none
                             
--*/
{
}

//-----------------------------------------------------------------------------
//VNDREQ_PostOutDataPhase
//-----------------------------------------------------------------------------
void VNDREQ_PostOutDataPhase(void) USING_1
/*++

Routine Description:

        post-process data of complete out data phase

Arguments:

        none

Return Value:

        none

--*/
{
#if (USBVendor_OPTION==1)
//        ULONG i;
        USHORT wIndex;
//        UCHAR temp;
//        UCHAR ArgIndex;

        wIndex = G_pCtrlCommand->wIndex;

        switch (G_pCtrlCommand->bRequest)
        {
                case 0x21:      //set state
                        switch (wIndex)
                        {
                                case 0x00:      //get ucState
                                        G_ucState |= (G_pucCtrlDataPointer[0] & 0x0f);
                                        break;

                                case 0x01:      //get ucState2
                                        G_ucState2 = G_pucCtrlDataPointer[0];
                                        break;

//                                case 0x02:      //get ucState3
//                                        G_ucState3 = G_pucCtrlDataPointer[0];
//                                        break;

                                default:
                                        break;
                        }
//			DbgPrint("0x41,0x21\n");
                        break;
                default:
                        break;
        }
#endif
}

⌨️ 快捷键说明

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