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

📄 mu_mtpapi.h

📁 本程序为ST公司开发的源代码
💻 H
字号:
/******************************************************************
*                                                                *
*        Copyright Mentor Graphics Corporation 2004              *
*                                                                *
*                All Rights Reserved.                            *
*                                                                *
*    THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION *
*  WHICH IS THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS   *
*  LICENSORS AND IS SUBJECT TO LICENSE TERMS.                    *
*                                                                *
******************************************************************/

#ifndef _MUSB_MTP_API_H_
#define _MUSB_MTP_API_H_

/*
 * Prototypes for MTP class driver API
 * $Revision: 1.2 $
 */

#include "mu_mtpcsi.h"

/**********************************/
/**********************************/
/*****    For MTP driver      *****/
/**********************************/

/* Macro to prepare setup packet for Mass Storage Class driver*/
#define MGC_MTP_PREPARE_SETUP_PACKET(pSetup,\
                                     bmActualRequestType,\
                                     bActualRequest,\
                                     wActualValue,\
                                     wActualIndex,\
                                     wActualLength)\
{\
    (pSetup)->bmRequestType = (uint8_t) bmActualRequestType;\
    (pSetup)->bRequest      = (uint8_t) bActualRequest;\
    (pSetup)->wValue        = (uint16_t) MUSB_SWAP16(wActualValue);\
    (pSetup)->wIndex        = (uint16_t) MUSB_SWAP16(wActualIndex);\
    (pSetup)->wLength       = (uint16_t) MUSB_SWAP16(wActualLength);\
}

/* Macro to fill control Irp for MTP Class driver */
#define MGC_MTP_FILL_CONTROL_IRP(pMtpDevice,\
                                 pControlIrp,\
                                 pActualOutBuffer,\
                                 dwRequestedOutLength,\
                                 pActualInBuffer,\
                                 dwRequestedInLength,\
                                 pfControlIrpComplete)\
{\
    (pControlIrp)->pDevice           = pMtpDevice->pUsbDevice;\
    (pControlIrp)->pOutBuffer        = pActualOutBuffer;\
    (pControlIrp)->dwOutLength       = dwRequestedOutLength;\
    (pControlIrp)->pInBuffer         = pActualInBuffer;\
    (pControlIrp)->dwInLength        = dwRequestedInLength;\
    (pControlIrp)->dwStatus          = 0;\
    (pControlIrp)->dwActualOutLength = 0;\
    (pControlIrp)->dwActualInLength  = 0;\
    (pControlIrp)->pfIrpComplete     = pfControlIrpComplete;\
    (pControlIrp)->pCompleteParam    = (void *) pMtpDevice;\
}

typedef struct 
{
    uint8_t                         bBusAddress;             
    uint8_t                         bInterfaceNumber;
    uint8_t                         bAlternateSetting;
    uint8_t                         bProtocol;
    uint8_t                         bSubclass;
    uint8_t							aData[40];
    MUSB_BusHandle                  hBus;
    MUSB_Device                    *pUsbDevice;
    MUSB_DeviceDriver              *pDriver;
    void                           *pDeviceId;
    MUSB_DeviceRequest              Setup;
    MUSB_ControlIrp                 ControlIrp;
    const MUSB_EndpointDescriptor  *pBulkInEndpoint; 
    const MUSB_EndpointDescriptor  *pBulkOutEndpoint; 
    MUSB_GmtpVolumeHandle            hVolume;
    MGC_MtpProtocol*                pProtocol;
} MGC_MtpDevice;

/**
 * Fill an array with the targetted peripheral list entry appropriate
 * for the MTP class driver, ending with the MUSB_TARGET_ACCEPT.
 * @param pList array
 * @param wListLength how many bytes are available in the array
 * @return how many bytes were filled in the array.
 * If this equals bListLength, the caller should assume there is insufficient space
 * in the array and the list entry is incomplete.
 */
extern uint16_t MUSB_FillMtpPeripheralList_KnownMtpDevice(uint8_t bDriverIndex, uint8_t* pList, uint16_t wListRemain);

extern uint16_t MUSB_FillMtpPeripheralList(uint8_t bDriverIndex, uint8_t* pList, uint16_t wListRemain);

/**
 * Get a pointer to the MTP class driver
 */
extern MUSB_DeviceDriver* MGC_GetMtpClassDriver(void);

/** Connect for MTP class driver */
extern uint8_t MUSB_MtpConnect(  void              *pPrivateData, 
                                 MUSB_BusHandle     hBus,
                                 MUSB_Device       *pUsbDevice,
                                 const uint8_t     *pPeripheralList);

/** Disconnect Handler for MTP Device Driver */
extern void MUSB_MtpDisconnect (void           *pPrivateData, 
                                MUSB_BusHandle  hBus,
                                MUSB_Device    *pUsbDevice);

#endif /* _MUSB_MTP_API_H_ */

⌨️ 快捷键说明

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