/*---------------------------------------------------------------------------* Project: USB Host Stack (UHS) File: uhs_cos.h Description: Top level public COS header Copyright (C) 2011 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ #ifndef __UHS_COS_H__ #define __UHS_COS_H__ #include #include #include #include #ifdef __cplusplus extern "C" { #endif /*---------------------------------------------------------------------------* * * Constants defined for this file * -- #Defines -- * *---------------------------------------------------------------------------*/ #define UHS_CLIENT_MINIMUM_ASYNC_TXN_ALLOCATION 3 /*---------------------------------------------------------------------------* * * Data types defined for this file * -- Structs, Typedefs, Enums -- * *---------------------------------------------------------------------------*/ typedef enum { UHS_COS_CLIENT_STATE_INVALID, UHS_COS_CLIENT_STATE_OPEN_IN_PROGRESS, UHS_COS_CLIENT_STATE_OPENED, UHS_COS_CLIENT_STATE_CLOSE_IN_PROGRESS, UHS_COS_CLIENT_STATE_CLOSED, UHS_COS_CLIENT_STATE_ERROR }UhsCosClientState; typedef struct { UhsCosClientState state; void* bufPoolHandle; s32 stateSequence; UhsClientHandle handle; void* pCfg; UhsInterfaceHandle lastProbedIf; }UhsCosClientInstance; typedef struct { s32 hostStackInstance; void* pTxnMemory; u32 txnMemorySize; }UhsCosClientConfig; /*---------------------------------------------------------------------------* * * -- Interface Function Prototypes -- * *---------------------------------------------------------------------------*/ UhsStatus UhsClientOpen(UhsCosClientInstance* pI, const UhsCosClientConfig* pC); UhsStatus UhsClientClose(UhsCosClientInstance* pI); UhsDevRegHandle UhsClassDrvReg(UhsCosClientInstance* pI, UhsDeviceId* pDevId, UhsClientContext clientContext, UhsIfProbeFunction probeFunction); UhsStatus UhsClassDrvUnReg(UhsCosClientInstance* pI, UhsDevRegHandle devRegHandle); UhsStatus UhsAcquireInterface(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsClientContext clientContext, UhsIfIndicationFunction indicationFunction); UhsStatus UhsReleaseInterface(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, BOOL lockOut); UhsStatus UhsQueryInterfaces(UhsCosClientInstance* pI, UhsDeviceId* pDevId, UhsInterfaceProfile ifProfileList[], u32 maxProfiles); UhsStatus UhsSetInterface(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, u8 bAlternateSetting); UhsStatus UhsGetInterface(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsInterfaceProfile* pIfProfile); UhsStatus UhsGetAlternateInterface(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, u8 bAlternateSetting, UhsInterfaceProfile* pIfProfile); UhsStatus UhsAdministerEndpoint(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEpCommandType command, UhsEndpointMask endpointMask, s32 maxUrb, u32 maxXferSize); UhsStatus UhsAdministerEndpointOpt(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEpCommandType command, UhsEndpointMask endpointMask, s32 maxUrb, u32 maxXferSize, UhsEndpointOptions options); UhsStatus UhsClearEndpointHalt(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEndpointNumber epNumber, UhsDirection direction); UhsStatus UhsAdministerDevice(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsDeviceCommandType command, UhsDeviceOptions options); UhsStatus UhsGetDescriptorString(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, u8 index, BOOL unicode, char* pString, u32 size); UhsStatus UhsGetFullConfigDescriptor(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, void* pData, u32 size); UhsStatus UhsSubmitControlRequest(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, void* pData, u8 bRequest, u8 bRequestType, u16 wValue, u16 wIndex, u16 wLength, UhsTime timeout); UhsStatus UhsSubmitControlRequestAsync(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, void* pData, u8 bRequest, u8 bRequestType, u16 wValue, u16 wIndex, u16 wLength, UhsClientContext clientContext, UhsControlUrbCompletionCallback callback); UhsStatus UhsSubmitInterruptRequest(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEndpointNumber epNumber, UhsDirection direction, void* pData, u32 size, UhsTime timeout); UhsStatus UhsSubmitInterruptRequestAsync(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEndpointNumber epNumber, UhsDirection direction, void* pData, u32 size, UhsClientContext clientContext, UhsInterruptUrbCompletionCallback callback); UhsStatus UhsSubmitBulkRequest(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEndpointNumber epNumber, UhsDirection direction, void* pData, u32 size, UhsTime timeout); UhsStatus UhsSubmitBulkRequestAsync(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEndpointNumber epNumber, UhsDirection direction, void* pData, u32 size, UhsClientContext clientContext, UhsBulkUrbCompletionCallback callback); UhsStatus UhsSubmitIsocRequest(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEndpointNumber epNumber, UhsDirection direction, u32 start_frm, UhsIsocStartType startType, UhsIsocPayload* pPayload, UhsTime timeout); UhsStatus UhsSubmitIsocRequestAsync(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, UhsEndpointNumber epNumber, UhsDirection direction, u32 start_frm, UhsIsocStartType startType, UhsIsocPayload* pPayload, UhsClientContext clientContext, UhsIsocUrbCompletionCallback callback); UhsStatus UhsGetCurrentFrame(UhsCosClientInstance* pI, UhsInterfaceHandle ifHandle, u32* pFrame); #ifdef __cplusplus } #endif #endif // __UHS_COS_H__