original files of m241
This commit is contained in:
@@ -0,0 +1,284 @@
|
||||
/* ossLib.h - O/S-independent services */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2001, 2007, 2009-2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01l,18may10,w_x USB transition to vxbDmaBufLib supporting 64 bit (WIND00193267)
|
||||
01l,29apr10,pad Moved extern C statement after include statements.
|
||||
01k,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01j,09sep09,adh Add USB_MEM_PART_SIZE define (WIND00142070)
|
||||
01i,09aug07,p_g defect fix for WIND00061096 - usbPlatform.h added
|
||||
01h,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce
|
||||
01g,07may01,wef changed module number to be (module sub num << 8) |
|
||||
M_usbHostLib
|
||||
01f,02may01,wef changed module number to be M_<module> + M_usbHostLib
|
||||
01e,16mar01,wef changed priority levels of OSS_PRIORITY_HIGH and
|
||||
OSS_PRIORITY_INTERRUPT to be 5 and 10 respectivly
|
||||
01d,05dec00,wef moved Module number defs to vwModNum.h - add this
|
||||
to #includes
|
||||
01c,07mar00,rcb Change MUTEX_HANDLE, SEM_HANDLE, and THREAD_HANDLE from
|
||||
UINT32 to pVOID to allow comparison with NULL.
|
||||
01b,13jul99,rcb Removed queue functions to usbQueueLib.h.
|
||||
01a,07jun99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines constants, structures, and functions provided by the ossLib.
|
||||
These functions include:
|
||||
|
||||
o Multithreading services (thread management and thread synchronization).
|
||||
o Shared memory allocation (for passing memory globally).
|
||||
o Time services.
|
||||
|
||||
Other system-unique services may be provided in the future.
|
||||
|
||||
IMPORTANT: Code using ossLib may be ported to preemptive and
|
||||
non-preemptive multitasking environments. Therefore, code must observe the
|
||||
following rules:
|
||||
|
||||
1. Code must not assume that the scheduler is preemptive. Therefore, no
|
||||
task is permitted to "hog" the processor indefinitely. All threads should
|
||||
regularly relinquish the processor, either through calls which may block in
|
||||
ossLib functions - which automatically relinquish, or through explicit
|
||||
calls to the threadSleep() function.
|
||||
|
||||
2. Code must not assume that the scheduler is NOT preemptive. Therefore,
|
||||
critical sections must be protected from reentrancy. This protection is
|
||||
typically managed through the use of mutexes.
|
||||
*/
|
||||
|
||||
#ifndef __INCossLibh
|
||||
#define __INCossLibh
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "vwModNum.h" /* USB Module Number Def's */
|
||||
#include "usbPlatform.h" /* Basic platform definitions for USB driver stack*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Defines */
|
||||
|
||||
/* ossLib return codes. */
|
||||
|
||||
/*
|
||||
* USB errnos are defined as being part of the USB host Module, as are all
|
||||
* vxWorks module numbers, but the USB Module number is further divided into
|
||||
* sub-modules. Each sub-module has upto 255 values for its own error codes
|
||||
*/
|
||||
|
||||
#define USB_OSS_SUB_MODULE 1
|
||||
|
||||
#define M_ossLib ( (USB_OSS_SUB_MODULE << 8) | M_usbHostLib )
|
||||
|
||||
#define ossErr(x) (M_ossLib | (x))
|
||||
|
||||
#define S_ossLib_BAD_HANDLE ossErr (1)
|
||||
#define S_ossLib_BAD_PARAMETER ossErr (2)
|
||||
#define S_ossLib_OUT_OF_MEMORY ossErr (3)
|
||||
#define S_ossLib_OUT_OF_RESOURCES ossErr (4)
|
||||
#define S_ossLib_INTERNAL_FAULT ossErr (5)
|
||||
#define S_ossLib_TIMEOUT ossErr (6)
|
||||
#define S_ossLib_GENERAL_FAULT ossErr (7)
|
||||
#define S_ossLib_DESTROY_FAILED ossErr (8)
|
||||
#define S_ossLib_QUEUE_FULL ossErr (9)
|
||||
#define S_ossLib_QUEUE_EMPTY ossErr (10)
|
||||
#define S_ossLib_NO_SIGNAL ossErr (11)
|
||||
#define S_ossLib_TAKE_MUTEX ossErr (12)
|
||||
#define S_ossLib_RELEASE_MUTEX ossErr (13)
|
||||
#define S_ossLib_NOT_IMPLEMENTED ossErr (14)
|
||||
|
||||
/* Blocking/non-blocking parameters for functions which can block. */
|
||||
|
||||
#define OSS_BLOCK 0xffffffff /* Function will block indefinitely */
|
||||
#define OSS_DONT_BLOCK 0x0 /* Function will not block */
|
||||
/* NOTE: All other values are interpreted */
|
||||
/* as a count of milliseconds to block */
|
||||
|
||||
/* Thread priority parameters for ossThreadCreate */
|
||||
|
||||
#define OSS_PRIORITY_INHERIT 0xffff /* inherit caller's priority */
|
||||
#define OSS_PRIORITY_LOW 255
|
||||
#define OSS_PRIORITY_TYPICAL 100
|
||||
#define OSS_PRIORITY_HIGH 10
|
||||
#define OSS_PRIORITY_INTERRUPT 5
|
||||
|
||||
/* Maximum length of a thread name string. */
|
||||
|
||||
#define MAX_OSS_NAME_LEN 32
|
||||
|
||||
/* Structure definitions. */
|
||||
|
||||
/* Handles. */
|
||||
|
||||
typedef pVOID THREAD_HANDLE; /* Thread handle */
|
||||
typedef THREAD_HANDLE *pTHREAD_HANDLE;
|
||||
|
||||
typedef pVOID SEM_HANDLE; /* Semaphore handle */
|
||||
typedef SEM_HANDLE *pSEM_HANDLE;
|
||||
|
||||
typedef pVOID MUTEX_HANDLE; /* Mutex handle */
|
||||
typedef MUTEX_HANDLE *pMUTEX_HANDLE;
|
||||
|
||||
/* Structure of a thread entry point */
|
||||
|
||||
typedef VOID (*THREAD_PROTOTYPE) (pVOID param);
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
STATUS ossStatus
|
||||
(
|
||||
int status
|
||||
);
|
||||
|
||||
STATUS ossInitialize (void);
|
||||
|
||||
STATUS ossShutdown (void);
|
||||
|
||||
STATUS ossThreadCreate
|
||||
(
|
||||
THREAD_PROTOTYPE func, /* function to spawn as new thread */
|
||||
pVOID param, /* Parameter to be passed to new thread */
|
||||
UINT16 priority, /* OSS_PRIORITY_xxxx */
|
||||
pCHAR name, /* thread name or NULL */
|
||||
pTHREAD_HANDLE pThreadHandle /* Handle of newly spawned thread */
|
||||
);
|
||||
|
||||
#define OSS_THREAD_CREATE(func, param, priority, name, pThreadHandle) \
|
||||
ossThreadCreate (func, param, priority, name, pThreadHandle)
|
||||
|
||||
STATUS ossThreadDestroy
|
||||
(
|
||||
THREAD_HANDLE threadHandle /* handle of thread to be destroyed */
|
||||
);
|
||||
|
||||
#define OSS_THREAD_DESTROY(threadHandle) ossThreadDestroy (threadHandle)
|
||||
|
||||
STATUS ossThreadSleep
|
||||
(
|
||||
UINT32 msec /* Number of msec to sleep */
|
||||
);
|
||||
|
||||
#define OSS_THREAD_SLEEP(msec) ossThreadSleep (msec)
|
||||
|
||||
STATUS ossSemCreate
|
||||
(
|
||||
UINT32 maxCount, /* Max count allowed for semaphore */
|
||||
UINT32 curCount, /* initial count for semaphore */
|
||||
pSEM_HANDLE pSemHandle /* newly created semaphore handle */
|
||||
);
|
||||
|
||||
#define OSS_SEM_CREATE(maxCount, curCount, pSemHandle) \
|
||||
ossSemCreate (maxCount, curCount, pSemHandle)
|
||||
|
||||
STATUS ossSemDestroy
|
||||
(
|
||||
SEM_HANDLE semHandle /* Handle of semaphore to destroy */
|
||||
);
|
||||
|
||||
#define OSS_SEM_DESTROY(semHandle) ossSemDestroy (semHandle)
|
||||
|
||||
STATUS ossSemGive
|
||||
(
|
||||
SEM_HANDLE semHandle /* semaphore to signal */
|
||||
);
|
||||
|
||||
#define OSS_SEM_GIVE(semHandle) ossSemGive (semHandle)
|
||||
|
||||
STATUS ossSemTake
|
||||
(
|
||||
SEM_HANDLE semHandle, /* semaphore to take */
|
||||
UINT32 blockFlag /* specifies blocking action */
|
||||
);
|
||||
|
||||
#define OSS_SEM_TAKE(semHandle, blockFlag) ossSemTake (semHandle, blockFlag)
|
||||
|
||||
STATUS ossMutexCreate
|
||||
(
|
||||
pMUTEX_HANDLE pMutexHandle /* Handle of newly created mutex */
|
||||
);
|
||||
|
||||
#define OSS_MUTEX_CREATE(pMutexHandle) ossMutexCreate (pMutexHandle)
|
||||
|
||||
STATUS ossMutexDestroy
|
||||
(
|
||||
MUTEX_HANDLE mutexHandle /* Handle of mutex to destroy */
|
||||
);
|
||||
|
||||
#define OSS_MUTEX_DESTROY(mutexHandle) ossMutexDestroy (mutexHandle)
|
||||
|
||||
STATUS ossMutexTake
|
||||
(
|
||||
MUTEX_HANDLE mutexHandle, /* Mutex to take */
|
||||
UINT32 blockFlag /* specifies blocking action */
|
||||
);
|
||||
|
||||
#define OSS_MUTEX_TAKE(mutexHandle, blockFlag) \
|
||||
ossMutexTake (mutexHandle, blockFlag)
|
||||
|
||||
STATUS ossMutexRelease
|
||||
(
|
||||
MUTEX_HANDLE mutexHandle /* Mutex to be released */
|
||||
);
|
||||
|
||||
#define OSS_MUTEX_RELEASE(mutexHandle) ossMutexRelease(mutexHandle)
|
||||
|
||||
pVOID ossMalloc
|
||||
(
|
||||
size_t numBytes /* Size of buffer to allocate */
|
||||
);
|
||||
|
||||
#define OSS_MALLOC(numBytes) ossMalloc((size_t)(numBytes))
|
||||
|
||||
pVOID ossCalloc
|
||||
(
|
||||
size_t numBytes /* size of buffer to allocate */
|
||||
);
|
||||
|
||||
#define OSS_CALLOC(numBytes) ossCalloc(numBytes)
|
||||
|
||||
pVOID ossMallocAlign
|
||||
(
|
||||
UINT32 numBytes, /* size of buffer to allocate */
|
||||
UINT32 alignment, /* alignment, must be power of 2 */
|
||||
BOOL zero /* indicates if memory to be zeroed */
|
||||
);
|
||||
|
||||
#define OSS_MALLOC_ALIGN(numBytes, alignment, zero) \
|
||||
ossMallocAlign (numBytes, alignment, zero)
|
||||
|
||||
VOID ossFree
|
||||
(
|
||||
pVOID bfr
|
||||
);
|
||||
|
||||
#define OSS_FREE(bfr) ossFree (bfr)
|
||||
|
||||
UINT32 ossTime (void);
|
||||
|
||||
#define OSS_TIME() ossTime ()
|
||||
|
||||
size_t ossPartSizeGet (void);
|
||||
STATUS ossPartSizeSet (UINT32 numBytes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCossLibh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
/* pciConstants.h - Defines constants related to the PCI bus. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2001, 2005, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01f,29apr10,pad Moved extern C statement after include statements.
|
||||
01e,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01d,28mar05,pdg non-PCI changes
|
||||
01c,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce
|
||||
01b,05dec00,wef removed some macros that were defined in pciConfigLib.h
|
||||
01a,29may99,rcb First.
|
||||
*/
|
||||
|
||||
#ifndef __INCpciConstantsh
|
||||
#define __INCpciConstantsh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "drv/pci/pciConfigLib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Constants */
|
||||
|
||||
#ifndef PCI_MAX_BUS
|
||||
#define PCI_MAX_BUS 255 /* Max number of PCI buses in system */
|
||||
#endif /* PCI_MAX_BUS */
|
||||
|
||||
#ifndef PCI_MAX_DEV
|
||||
#define PCI_MAX_DEV 32 /* Max number of PCI devices in system */
|
||||
#endif /* PCI_MAX_DEV */
|
||||
|
||||
/* Constants related to PCI configuration */
|
||||
|
||||
#define PCI_CFG_NUM_BASE_REG 6 /* Number of base address registers */
|
||||
/* in PCI config. space for a device */
|
||||
|
||||
/* The following PCI_CFG_ADDRESS_xxxx constants qualify the address in each
|
||||
of the PCI configuration base address registers. */
|
||||
|
||||
#define PCI_CFG_BASE_IO 0x00000001 /* Mask indicates adrs is I/O adrs */
|
||||
#define PCI_CFG_BASE_MEM 0x00000000 /* Mask indicates adrs is mem adrs */
|
||||
|
||||
#define PCI_CFG_IOBASE_MASK ~(0x3)
|
||||
#define PCI_CFG_MEMBASE_MASK ~(0xf)
|
||||
|
||||
#define OHCI_CLASS 0x0c /* BASEC value for serial bus */
|
||||
#define OHCI_SUBCLASS 0x03 /* SCC value for USB */
|
||||
#define OHCI_PGMIF 0x10 /* OpenHCI */
|
||||
|
||||
#define UHCI_CLASS 0x0c /* BASEC value for serial bus */
|
||||
#define UHCI_SUBCLASS 0x03 /* SCC value for USB */
|
||||
#define UHCI_PGMIF 0x00 /* no specific pgm i/f defined */
|
||||
#define PCI_UHCI_LEGREG_OFFSET 0xC0 /* UHCI Legacy register offset */
|
||||
#define PCI_UHCI_LEGREG_VALUE 0x2000 /* UHCI Legacy register value */
|
||||
|
||||
#define EHCI_CLASS 0x0c /* BASEC value for serial bus */
|
||||
#define EHCI_SUBCLASS 0x03 /* SCC value for USB */
|
||||
#define EHCI_PGMIF 0x20 /* EnhancedHCI */
|
||||
|
||||
#define EHCI_HCCPARAMS 0x08 /* HCCPARAMS register offset */
|
||||
#define EHCI_HCCPARAMS_EECP_MASK 0x0000FF00 /*
|
||||
* extended capabilities
|
||||
* field position mask value
|
||||
*/
|
||||
#define EHCI_HCCPARAMS_EECP_MIN 0x40 /*
|
||||
* extended capabilities
|
||||
* minimum value
|
||||
*/
|
||||
#define EHCI_USBLEGSUP_OS_OFFSET 3 /*
|
||||
* Offset into the USBLEGSUP
|
||||
* register to access the OS
|
||||
* controllable space
|
||||
*/
|
||||
|
||||
#define USB_IF_NON_PCI 0x80 /* Mask value for non-PCI bus */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/*
|
||||
* PCI_CFG_HEADER
|
||||
*
|
||||
* PCI_CFG_HEADER defines the invariant portion of a PCI devices configuration
|
||||
* space.
|
||||
*
|
||||
* NOTE: If 0-byte packing is in effect, this structure will match the PCI
|
||||
* configuration header byte-for-byte.
|
||||
*/
|
||||
|
||||
typedef struct pci_cfg_header
|
||||
{
|
||||
UINT16 vendorId; /* PCI-assigned vendor ID */
|
||||
UINT16 deviceId; /* Vendor-assigned device ID */
|
||||
UINT16 command; /* Config. cmd register */
|
||||
UINT16 status; /* Cfg status register */
|
||||
UINT8 revisionId; /* Revision ID */
|
||||
UINT8 pgmIf; /* Programming interface */
|
||||
UINT8 subClass; /* PCI Sub-class */
|
||||
UINT8 pciClass; /* PCI Class code */
|
||||
UINT8 cacheLineSize; /* Cache line size */
|
||||
UINT8 latencyTimer; /* Latency timer */
|
||||
UINT8 headerType; /* Header type */
|
||||
UINT8 bist; /* BIST */
|
||||
UINT32 baseReg [PCI_CFG_NUM_BASE_REG]; /* Base adrs registers */
|
||||
UINT32 reserved [2];
|
||||
UINT32 romBase; /* Expansion ROM base address */
|
||||
UINT32 reserved1 [2];
|
||||
UINT8 intLine; /* Interrupt line chosen by POST */
|
||||
UINT8 intPin; /* HW int assignment(INTA = 1, etc)*/
|
||||
UINT8 minGrant; /* Minimum grant */
|
||||
UINT8 maxLatency; /* Maximum latency */
|
||||
} PCI_CFG_HEADER, *pPCI_CFG_HEADER;
|
||||
|
||||
/*
|
||||
* USB_HCD_BUS_INFO
|
||||
*
|
||||
* USB_HCD_BUS_INFO defines the function pointers which can be used for
|
||||
* performing host bus specific operations.
|
||||
*/
|
||||
typedef struct usbHcdBusInfo
|
||||
{
|
||||
FUNCPTR pFuncDataSwap; /* Function to swap data */
|
||||
FUNCPTR pFuncCpuToBus; /* Function to convert CPU to Bus memory */
|
||||
FUNCPTR pFuncBusToCpu; /* Function to convert Bus to CPU memory */
|
||||
FUNCPTR pFuncIntConnect; /* Function to hook an ISR */
|
||||
FUNCPTR pFuncIntDisconnect; /* Function to unhook an ISR */
|
||||
pVOID pBaseAddress; /* Base Address of registers */
|
||||
UINT32 irq; /* Irq value of the controller */
|
||||
FUNCPTR pFuncBufferSwap; /* Function to swap buffer contents */
|
||||
pVOID pDeviceSpecificData;/*
|
||||
* Pointer which can be used for
|
||||
* storing device specific data
|
||||
*/
|
||||
}USB_HCD_BUS_INFO, *pUSB_HCD_BUS_INFO;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCpciConstantsh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/* usbHal.h - Defines structures/interfaces used only by HAL */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01f,29apr10,pad Moved extern C statement after include statements.
|
||||
01e,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01d,03aug04,mta Modification History Changes
|
||||
01c,19jul04,ami Coding Convention Changes
|
||||
01b,03may04,pdg Fix for receiving less than expected data from the host
|
||||
01a,04mar04,mta First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines structures/interfaces used only by Hardware Adaption Layer (HAL).
|
||||
*/
|
||||
|
||||
#ifndef __INCusbHalh
|
||||
#define __INCusbHalh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usbHandleLib.h"
|
||||
#include "usb/usb.h"
|
||||
#include "usb/target/usbTcd.h"
|
||||
#include "usb/target/usbHalLib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef struct usbHalPipeInfo /* USBHAL_PIPE_INFO */
|
||||
{
|
||||
UINT8 uEndpointAddress; /* endpoint address */
|
||||
UINT16 maxPacketSize; /* maximum packet size of the endpoint */
|
||||
pVOID pipeHandle; /* pipe handle returned from the TCD */
|
||||
LIST_HEAD listHead; /* head of the list of ERPs queued */
|
||||
/* for this endpoint */
|
||||
UINT32 uEndpointInterruptStatus;/* endpoint interrupt status */
|
||||
MUTEX_HANDLE mutexHandle; /* pointer to the mutex handle */
|
||||
} USBHAL_PIPE_INFO, *pUSBHAL_PIPE_INFO;
|
||||
|
||||
typedef struct usbHalTcd /* USBHAL_TCD */
|
||||
{
|
||||
pVOID pTCDHandle; /* pointer to the TCD handle */
|
||||
USB_TCD_EXEC_FUNC tcdExecFunc; /* single entry point of the TCD */
|
||||
SEM_HANDLE intPendingSemaphore; /* semaphore of the interrupt */
|
||||
/* handler thread */
|
||||
UINT32 uInterruptStatus; /* bitmap specifying interrupt */
|
||||
/* status */
|
||||
MUTEX_HANDLE mutex; /* mutex for accessing the shared */
|
||||
/* resources */
|
||||
struct usbHalPipeInfo ** pPipeInfo; /* pointer to array of */
|
||||
/* USBHAL_PIPE_INFO structures */
|
||||
UINT32 uActiveEndpointsBitmap; /* bitmap holding the */
|
||||
/* endpoints which are active*/
|
||||
|
||||
UINT8 uActiveEndpoints; /* number of endpoints which */
|
||||
/* are active */
|
||||
USBHAL_DEVICE_INFO halDeviceInfo;/* information about features supported */
|
||||
USB_TCD_MNGMT_CALLBACK mngmtCallback; /* pointer to the Management callback*/
|
||||
/* function of the usbTargLib */
|
||||
pVOID mngmtCallbackParam;/* parameter to the management */
|
||||
/* callback function */
|
||||
THREAD_HANDLE threadId; /* interrupt handler thread ID */
|
||||
} USBHAL_TCD, *pUSBHAL_TCD;
|
||||
|
||||
/* functions declarations */
|
||||
|
||||
extern STATUS usbHalProcessEndpointOUT (pUSBHAL_TCD pHalInfo,
|
||||
pUSBHAL_PIPE_INFO pPipeInfo);
|
||||
|
||||
extern STATUS usbHalProcessEndpointIN (pUSBHAL_TCD pHalInfo,
|
||||
pUSBHAL_PIPE_INFO pPipeInfo);
|
||||
|
||||
extern VOID usbHalIsr (pUSBHAL_TCD pHalTcd);
|
||||
|
||||
extern VOID usbHalInterruptThread (pUSBHAL_TCD pHalTcd);
|
||||
|
||||
extern VOID trbHeaderInit (pTRB_HEADER pTrb, pVOID pTCDHandle,
|
||||
UINT16 uFunctionCode,UINT16 uTotalLen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbHalh */
|
||||
@@ -0,0 +1,57 @@
|
||||
/* usbHalCommon.h - Defines structures/interfaces used by HAL and above layers */
|
||||
|
||||
/* Copyright 2004 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01c,03aug04,mta Modification History Changes
|
||||
01b,19jul04,ami Coding Convention Changes
|
||||
01a,04mar04,mta First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines structures/interfaces used by Hardware Adaption Layer (HAL) and above
|
||||
layers.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __INCusbHalCommonh
|
||||
#define __INCusbHalCommonh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/* Device features */
|
||||
#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 0x01 /* remote wake up */
|
||||
#define USB_FEATURE_TEST_MODE 0x02 /* test mode feature */
|
||||
#define USB_FEATURE_USB20 0x04 /* USB 2.0 Device */
|
||||
|
||||
/* Device speeds */
|
||||
#define USB_TCD_FULL_SPEED (UINT8)0x00 /* full speed device */
|
||||
#define USB_TCD_LOW_SPEED (UINT8)0x01 /* low speed device */
|
||||
#define USB_TCD_HIGH_SPEED (UINT8)0x02 /* high speed device */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef struct usbApplnDeviceInfo /* USB_APPLN_DEVICE_INFO */
|
||||
{
|
||||
UINT32 uDeviceFeature; /* bitmap giving featues supported by device */
|
||||
UINT32 uEndpointNumberBitmap; /* bitmap giving endpoint numbers */
|
||||
/* supported by device */
|
||||
}USB_APPLN_DEVICE_INFO, *pUSB_APPLN_DEVICE_INFO;
|
||||
|
||||
/* primary TCD entry point */
|
||||
|
||||
typedef STATUS (*USB_TCD_EXEC_FUNC) (pVOID pTrb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbHalCommomh */
|
||||
@@ -0,0 +1,75 @@
|
||||
/* usbHalDebug.h - Defines the debug macros used by the HAL sub-modules */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01h,29apr10,pad Moved extern C statement after include statements.
|
||||
01g,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01f,20jan05,hch Corrected the _WRS_VXWORKS_MAJOR usage
|
||||
01e,31oct04,hch comment out the extern for usbLogMsg temperarily.
|
||||
01d,26oct04,ami Debug Messages Changes
|
||||
01c,06oct04,ami SPR #94684 Fix
|
||||
01b,19jul04,ami Coding Convention Changes
|
||||
01a,08mar04,pdg First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines the debug macros which are used by the HAL sub-modules
|
||||
*/
|
||||
|
||||
#ifndef __INCusbHalDebugh
|
||||
#define __INCusbHalDebugh
|
||||
|
||||
/* includes */
|
||||
#include <logLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if (defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6))
|
||||
|
||||
extern void usbPeriLogMsg (char *,long,long,long,long,long,long);
|
||||
|
||||
#else /* _WRS_VXWORKS_MAJOR */
|
||||
|
||||
/* SPR #85391 is included in the cumulative patch. If customer has
|
||||
* installed the cumulative patch, then it is OK for customer to
|
||||
* uncomment out the following extern definition. Curretnly, there will
|
||||
* be some warnings when build USB Periphral source
|
||||
*/
|
||||
/* extern void usbPeriLogMsg (char *,int,int,int,int,int,int);*/
|
||||
|
||||
#endif /* _WRS_VXWORKS_MAJOR */
|
||||
|
||||
/* defines */
|
||||
|
||||
#define USBHAL_DEBUG_MSG 0x01 /* for debugging macros */
|
||||
#define USBHAL_DEBUG_ERR 0x02 /* for Error macros */
|
||||
|
||||
#define USBHAL_DEBUG \
|
||||
if (usbHalDebug & USBHAL_DEBUG_MSG) \
|
||||
usbPeriLogMsg /* debugging Macros */
|
||||
|
||||
#define USBHAL_ERR \
|
||||
if (usbHalDebug & USBHAL_DEBUG_ERR) \
|
||||
usbPeriLogMsg /* error macros */
|
||||
|
||||
extern UINT32 usbHalDebug; /* define the debugging flag */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbHalDebugh */
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/* usbHalLib.h - define the API's exposed by HAL */
|
||||
|
||||
/* Copyright 2004, 2010 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01d,29apr10,pad Moved extern C statement after include statements.
|
||||
01c,03aug04,mta Modification History Changes
|
||||
01b,19jul04,amit Coding Convention Changes
|
||||
01a,04mar04,mta First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file defines the interfaces and data structures exposed by the
|
||||
Hardware Adaption Layer to the usbTargLib layer
|
||||
*/
|
||||
|
||||
#ifndef __INCusbHalLibh
|
||||
#define __INCusbHalLibh
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usbHandleLib.h"
|
||||
#include "usb/usb.h"
|
||||
#include "usb/target/usbTcd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/* managment codes passed to USB_TCD_MANAGEMENT_CALLBACK */
|
||||
|
||||
#define TCD_MNGMT_BUS_RESET 1 /* bus reset */
|
||||
#define TCD_MNGMT_SUSPEND 2 /* suspend signalling detected */
|
||||
#define TCD_MNGMT_RESUME 3 /* resume signalling detected */
|
||||
#define TCD_MNGMT_DISCONNECT 4 /* disconnect detected */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef struct usbHalTcdNexus /* USBHAL_TCD_NEXUS */
|
||||
{
|
||||
USB_TCD_EXEC_FUNC tcdExecFunc; /* TCD primary entry point */
|
||||
TCD_HANDLE handle; /* client's handle with TCD */
|
||||
} USBHAL_TCD_NEXUS, *pUSBHAL_TCD_NEXUS;
|
||||
|
||||
/* management notification callback function */
|
||||
|
||||
typedef VOID (*USB_TCD_MNGMT_CALLBACK)
|
||||
(
|
||||
pVOID mngmtCallbackParam,
|
||||
UINT16 mngmtCode,
|
||||
pVOID pContext
|
||||
);
|
||||
|
||||
/* functions declarration */
|
||||
|
||||
extern STATUS usbHalTcdAttach (USB_TCD_EXEC_FUNC tcdExecFunc, pVOID tcdParam,
|
||||
pUSBHAL_TCD_NEXUS pNexus,
|
||||
pUSB_APPLN_DEVICE_INFO pDeviceInfo,
|
||||
USB_TCD_MNGMT_CALLBACK mngmtCallback,
|
||||
pVOID mngmtCallbackParam);
|
||||
|
||||
extern STATUS usbHalTcdDetach (pUSBHAL_TCD_NEXUS pNexus);
|
||||
|
||||
extern STATUS usbHalTcdEnable (pUSBHAL_TCD_NEXUS pNexus);
|
||||
|
||||
extern STATUS usbHalTcdDisable (pUSBHAL_TCD_NEXUS pNexus);
|
||||
|
||||
extern STATUS usbHalTcdAddressSet (pUSBHAL_TCD_NEXUS pNexus,UINT8 deviceAddress);
|
||||
|
||||
extern STATUS usbHalTcdSignalResume (pUSBHAL_TCD_NEXUS pNexus);
|
||||
|
||||
extern STATUS usbHalTcdDeviceFeatureSet (pUSBHAL_TCD_NEXUS pNexus,
|
||||
UINT16 uFeatureSelector,
|
||||
UINT8 uTestSelector);
|
||||
|
||||
extern STATUS usbHalTcdDeviceFeatureClear (pUSBHAL_TCD_NEXUS pNexus,
|
||||
UINT16 uFeatureSelector);
|
||||
|
||||
extern STATUS usbHalTcdCurrentFrameGet (pUSBHAL_TCD_NEXUS pNexus,
|
||||
pUINT16 pFrameNo);
|
||||
|
||||
extern STATUS usbHalTcdEndpointAssign (pUSBHAL_TCD_NEXUS pNexus,
|
||||
pUSB_ENDPOINT_DESCR pEndpointDesc,
|
||||
UINT16 uConfigurationValue,
|
||||
UINT16 uInterface,
|
||||
UINT16 uAltSetting,
|
||||
VOID ** ppPipeHandle);
|
||||
|
||||
extern STATUS usbHalTcdEndpointRelease (pUSBHAL_TCD_NEXUS pNexus,
|
||||
pVOID pPipeHandle);
|
||||
|
||||
extern STATUS usbHalTcdEndpointStateSet (pUSBHAL_TCD_NEXUS pNexus,
|
||||
pVOID pPipeHandle, UINT16 state);
|
||||
|
||||
extern STATUS usbHalTcdEndpointStatusGet (pUSBHAL_TCD_NEXUS pNexus,
|
||||
pVOID pPipeHandle, pUINT8 pStatus);
|
||||
|
||||
extern STATUS usbHalTcdErpSubmit (pUSBHAL_TCD_NEXUS pNexus, pUSB_ERP pErp);
|
||||
|
||||
extern STATUS usbHalTcdErpCancel (pUSBHAL_TCD_NEXUS pNexus, pUSB_ERP pErp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbHalLibh */
|
||||
@@ -0,0 +1,164 @@
|
||||
/* usbIsaLib.h - System-specific ISA Functions */
|
||||
|
||||
/* Copyright 2000-2001, 2013 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01e,02jul13,wyy Remove compiler warning (WIND00423315)
|
||||
01d,03aug04,hch Fix compiler warning
|
||||
01c,21aug01,hdn added PENTIUM2/3/4 support
|
||||
01b,17mar00,rcb Change name of #include from "i8237dma.h" to
|
||||
"i8237Dma.h" to reflect case-sensitive nature of
|
||||
filenames on unix build platforms.
|
||||
01a,11aug99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file defines platform-independent functions accessing ISA bus
|
||||
capabilities. These functions allow ISA device drivers to be written
|
||||
independent of the underlying O/S's ISA access mechanisms.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbIsaLibh
|
||||
#define __INCusbIsaLibh
|
||||
|
||||
|
||||
/* Includes */
|
||||
|
||||
#include "ioLib.h" /* defines O_RDONLY/O_WRONLY */
|
||||
|
||||
#include "usb/usbPciLib.h"
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* Define USE_PCI_INT_FUNCS to map USB_ISA_INT_CONNECT() and
|
||||
* USB_ISA_INT_RESTORE() to the corresponding functions in usbPciLib.c.
|
||||
* The PCI functions have the advantage that they define both an
|
||||
* "intConnect()" as well as an "intDisconnect()" function, allowing
|
||||
* interrupts to be unhooked effectively.
|
||||
*/
|
||||
|
||||
#define USE_PCI_INT_FUNCS
|
||||
|
||||
|
||||
/* platform-dependent definitions */
|
||||
|
||||
#if (CPU_FAMILY==I80X86)
|
||||
|
||||
/* Pentium (e.g, PC Pentium) */
|
||||
|
||||
/* The 8237 DMA controller is enabled using a function called dmaSetup().
|
||||
* A prototype for this function exists in the vxWorks header file below.
|
||||
*/
|
||||
|
||||
#include "drv/dma/i8237Dma.h"
|
||||
|
||||
#define DMA_SETUP(direction, pAddr, nBytes, chan) \
|
||||
(void) dmaSetup (direction, pAddr, nBytes, chan)
|
||||
|
||||
/* Unknown platform */
|
||||
|
||||
#else
|
||||
|
||||
#warning "Unknown platform. Must create platform mapping in usbIsaLib.h."
|
||||
|
||||
#define DMA_SETUP(direction, pAddr, nBytes, chan)
|
||||
|
||||
#endif /* #if CPU == xxxx */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/* I/O functions */
|
||||
|
||||
#define USB_ISA_BYTE_IN(address) USB_PCI_BYTE_IN(address)
|
||||
#define USB_ISA_BYTE_OUT(address, value) USB_PCI_BYTE_OUT(address, value)
|
||||
|
||||
|
||||
/* memory mapping functions */
|
||||
|
||||
#define USB_MEM_TO_ISA(pMem) USB_MEM_TO_PCI(pMem)
|
||||
#define USB_ISA_TO_MEM(isaAdrs) USB_PCI_TO_MEM(isaAdrs)
|
||||
|
||||
|
||||
/* cache functions */
|
||||
|
||||
#define USB_ISA_MEM_FLUSH(pMem, size) USB_PCI_MEM_FLUSH(pMem, size)
|
||||
#define USB_ISA_MEM_INVALIDATE(pMem, size) USB_PCI_MEM_INVALIDATE(pMem, size)
|
||||
|
||||
|
||||
/* interrupt functions */
|
||||
|
||||
#ifdef USE_PCI_INT_FUNCS
|
||||
|
||||
#define USB_ISA_INT_CONNECT(func, param, intNo) \
|
||||
usbPciIntConnect (func, param, intNo)
|
||||
#define USB_ISA_INT_RESTORE(func, param, intNo) \
|
||||
usbPciIntRestore (func, param, intNo)
|
||||
|
||||
#else
|
||||
|
||||
#define USB_ISA_INT_CONNECT(func, param, intNo) \
|
||||
usbIsaIntConnect (func, param, intNo)
|
||||
#define USB_ISA_INT_RESTORE(func, param, intNo) \
|
||||
usbIsaIntRestore (func, param, intNo)
|
||||
|
||||
#endif /* #ifdef USE_PCI_INT_FUNCS */
|
||||
|
||||
|
||||
/* DMA functions
|
||||
*
|
||||
* NOTE: WRS convention for DMA transfer is that a "read from memory"
|
||||
* by the DMAC (what we call DMA_MEM_READ) is actually the direction
|
||||
* O_WRONLY.
|
||||
*/
|
||||
|
||||
#define DMA_MEM_READ 0
|
||||
#define DMA_MEM_WRITE 1
|
||||
|
||||
#define USB_ISA_DMA_SETUP(direction, isaAdrs, bfrLen, channel) \
|
||||
DMA_SETUP ((direction == DMA_MEM_READ) ? O_WRONLY : O_RDONLY, \
|
||||
(void *) isaAdrs, bfrLen, channel)
|
||||
|
||||
|
||||
#ifndef USE_PCI_INT_FUNCS
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
STATUS usbIsaIntConnect
|
||||
(
|
||||
INT_HANDLER_PROTOTYPE func, /* new interrupt handler */
|
||||
pVOID param, /* parameter for int handler */
|
||||
UINT16 intNo /* interrupt vector number */
|
||||
);
|
||||
|
||||
|
||||
VOID usbIsaIntRestore
|
||||
(
|
||||
INT_HANDLER_PROTOTYPE func, /* int handler to be removed */
|
||||
pVOID param, /* parameter for int handler */
|
||||
UINT16 intNo /* interrupt vector number */
|
||||
);
|
||||
|
||||
#endif /* #ifndef USE_PCI_INT_FUNCS */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbIsaLibh */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/* usbPeriphInstr.h - WindView Instrumentation for Peripheral Stack */
|
||||
|
||||
/* Copyright 2004, 2009 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01c,08feb09,w_x Event IDs for FSL Dual role USB controller added
|
||||
01b,08sep04,ami Event IDs for NET2280 added
|
||||
01a,11aug04,ami Initial Version
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file contains the definitions for the WindView Instrumentation for all
|
||||
the modules for the USB2.0 Peripheral Stack i.e.
|
||||
1) The Target Layer
|
||||
2) The HAL Layer
|
||||
3) The TCD Layer (PDIUSBD12 & ISP1582)
|
||||
*/
|
||||
|
||||
#ifndef __INCusbPeriphInstrh
|
||||
#define __INCusbPeriphInstrh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/* Event Ids */
|
||||
|
||||
/* Event ID for Target Layer */
|
||||
|
||||
#define USB_TARG_INIT_EXIT 10120
|
||||
#define USB_TARG_DEFAULT_PIPE 10121
|
||||
#define USB_TARG_DEVICE_CONTROL 10122
|
||||
#define USB_TARG_PIPE_FUNC 10123
|
||||
|
||||
/* Event IDs for HAL */
|
||||
|
||||
#define USB_HAL_INIT_EXIT 10124
|
||||
#define USB_HAL_INTERRUPT_HANDLER 10125
|
||||
#define USB_HAL_DEVICE_CNTL 10126
|
||||
#define USB_HAL_ENDPOINT 10127
|
||||
|
||||
/* Event IDs for TCD */
|
||||
|
||||
#define USB_TCD_ISP1582_INIT_EXIT 10128
|
||||
#define USB_TCD_ISP1582_INTERRUPT 10129
|
||||
#define USB_TCD_ISP1582_ENDPOINT 10130
|
||||
#define USB_TCD_ISP1582_DEVICE_CONTROL 10131
|
||||
|
||||
#define USB_TCD_PDIUSBD12_DEVCE_CONTROL 10132
|
||||
#define USB_TCD_PDIUSBD12_ENDPOINT 10133
|
||||
#define USB_TCD_PDIUSBD12_INIT_EXIT 10134
|
||||
#define USB_TCD_PDIUSBD12_INTERRUPT 10135
|
||||
|
||||
/* The needs to be verified */
|
||||
#define USB_TCD_NET2280_INIT_EXIT 10136
|
||||
#define USB_TCD_NET2280_INTERRUPT 10137
|
||||
#define USB_TCD_NET2280_DEVICE_CONTROL 10138
|
||||
#define USB_TCD_NET2280_ENDPOINT 10139
|
||||
|
||||
/* Event IDs for FSL TCD */
|
||||
#define USB_TCD_FSL_INIT_EXIT 10150
|
||||
#define USB_TCD_FSL_INTERRUPT 10151
|
||||
#define USB_TCD_FSL_ENDPOINT 10152
|
||||
#define USB_TCD_FSL_DEVICE_CONTROL 10153
|
||||
|
||||
/* Event filters */
|
||||
|
||||
#define USB_TARG_WV_FILTER 0x00000001
|
||||
#define USB_HAL_WV_FILTER 0x00000002
|
||||
#define USB_TCD_ISP582_WV_FILTER 0x00000004
|
||||
#define USB_TCD_PDIUSBD12_WV_FILTER 0x00000008
|
||||
#define USB_TCD_NET2280_WV_FILTER 0x00000010
|
||||
#define USB_TCD_FSL_WV_FILTER 0x00000020
|
||||
|
||||
extern void usbPeriphWindViewLog (UINT32, char *, UINT32);
|
||||
|
||||
/* Macro to log the instrumentation event */
|
||||
|
||||
#define USB_TCD_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \
|
||||
usbPeriphWindViewLog (eventId, eventBuf, USB2_FILTER);
|
||||
|
||||
#define USB_HAL_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \
|
||||
usbPeriphWindViewLog (eventId, eventBuf, USB2_FILTER);
|
||||
|
||||
#define USB_TARG_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \
|
||||
usbPeriphWindViewLog (eventId, eventBuf, USB2_FILTER);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* usbPeriphInstr */
|
||||
@@ -0,0 +1,192 @@
|
||||
/* usbTargLib.h - Defines interface to usbTargLib.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2001, 2004, 2010-2012 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01l,30jun12,s_z Remove some common definition to usbTgtCommon.h
|
||||
01l,30jun11,s_z Remove USB_TARG_PIPE and USB_TARG_CHANNEL(WIND00285554)
|
||||
01k,29apr10,pad Moved extern C statement after include statements.
|
||||
01j,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01i,03aug04,mta Modification History Changes
|
||||
01h,19jul04,ami Coding Convention Changes
|
||||
01g,18may04,mta Modification to USB_TARG_STATUS_GET_FUNC
|
||||
01f,30mar04,ami changes made according to USB 2.0 Extn Design doc
|
||||
01e,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce
|
||||
01d,07may01,wef changed module number to be (module sub num << 8) |
|
||||
M_usbPeriphLib
|
||||
01c,02may01,wef changed module number to be M_<module> + M_usbPeriphLib
|
||||
01b,05dec00,wef moved Module number defs to vwModNum.h - add this
|
||||
to #includes
|
||||
01a,04aug99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines the interface to usbTargLib.c. usbTargLib.c implements a hardware-
|
||||
independent interface to USB target controller drivers.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTargLibh
|
||||
#define __INCusbTargLibh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usbHandleLib.h"
|
||||
#include "usb/usb.h"
|
||||
#include "vwModNum.h"
|
||||
#include "usb/target/usbHalCommon.h"
|
||||
#include "usb/target/usbHalLib.h"
|
||||
#include "usb/usbListLib.h"
|
||||
#include "usb/usbTgtCommon.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
#define TARG_TCD_SIG ((UINT32) 0xaaaa00cd) /* signature for Tcd */
|
||||
#define TARG_PIPE_SIG ((UINT32) 0xaaaa000e) /* signature for Pipe */
|
||||
|
||||
/* usbTargLib error codes */
|
||||
|
||||
/*
|
||||
* USB errnos are defined as being part of the USB peripheral Module, as are
|
||||
* all vxWorks module numbers, but the USB Module number is further divided
|
||||
* into sub-modules. Each sub-module has upto 255 values for its own error
|
||||
* codes
|
||||
*/
|
||||
|
||||
#define USB_TARG_SUB_MODULE 1
|
||||
|
||||
#define M_usbTargLib ( (USB_TARG_SUB_MODULE << 8) | M_usbPeriphLib )
|
||||
|
||||
#define usbTargErr(x) (M_usbTargLib | (x))
|
||||
|
||||
#define S_usbTargLib_BAD_PARAM usbTargErr(1) /* bad parameter */
|
||||
#define S_usbTargLib_BAD_HANDLE usbTargErr(2) /* bad handle */
|
||||
#define S_usbTargLib_OUT_OF_MEMORY usbTargErr(3) /* out of memory */
|
||||
#define S_usbTargLib_OUT_OF_RESOURCES usbTargErr(4) /* Out of resource */
|
||||
#define S_usbTargLib_NOT_IMPLEMENTED usbTargErr(5) /* not Implemented */
|
||||
#define S_usbTargLib_GENERAL_FAULT usbTargErr(6) /* general fault */
|
||||
#define S_usbTargLib_NOT_INITIALIZED usbTargErr(7) /* uninilialized */
|
||||
#define S_usbTargLib_CANNOT_CANCEL usbTargErr(8) /* cannot cancel */
|
||||
#define S_usbTargLib_TCD_FAULT usbTargErr(9) /* TCD related fault */
|
||||
#define S_usbTargLib_ENDPOINT_IN_USE usbTargErr(10) /* endpoint in use */
|
||||
#define S_usbTargLib_APP_FAULT usbTargErr(11) /* application fault */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef UINT32 USB_TARG_DESCR, *pUSB_TARG_DESCR;
|
||||
|
||||
/* caller-supplied target callbacks */
|
||||
/* Data Structures of the USB Target Library */
|
||||
|
||||
typedef struct targTcd /* TARG_TCD */
|
||||
{
|
||||
LINK tcdLink; /* link to the next TCD */
|
||||
USB_TARG_CHANNEL targChannel; /* handle to TCD */
|
||||
pUSB_TARG_CALLBACK_TABLE pCallbacks; /* table of application callback*/
|
||||
pVOID callbackParam; /* callback defined callback parameter*/
|
||||
USBHAL_TCD_NEXUS tcdNexus; /* TCD Nexus Pointer */
|
||||
UINT16 speed; /* speed of operation */
|
||||
USB_TARG_PIPE defaultControlPipeIN;/* handle to default control In */
|
||||
/* pipe */
|
||||
USB_TARG_PIPE defaultControlPipeOUT;/*handle to default control Out*/
|
||||
/* pipe */
|
||||
USB_ERP setupErp; /* to handle setup transfers */
|
||||
USB_ERP defaultControlErp; /* erp used to transfer to/from */
|
||||
/* default pipe */
|
||||
UINT8 setupBfr [sizeof (USB_SETUP)];/*for receiving */
|
||||
/* setup packet */
|
||||
UINT8 dataBfr [USB_MAX_DESCR_LEN]; /* sending/receiving data */
|
||||
/* to/from default control */
|
||||
/* pipe */
|
||||
BOOL controlErpPending; /* flag indicating setup erp pending*/
|
||||
MUTEX_HANDLE tcdMutex; /* for synchronization operations */
|
||||
} TARG_TCD, *pTARG_TCD;
|
||||
|
||||
typedef struct targPipe /* TARG_PIPE */
|
||||
{
|
||||
USB_TARG_PIPE pipeHandle; /* pipe handle information */
|
||||
pVOID pHalPipeHandle; /* HAL specific pipe handle */
|
||||
pTARG_TCD pTargTcd; /* pointer to targ_tcd data structure*/
|
||||
} TARG_PIPE, *pTARG_PIPE;
|
||||
|
||||
/* function declarations */
|
||||
|
||||
/* Function declarations for initializing & uninitializing */
|
||||
|
||||
extern STATUS usbTargInitialize (void);
|
||||
|
||||
extern STATUS usbTargShutdown (void);
|
||||
|
||||
extern STATUS usbTargTcdAttach (USB_TCD_EXEC_FUNC tcdExecFunc, pVOID tcdParam,
|
||||
pUSB_TARG_CALLBACK_TABLE pCallbacks,
|
||||
pVOID callbackParam,
|
||||
pUSB_TARG_CHANNEL pTargChannel);
|
||||
|
||||
extern STATUS usbTargTcdDetach (USB_TARG_CHANNEL targChannel);
|
||||
|
||||
extern STATUS usbTargEnable (USB_TARG_CHANNEL targChannel);
|
||||
|
||||
extern STATUS usbTargDisable (USB_TARG_CHANNEL targChannel);
|
||||
|
||||
/* Function declarations for Pipe Specific Request */
|
||||
|
||||
extern STATUS usbTargPipeCreate (USB_TARG_CHANNEL targChannel,
|
||||
pUSB_ENDPOINT_DESCR pEndpointDesc,
|
||||
UINT16 uConfigurationValue, UINT16 uInterface,
|
||||
UINT16 uAltSetting,
|
||||
pUSB_TARG_PIPE pPipeHandle);
|
||||
|
||||
extern STATUS usbTargPipeDestroy (USB_TARG_PIPE pipeHandle);
|
||||
|
||||
extern STATUS usbTargTransfer (USB_TARG_PIPE pipeHandle, pUSB_ERP pErp);
|
||||
|
||||
extern STATUS usbTargTransferAbort (USB_TARG_PIPE pipeHandle, pUSB_ERP pErp);
|
||||
|
||||
extern STATUS usbTargPipeStatusSet (USB_TARG_PIPE pipeHandle, UINT16 state);
|
||||
|
||||
extern STATUS usbTargPipeStatusGet (USB_TARG_PIPE pipeHandle, pUINT8 pBuf);
|
||||
|
||||
/* Function declarations for default pipe requests */
|
||||
|
||||
extern STATUS usbTargControlResponseSend (USB_TARG_CHANNEL targChannel,
|
||||
UINT16 bfrLen, pUINT8 pBfr);
|
||||
|
||||
extern STATUS usbTargControlPayloadRcv (USB_TARG_CHANNEL targChannel,
|
||||
UINT16 bfrLen, pUINT8 pBfr,
|
||||
ERP_CALLBACK userCallback);
|
||||
|
||||
extern STATUS usbTargControlStatusSend (USB_TARG_CHANNEL targChannel);
|
||||
|
||||
/* Function declarations for Device Control & Status Information */
|
||||
|
||||
extern STATUS usbTargCurrentFrameGet (USB_TARG_CHANNEL targChannel,
|
||||
pUINT16 pFrameNo);
|
||||
|
||||
extern STATUS usbTargSignalResume (USB_TARG_CHANNEL targChannel);
|
||||
|
||||
extern STATUS usbTargDeviceFeatureSet (USB_TARG_CHANNEL targChannel,
|
||||
UINT16 ufeatureSelector,
|
||||
UINT8 uTestSelector);
|
||||
|
||||
extern STATUS usbTargDeviceFeatureClear (USB_TARG_CHANNEL targChannel,
|
||||
UINT16 ufeatureSelector);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTargLibh */
|
||||
@@ -0,0 +1,47 @@
|
||||
/* usbTargUtil.h - Defines Utility functions */
|
||||
|
||||
/* Copyright 2004 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
02b,11may04,hch merge after D12 driver testing.
|
||||
01b,19jul04,ami Coding Convention Changes
|
||||
01a,30mar04,ami First
|
||||
|
||||
*/
|
||||
|
||||
/* Descriptions
|
||||
|
||||
This file defines the various utility functions
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __INCusbTargUtilh
|
||||
#define __INCusbTargUtilh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* function declarations */
|
||||
|
||||
extern int validateTarg (USB_TARG_CHANNEL targChannel,struct targTcd ** ppTcd);
|
||||
|
||||
extern STATUS mngmtFunc (pTARG_TCD pTcd, UINT16 mngmtCode, pVOID pContext);
|
||||
|
||||
extern VOID cntlEndpointStall (pTARG_TCD pTcd);
|
||||
|
||||
extern STATUS usbTargMgmtCallback (pVOID pTargTcd, UINT16 mngmtCode,
|
||||
pVOID pContext);
|
||||
|
||||
extern VOID usbTargSetupErpCallback (pUSB_ERP pErp);
|
||||
|
||||
extern VOID initSetupErp (pTARG_TCD pTcd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTargUtilh */
|
||||
@@ -0,0 +1,324 @@
|
||||
/* usbTcd.h - Defines generic interface to USB target controller drivers */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, 2010, 2011 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01h,30jun11,s_z Move USB_TARG_PIPE to usbHandleLib.h (WIND00285554)
|
||||
01g,29apr10,pad Moved extern C statement after include statements.
|
||||
01f,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01e,01sep04,pdg Removed multiple definition
|
||||
01d,03aug04,mta Modification History Changes
|
||||
01c,19jul04,ami Coding Convnetion Changes
|
||||
01b,14jul04,mta ISP1582 and Mass Storage Functionality Changes
|
||||
01a,04mar04,mta First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines the generic interface to a USB target controller driver (TCD).
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTcdh
|
||||
#define __INCusbTcdh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usbHandleLib.h"
|
||||
#include "usb/usb.h"
|
||||
#include "vwModNum.h"
|
||||
#include "usb/target/usbHalCommon.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/* TRB function codes */
|
||||
|
||||
/* Initialization and un-initialization Function Codes */
|
||||
|
||||
#define TCD_FNC_ATTACH 0x0000 /* attach/init target controller */
|
||||
#define TCD_FNC_DETACH 0x0001 /* detach/shutdown target controller */
|
||||
#define TCD_FNC_ENABLE 0x0002 /* enable target controller */
|
||||
#define TCD_FNC_DISABLE 0x0003 /* disable target controller */
|
||||
|
||||
/* Device Control and Status Function Codes */
|
||||
|
||||
#define TCD_FNC_ADDRESS_SET 0x0100 /* set device address */
|
||||
#define TCD_FNC_SIGNAL_RESUME 0x0101 /* drive resume signalling */
|
||||
#define TCD_FNC_DEVICE_FEATURE_SET 0x0102 /* set feature on device */
|
||||
#define TCD_FNC_DEVICE_FEATURE_CLEAR 0x0103 /* clear freature on device */
|
||||
#define TCD_FNC_CURRENT_FRAME_GET 0x0104 /* get current frame number */
|
||||
|
||||
/* Endpoint Specific Function Codes */
|
||||
|
||||
#define TCD_FNC_ENDPOINT_ASSIGN 0x0200 /* assigns an endpoint */
|
||||
#define TCD_FNC_ENDPOINT_RELEASE 0x0201 /* releases an endpoint */
|
||||
#define TCD_FNC_ENDPOINT_STATE_SET 0x0202 /* set endpoint state */
|
||||
#define TCD_FNC_ENDPOINT_STATUS_GET 0x0203 /* get endpoint status */
|
||||
#define TCD_FNC_IS_BUFFER_EMPTY 0x0204 /* is endpoint buffer empty */
|
||||
#define TCD_FNC_COPY_DATA_FROM_EPBUF 0x0205 /* copy data from endpoint buffer */
|
||||
#define TCD_FNC_COPY_DATA_TO_EPBUF 0x0206 /* copy data to endpoint buffer */
|
||||
|
||||
/* Interrupt Specific Function Codes */
|
||||
|
||||
#define TCD_FNC_INTERRUPT_STATUS_GET 0x0300 /* get interrupt status*/
|
||||
#define TCD_FNC_INTERRUPT_STATUS_CLEAR 0x0301 /* Clear Interrupt */
|
||||
#define TCD_FNC_ENDPOINT_INTERRUPT_STATUS_GET 0x0302 /* get endpoint */
|
||||
/* interrupt status */
|
||||
#define TCD_FNC_ENDPOINT_INTERRUPT_STATUS_CLEAR 0x0303 /* clear endpoint */
|
||||
/* interrupt status */
|
||||
#define TCD_FNC_HANDLE_DISCONNECT_INTERRUPT 0x0304 /* handle disconnect */
|
||||
/* interrupt */
|
||||
#define TCD_FNC_HANDLE_RESET_INTERRUPT 0x0305 /* handle reset interrupt */
|
||||
#define TCD_FNC_HANDLE_RESUME_INTERRUPT 0x0306 /* handle resume interrupt */
|
||||
#define TCD_FNC_HANDLE_SUSPEND_INTERRUPT 0x0307 /* handle suspend interrupt */
|
||||
|
||||
/* TRB result codes */
|
||||
|
||||
/*
|
||||
* USB errnos are defined as being part of the USB peripheral Module, as are
|
||||
* all vxWorks module numbers, but the USB Module number is further divided
|
||||
* into sub-modules. Each sub-module has upto 255 values for its own error
|
||||
* codes
|
||||
*/
|
||||
|
||||
/* MATHEW:THESE ERROR CODES NEED TO BE REVIEWED */
|
||||
|
||||
#define USB_TCD_SUB_MODULE 2
|
||||
|
||||
#define M_usbTcdLib ( (USB_TCD_SUB_MODULE << 8) | M_usbPeriphLib )
|
||||
|
||||
#define tcdErr(x) (M_usbTcdLib | (x))
|
||||
|
||||
#define S_usbTcdLib_BAD_PARAM tcdErr(1) /* bad parameter */
|
||||
#define S_usbTcdLib_BAD_HANDLE tcdErr(2) /* bad handle */
|
||||
#define S_usbTcdLib_OUT_OF_MEMORY tcdErr(3) /* out of memory */
|
||||
#define S_usbTcdLib_OUT_OF_RESOURCES tcdErr(4) /* out of resource */
|
||||
#define S_usbTcdLib_NOT_IMPLEMENTED tcdErr(5) /* not implemented */
|
||||
#define S_usbTcdLib_GENERAL_FAULT tcdErr(6) /* general fault */
|
||||
#define S_usbTcdLib_NOT_INITIALIZED tcdErr(7) /* not initialized */
|
||||
#define S_usbTcdLib_INT_HOOK_FAILED tcdErr(8) /* faliure in int. hooking */
|
||||
#define S_usbTcdLib_HW_NOT_READY tcdErr(9) /* hardware not ready */
|
||||
#define S_usbTcdLib_NOT_SUPPORTED tcdErr(10) /* not supported */
|
||||
#define S_usbTcdLib_ERP_CANCELED tcdErr(11) /* erp cancelled */
|
||||
#define S_usbTcdLib_CANNOT_CANCEL tcdErr(12) /* cannot cancel ERP */
|
||||
#define S_usbTcdLib_SHUTDOWN tcdErr(13) /* shutdown error */
|
||||
#define S_usbTcdLib_DATA_TOGGLE_FAULT tcdErr(14) /* data toggle error */
|
||||
#define S_usbTcdLib_PID_MISMATCH tcdErr(15) /* PID mismatch */
|
||||
#define S_usbTcdLib_COMM_FAULT tcdErr(16) /* communication fault */
|
||||
#define S_usbTcdLib_STALL_ERROR tcdErr(17) /* stall error */
|
||||
#define S_usbTcdLib_NEW_SETUP_PACKET tcdErr(18) /* setup packet error */
|
||||
#define S_usbTcdLib_DATA_OVERRUN tcdErr(19) /* data overrun */
|
||||
|
||||
/* endpoint states */
|
||||
|
||||
#define TCD_ENDPOINT_STALL 0x01 /* endpoint stall */
|
||||
#define TCD_ENDPOINT_UNSTALL 0x02 /* endpoint unstall */
|
||||
|
||||
/* Interrupt status masks */
|
||||
#define USBTCD_DISCONNECT_INTERRUPT_MASK 0x01 /* disconnect interrupt mask */
|
||||
#define USBTCD_RESET_INTERRUPT_MASK 0x02 /* reset interrupt mask */
|
||||
#define USBTCD_SUSPEND_INTERRUPT_MASK 0x04 /* suspend interrupt mask */
|
||||
#define USBTCD_RESUME_INTERRUPT_MASK 0x08 /* resume interrupt mask */
|
||||
#define USBTCD_ENDPOINT_INTERRUPT_MASK 0x10 /* endpoint interrupt mask */
|
||||
|
||||
/* Endpoint interrupt status masks */
|
||||
#define USBTCD_ENDPOINT_INTERRUPT_PENDING_MASK 0x01 /* endpoint interrupt */
|
||||
/* pending mask */
|
||||
#define USBTCD_ENDPOINT_SETUP_PID_MASK 0x02 /* setup interrupt */
|
||||
#define USBTCD_ENDPOINT_OUT_PID_MASK 0x04 /* out interrupt mask */
|
||||
#define USBTCD_ENDPOINT_IN_PID_MASK 0x08 /* in interrupt mask */
|
||||
#define USBTCD_ENDPOINT_TRANSFER_STATUS_MASK 0x0FF0 /* endpoint transfer */
|
||||
/* status mask */
|
||||
|
||||
/* Endpoint interrupt status error code values */
|
||||
#define USBTCD_ENDPOINT_TRANSFER_SUCCESS 0x0000 /* transfer success */
|
||||
#define USBTCD_ENDPOINT_DATA_TOGGLE_ERROR 0x00E0 /* data toggle error */
|
||||
#define USBTCD_ENDPOINT_PID_MISMATCH 0x00F0 /* PID mismatch */
|
||||
#define USBTCD_ENDPOINT_COMMN_FAULT 0x0100 /*Communication Fault*/
|
||||
#define USBTCD_ENDPOINT_STALL_ERROR 0x0110 /* stall error */
|
||||
#define USBTCD_ENDPOINT_DATA_OVERRUN 0x0120 /* data overrun */
|
||||
#define USBTCD_ENDPOINT_DATA_UNDERRUN 0x0130 /* data underrun */
|
||||
#define USBTCD_ENDPOINT_CRC_ERROR 0x0140 /* CRC error */
|
||||
#define USBTCD_ENDPOINT_TIMEOUT_ERROR 0x0150 /* Time Out error */
|
||||
#define USBTCD_ENDPOINT_BIT_STUFF_ERROR 0x0160 /* bit stuff error */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef GENERIC_HANDLE TCD_HANDLE, *pTCD_HANDLE;
|
||||
|
||||
/* hal isr callback */
|
||||
|
||||
typedef void (*USB_HAL_ISR_CALLBACK)( pVOID pHALData);
|
||||
|
||||
typedef struct usbHalDeviceInfo /* USBHAL_DEVICE_INFO */
|
||||
{
|
||||
UINT8 uNumberEndpoints; /* no of endpoints supported */
|
||||
} USBHAL_DEVICE_INFO, *pUSBHAL_DEVICE_INFO;
|
||||
|
||||
typedef struct trbHeader /* TRB_HEADER */
|
||||
{
|
||||
TCD_HANDLE handle; /* I/O caller's TCD client handle */
|
||||
UINT16 function; /* IN TCD function code */
|
||||
UINT16 trbLength; /* IN Length of the total TRB */
|
||||
} TRB_HEADER, *pTRB_HEADER;
|
||||
|
||||
typedef struct trbAttach /* TRB_ATTACH */
|
||||
{
|
||||
TRB_HEADER header; /* I/0 TRB header */
|
||||
pVOID tcdParam; /* IN TCD specific info */
|
||||
USB_HAL_ISR_CALLBACK usbHalIsr; /* IN isr callback function of HAL */
|
||||
pVOID usbHalIsrParam; /* IN isr callback function parameter */
|
||||
pUSBHAL_DEVICE_INFO pHalDeviceInfo; /* OUT HAL specific device info ptr */
|
||||
pUSB_APPLN_DEVICE_INFO pDeviceInfo; /* OUT device specific info ptr*/
|
||||
} TRB_ATTACH, *pTRB_ATTACH;
|
||||
|
||||
typedef struct trbDetach /* TRB_DETACH */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
} TRB_DETACH, *pTRB_DETACH;
|
||||
|
||||
typedef struct trbEnableDisable /* TRB_ENABLE_DISABLE */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
} TRB_ENABLE_DISABLE, *pTRB_ENABLE_DISABLE;
|
||||
|
||||
typedef struct trbAddressSet /* TRB_ADDRESS_SET */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
UINT8 deviceAddress; /* IN new device address */
|
||||
} TRB_ADDRESS_SET, *pTRB_ADDRESS_SET;
|
||||
|
||||
typedef struct trbSignalResume /* TRB_SIGNAL_RESUME */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
} TRB_SIGNAL_RESUME, *pTRB_SIGNAL_RESUME;
|
||||
|
||||
typedef struct trbDeviceFeatureSetClear /* TRB_DEVICE_FEATURE_SET_CLEAR */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
UINT16 uFeatureSelector; /* IN Feature to be set or cleared */
|
||||
UINT8 uTestSelector; /* IN Test Selector Value */
|
||||
} TRB_DEVICE_FEATURE_SET_CLEAR,*pTRB_DEVICE_FEATURE_SET_CLEAR;
|
||||
|
||||
typedef struct trbCurrentFrameGet /* TRB_CURRENT_FRAME_GET */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
UINT16 frameNo; /* OUT current frame number */
|
||||
} TRB_CURRENT_FRAME_GET, *pTRB_CURRENT_FRAME_GET;
|
||||
|
||||
typedef struct trbEndpointAssign /* TRB_ENDPOINT_ASSIGN */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
pUSB_ENDPOINT_DESCR pEndpointDesc; /* IN Ptr to Endpoint Descriptor */
|
||||
UINT32 uConfigurationValue; /* IN configuration calue */
|
||||
UINT32 uInterface; /* IN interface number of endpoint */
|
||||
UINT32 uAltSetting; /* IN alternate setting for interface */
|
||||
USB_TARG_PIPE pipeHandle; /* OUT pipe handle */
|
||||
}TRB_ENDPOINT_ASSIGN, *pTRB_ENDPOINT_ASSIGN;
|
||||
|
||||
typedef struct trbEndpointRelease /* TRB_ENDPOINT_RELEASE */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
USB_TARG_PIPE pipeHandle; /* IN pipe handle */
|
||||
} TRB_ENDPOINT_RELEASE, *pTRB_ENDPOINT_RELEASE;
|
||||
|
||||
typedef struct trbEndpointStateSet /* TRB_ENDPOINT_STATE_SET */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
USB_TARG_PIPE pipeHandle; /* IN pipe handle */
|
||||
UINT16 state; /* IN state of pipe TCD_ENDPOINT_xxxx */
|
||||
} TRB_ENDPOINT_STATE_SET, *pTRB_ENDPOINT_STATE_SET;
|
||||
|
||||
typedef struct trbEndpointStatusGet /* TRB_ENDPOINT_STATUS_GET */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
USB_TARG_PIPE pipeHandle; /* IN pipe handle */
|
||||
pUINT8 pStatus; /* OUT ptr to status of pipe */
|
||||
} TRB_ENDPOINT_STATUS_GET, *pTRB_ENDPOINT_STATUS_GET;
|
||||
|
||||
typedef struct trbIsBufferEmpty /* TRB_IS_BUFFER_EMPTY */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
USB_TARG_PIPE pipeHandle; /* IN pipe handle */
|
||||
BOOL bufferEmpty; /* OUT if buffer is empty TRUE */
|
||||
} TRB_IS_BUFFER_EMPTY, *pTRB_IS_BUFFER_EMPTY;
|
||||
|
||||
typedef struct trbCopyDataFromEpbuf /* TRB_COPY_DATA_FROM_EPBUF */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
USB_TARG_PIPE pipeHandle; /* IN pipe handle */
|
||||
UCHAR * pBuffer; /* IN buffer pointer */
|
||||
UINT32 uActLength; /* I/O length of buffer before */
|
||||
/* function call, actual data length */
|
||||
/* copied on function call return */
|
||||
} TRB_COPY_DATA_FROM_EPBUF, *pTRB_COPY_DATA_FROM_EPBUF;
|
||||
|
||||
typedef struct trbCopyDataToEpbuf /* TRB_COPY_DATA_TO_EPBUF */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
USB_TARG_PIPE pipeHandle; /* IN pipe handle */
|
||||
UCHAR * pBuffer; /* IN buffer pointer */
|
||||
UINT32 uActLength; /* I/O length of buffer before */
|
||||
/* function call, actual data length */
|
||||
/* copied on function call return */
|
||||
BOOL zeroLengthPacket; /* IN , if TRUE zero length packet */
|
||||
/* is sent */
|
||||
} TRB_COPY_DATA_TO_EPBUF, *pTRB_COPY_DATA_TO_EPBUF;
|
||||
|
||||
typedef struct trbInterruptStatusGetClear /* TRB_INTERRUPT_STATUS_GET_CLEAR */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
UINT32 uInterruptStatus; /* I/O interrupt bit mask */
|
||||
} TRB_INTERRUPT_STATUS_GET_CLEAR, *pTRB_INTERRUPT_STATUS_GET_CLEAR;
|
||||
|
||||
typedef struct trbEndpointInterruptStatusGet /*TRB_ENDPOINT_INTERRUPT_STATUS_GET*/
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
USB_TARG_PIPE pipeHandle; /* IN pipe handle */
|
||||
UINT32 uEndptInterruptStatus; /* OUT endpoint interrupt status */
|
||||
} TRB_ENDPOINT_INTERRUPT_STATUS_GET,*pTRB_ENDPOINT_INTERRUPT_STATUS_GET;
|
||||
|
||||
typedef struct trbEndpointInterruptStatusClear /* TRB_ENDPOINT_INTERRUPT_STATUS_CLEAR */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
USB_TARG_PIPE pipeHandle; /* IN pipe handle */
|
||||
} TRB_ENDPOINT_INTERRUPT_STATUS_CLEAR,*pTRB_ENDPOINT_INTERRUPT_STATUS_CLEAR;
|
||||
|
||||
typedef struct trbHandleDisconnectInterrupt /* TRB_HANDLE_DISCONNECT_INTERRUPT */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
} TRB_HANDLE_DISCONNECT_INTERRUPT,*pTRB_HANDLE_DISCONNECT_INTERRUPT;
|
||||
|
||||
typedef struct trbHandleResetInterrupt /* TRB_HANDLE_RESET_INTERRUPT */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
UINT32 uSpeed; /* OUT Operating speed of the device */
|
||||
} TRB_HANDLE_RESET_INTERRUPT, *pTRB_HANDLE_RESET_INTERRUPT;
|
||||
|
||||
typedef struct trbHandleResumeInterrupt /* TRB_HANDLE_RESUME_INTERRUPT */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
} TRB_HANDLE_RESUME_INTERRUPT, *pTRB_HANDLE_RESUME_INTERRUPT;
|
||||
|
||||
typedef struct trbHandleSuspendInterrupt /* TRB_HANDLE_SUSPEND_INTERRUPT */
|
||||
{
|
||||
TRB_HEADER header; /* IN TRB header */
|
||||
} TRB_HANDLE_SUSPEND_INTERRUPT,*pTRB_HANDLE_SUSPEND_INTERRUPT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTcdh */
|
||||
@@ -0,0 +1,138 @@
|
||||
/* usbTcdLib.h - TCD functional API */
|
||||
|
||||
/* Copyright 2000, 2010 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01c,29apr10,pad Moved extern C statement after include statements.
|
||||
01b,17aug04,hch correct the directory reference for usbTcd.h
|
||||
01a,09aug99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file defines a functional interface to the TCD.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTcdLibh
|
||||
#define __INCusbTcdLibh
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/target/usbTcd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/*
|
||||
* TCD_NEXUS
|
||||
*
|
||||
* TCD_NEXUS contains the entry point and TCD_CLIENT_HANDLE needed by a
|
||||
* TCD caller to invoke a TCD.
|
||||
*/
|
||||
|
||||
typedef struct tcd_nexus
|
||||
{
|
||||
USB_TCD_EXEC_FUNC tcdExecFunc; /* TCD primary entry point */
|
||||
TCD_HANDLE handle; /* client's handle with TCD */
|
||||
} TCD_NEXUS, *pTCD_NEXUS;
|
||||
|
||||
/* functions */
|
||||
|
||||
STATUS usbTcdAttach
|
||||
(
|
||||
USB_TCD_EXEC_FUNC tcdExecFunc, /* TCD's primary entry point */
|
||||
pVOID tcdParam, /* TCD-specific param */
|
||||
pTCD_NEXUS pNexus, /* nexus will be initialized on return */
|
||||
USB_TCD_MNGMT_CALLBACK mngmtCallback, /* caller's management callback */
|
||||
pVOID mngmtCallbackParam, /* caller-defined mngmt callback param */
|
||||
pUINT16 pSpeed, /* bfr to receive target's speed */
|
||||
pUINT16 pNumEndpoints, /* bfr to receive nbr of endpoints */
|
||||
pUSB_TARG_ENDPOINT_INFO *ppEndpoints /* bfr to receive ptr to endpt tbl */
|
||||
);
|
||||
|
||||
STATUS usbTcdDetach
|
||||
(
|
||||
pTCD_NEXUS pNexus /* client's nexus */
|
||||
);
|
||||
|
||||
STATUS usbTcdEnable
|
||||
(
|
||||
pTCD_NEXUS pNexus /* client's nexus */
|
||||
);
|
||||
|
||||
STATUS usbTcdDisable
|
||||
(
|
||||
pTCD_NEXUS pNexus /* client's nexus */
|
||||
);
|
||||
|
||||
STATUS usbTcdAddressSet
|
||||
(
|
||||
pTCD_NEXUS pNexus, /* client's nexus */
|
||||
UINT16 deviceAddress /* new address for target */
|
||||
);
|
||||
|
||||
STATUS usbTcdSignalResume
|
||||
(
|
||||
pTCD_NEXUS pNexus /* client's nexus */
|
||||
);
|
||||
|
||||
STATUS usbTcdEndpointAssign
|
||||
(
|
||||
pTCD_NEXUS pNexus, /* client's nexus */
|
||||
UINT16 endpointId, /* TCD-assigned endpoint ID */
|
||||
UINT16 endpointNum, /* endpoint number to be assigned */
|
||||
UINT16 configuration, /* configuration associated with endpoint */
|
||||
UINT16 interface, /* interface associated with endpoint */
|
||||
UINT16 transferType, /* transfer type for endpoint */
|
||||
UINT16 direction /* direction for endpoint */
|
||||
);
|
||||
|
||||
STATUS usbTcdEndpointRelease
|
||||
(
|
||||
pTCD_NEXUS pNexus, /* client's nexus */
|
||||
UINT16 endpointId /* endpointId to release */
|
||||
);
|
||||
|
||||
STATUS usbTcdEndpointStateSet
|
||||
(
|
||||
pTCD_NEXUS pNexus, /* client's nexus */
|
||||
UINT16 endpointId, /* endpointId */
|
||||
UINT16 state /* TCD_ENDPOINT_STALL/UNSTALL */
|
||||
);
|
||||
|
||||
STATUS usbTcdCurrentFrameGet
|
||||
(
|
||||
pTCD_NEXUS pNexus, /* client's nexus */
|
||||
pUINT16 pFrameNo /* current frame number */
|
||||
);
|
||||
|
||||
STATUS usbTcdErpSubmit
|
||||
(
|
||||
pTCD_NEXUS pNexus, /* client's nexus */
|
||||
pUSB_ERP pErp /* ERP to be executed */
|
||||
);
|
||||
|
||||
STATUS usbTcdErpCancel
|
||||
(
|
||||
pTCD_NEXUS pNexus, /* client's nexus */
|
||||
pUSB_ERP pErp /* ERP to be canceled */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTcdLibh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
/* cmdParser.h - Command line parsing utility functions */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01c,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01b,23nov99,rcb Make KeywordMatch() function public.
|
||||
01a,01jun99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file includes a collection of command-line parsing functions which are
|
||||
useful in the creation of command line utilities, such as bus exercisers.
|
||||
|
||||
There are three groups of functions defined by this library. The first is
|
||||
a collection of general string parser functions, such as functions to eliminate
|
||||
white space, functions to strip tokens out of a string, and so forth.
|
||||
|
||||
The second set of functions drive the actual parsing process. In order to
|
||||
use this second set of functions, clients must construct a table of CMD_DESCR
|
||||
structures which define the commands to be recognized by the parser. A
|
||||
brief example of such a table is shown below.
|
||||
|
||||
.CS
|
||||
CMD_DESCR commands [] =
|
||||
{
|
||||
{"Help", 4, "Help/?", "Displays list of commands.", CmdParserHelpFunc},
|
||||
{"?", 1, NULL, NULL, CmdParserHelpFunc},
|
||||
{"Exit", 4, "Exit", "Exits program.", CmdParserExitFunc},
|
||||
{NULL, 0, NULL, NULL, NULL}
|
||||
};
|
||||
.CE
|
||||
|
||||
The first field is the keyword for the command. The second field specifies
|
||||
the number of characters of the command which must match - allowing the user
|
||||
to enter only a portion of the keyword as a shortcut. The third and fourth
|
||||
fields are strings giving the command usage and a brief help string. A NULL
|
||||
in the Help field indicates that the corresponding keyword is a synonym for
|
||||
another command its usage/help should not be shown. The final field is a
|
||||
pointer to a function of type CMD_EXEC_FUNC which will be invoked if the
|
||||
parser encounters the corresponding command.
|
||||
|
||||
The third group of functions provide standard CMD_EXEC_FUNCs for certain
|
||||
commonly used commands, such as CmdParserHelpFunc and CmdParserExitFunc as
|
||||
shown in the preceding example.
|
||||
|
||||
The caller may pass a generic (pVOID) parameter to the command line parsing
|
||||
functions in the second group. This function is in turn passed to the
|
||||
CMD_EXEC_FUNCs. In this way, the caller can specify context information
|
||||
for the command execution functions.
|
||||
|
||||
Commands are executed after the user presses [enter]. Multiple commands may
|
||||
be entered on the same command line separated by semicolons (';'). Each
|
||||
command as if it had been entered on a separate line (unless a command
|
||||
terminates with an error, in which case all remaining commands entered on the
|
||||
same line will be ignored).
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __INCcmdParserh
|
||||
#define __INCcmdParserh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Constants */
|
||||
|
||||
/* Command parser return codes */
|
||||
|
||||
#define RET_OK 0 /* Normal termination */
|
||||
#define RET_ERROR 1 /* Program failure */
|
||||
#define RET_CONTINUE 2 /* Program continues looping */
|
||||
|
||||
|
||||
/* Prompt & input definitions */
|
||||
|
||||
#define CMD_SEPARATOR ';' /* Command separator character */
|
||||
|
||||
#define MAX_CMD_LEN 256 /* Maximum command length */
|
||||
#define MAX_KEYWORD_LEN 32 /* Maximum cmd keyword length */
|
||||
|
||||
|
||||
/* Command descriptors */
|
||||
|
||||
/*
|
||||
* CMD_EXEC_FUNC
|
||||
*
|
||||
* Note: The CMD_EXEC_FUNC is expected to update the <Cmd> parameter so
|
||||
* that it points to the next character in the command line following
|
||||
* the parameters consumed by the CMD_EXEC_FUNC itself.
|
||||
*/
|
||||
|
||||
|
||||
typedef UINT16 (*CMD_EXEC_FUNC)
|
||||
(
|
||||
pVOID param, /* Generic parameter passed down */
|
||||
char **ppCmd, /* Ptr to remainder of cmd line */
|
||||
FILE *fin, /* stream for input (if any) */
|
||||
FILE *fout /* stream for output (if any) */
|
||||
);
|
||||
|
||||
/*
|
||||
* CMD_DESCR - defines a command/keyword to be recognized by parser
|
||||
*/
|
||||
|
||||
typedef struct cmd_descr
|
||||
{
|
||||
char *keyword; /* Command keyword */
|
||||
int minMatch; /* Minimum # of chars to match */
|
||||
char *usage; /* Syntax */
|
||||
char *help; /* Description string */
|
||||
CMD_EXEC_FUNC execFunc; /* Command execution function */
|
||||
} CMD_DESCR, *pCMD_DESCR;
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
UINT16 PromptAndExecCmd
|
||||
(
|
||||
pVOID param, /* Generic parameter for exec funcs */
|
||||
char *pPrompt, /* Prompt to display */
|
||||
FILE *fin, /* Input stream */
|
||||
FILE *fout, /* Output stream */
|
||||
CMD_DESCR *pCmdTable /* CMD_DESCR table */
|
||||
);
|
||||
|
||||
|
||||
UINT16 ExecCmd
|
||||
(
|
||||
pVOID param, /* Generic parameter for exec funcs */
|
||||
char *pCmd, /* Cmd buffer to be parsed/executed */
|
||||
FILE *fin, /* Stream for input */
|
||||
FILE *fout, /* Stream for output */
|
||||
CMD_DESCR *pCmdTable /* CMD_DESCR table */
|
||||
);
|
||||
|
||||
|
||||
int KeywordMatch
|
||||
(
|
||||
char *s1, /* string 1 */
|
||||
char *s2, /* string 2 */
|
||||
int len /* max length to compare */
|
||||
);
|
||||
|
||||
|
||||
char *SkipSpace
|
||||
(
|
||||
char *pStr /* Input string */
|
||||
);
|
||||
|
||||
|
||||
UINT16 TruncSpace
|
||||
(
|
||||
char *pStr /* Input string */
|
||||
);
|
||||
|
||||
|
||||
char *GetNextToken
|
||||
(
|
||||
char *pStr, /* Input string */
|
||||
char *pToken, /* Bfr to receive token */
|
||||
UINT16 tokenLen /* Max length of Token bfr */
|
||||
);
|
||||
|
||||
|
||||
char *GetHexToken
|
||||
(
|
||||
char *pStr, /* input string */
|
||||
long *pToken, /* buffer to receive token value */
|
||||
long defVal /* default value */
|
||||
);
|
||||
|
||||
|
||||
UINT16 CmdParserHelpFunc
|
||||
(
|
||||
pVOID param, /* Generic parameter passed down */
|
||||
char **ppCmd, /* Ptr to remainder of cmd line */
|
||||
FILE *fin, /* stream for input (if any) */
|
||||
FILE *fout /* stream for output (if any) */
|
||||
);
|
||||
|
||||
|
||||
UINT16 CmdParserExitFunc
|
||||
(
|
||||
pVOID param, /* Generic parameter passed down */
|
||||
char **ppCmd, /* Ptr to remainder of cmd line */
|
||||
FILE *fin, /* stream for input (if any) */
|
||||
FILE *fout /* stream for output (if any) */
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCcmdParserh */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/* wavFormat.h - WAV audio file format */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01b,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01a,14jan00,rcb First.
|
||||
*/
|
||||
|
||||
#ifndef __INCwavFormath
|
||||
#define __INCwavFormath
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* RIFF file header */
|
||||
|
||||
#define RIFF_HDR_SIG "RIFF"
|
||||
#define RIFF_HDR_SIG_LEN 4
|
||||
|
||||
typedef struct riff_hdr
|
||||
{
|
||||
char signature [4]; /* identifier string = "RIFF" */
|
||||
UINT32 length; /* remaining length after this header */
|
||||
} RIFF_HDR, *pRIFF_HDR;
|
||||
|
||||
|
||||
/* RIFF .wav file signature */
|
||||
|
||||
#define RIFF_WAV_DATA_SIG "WAVE"
|
||||
#define RIFF_WAV_DATA_SIG_LEN 4
|
||||
|
||||
|
||||
/* RIFF chunk header */
|
||||
|
||||
#define RIFF_CHUNK_ID_LEN 4
|
||||
|
||||
typedef struct riff_chunk_hdr
|
||||
{
|
||||
char chunkId [RIFF_CHUNK_ID_LEN]; /* ID of chunk */
|
||||
UINT32 length; /* remaining length after header */
|
||||
} RIFF_CHUNK_HDR, *pRIFF_CHUNK_HDR;
|
||||
|
||||
|
||||
/* .wav format chunk */
|
||||
|
||||
#define RIFF_WAV_FMT_CHUNK_ID "fmt "
|
||||
|
||||
typedef struct wav_format_chunk
|
||||
{
|
||||
UINT16 formatTag; /* format category */
|
||||
UINT16 channels; /* number of channels */
|
||||
UINT32 samplesPerSec; /* sampling rate */
|
||||
UINT32 avgBytesPerSec; /* used to estminate bfr requirements */
|
||||
UINT16 blockAlign; /* data block size */
|
||||
union
|
||||
{
|
||||
struct /* MS PCM-specific data */
|
||||
{
|
||||
UINT16 bitsPerSample; /* sample size */
|
||||
} msPcm;
|
||||
} fmt;
|
||||
} WAV_FORMAT_CHUNK, *pWAV_FORMAT_CHUNK;
|
||||
|
||||
|
||||
/* .wav format categories */
|
||||
|
||||
#define WAV_FMT_MS_PCM 0x0001 /* Microsoft PCM */
|
||||
#define WAV_FMT_IBM_MULAW 0x0101 /* IBM mul-law */
|
||||
#define WAV_FMT_IBM_ALAW 0x0102 /* IBM a-law */
|
||||
#define WAV_FMT_IBM_ADPCM 0x0103 /* IBM AVC ADPCM */
|
||||
|
||||
|
||||
/* data chunk */
|
||||
|
||||
#define RIFF_WAV_DATA_CHUNK_SIG "data"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCwavFormath */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,711 @@
|
||||
/* usbAudio.h - Definitions for USB audio class */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01c,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01b,20mar00,rcb Re-define UINT16 members of structures as arrays of
|
||||
UINT8...UINT16 fields may not be word aligned and that
|
||||
causes fits for some processor families.
|
||||
01a,12jan00,rcb First.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbAudioh
|
||||
#define __INCusbAudioh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* USB audio subclass codes */
|
||||
|
||||
#define USB_SUBCLASS_AUDIO_NONE 0x00
|
||||
#define USB_SUBCLASS_AUDIO_AUDIOCONTROL 0x01
|
||||
#define USB_SUBCLASS_AUDIO_AUDIOSTREAMING 0x02
|
||||
#define USB_SUBCLASS_AUDIO_MIDISTREAMING 0x03
|
||||
|
||||
|
||||
/* USB audio protocol codes */
|
||||
|
||||
#define USB_PROTOCOL_AUDIO_NONE 0x00
|
||||
|
||||
|
||||
/* USB audio class-specific descriptor types */
|
||||
|
||||
#define USB_DESCR_AUDIO_UNDEFINED 0x20
|
||||
#define USB_DESCR_AUDIO_DEVICE 0x21
|
||||
#define USB_DESCR_AUDIO_CONFIGURATION 0x22
|
||||
#define USB_DESCR_AUDIO_STRING 0x23
|
||||
#define USB_DESCR_AUDIO_INTERFACE 0x24
|
||||
#define USB_DESCR_AUDIO_ENDPOINT 0x25
|
||||
|
||||
|
||||
/* USB audio class-specific AC interface descriptor subtypes */
|
||||
|
||||
#define USB_DESCR_AUDIO_AC_UNDEFINED 0x00
|
||||
#define USB_DESCR_AUDIO_AC_HEADER 0x01
|
||||
#define USB_DESCR_AUDIO_AC_INPUT_TERMINAL 0x02
|
||||
#define USB_DESCR_AUDIO_AC_OUTPUT_TERMINAL 0x03
|
||||
#define USB_DESCR_AUDIO_AC_MIXER_UNIT 0x04
|
||||
#define USB_DESCR_AUDIO_AC_SELECTOR_UNIT 0x05
|
||||
#define USB_DESCR_AUDIO_AC_FEATURE_UNIT 0x06
|
||||
#define USB_DESCR_AUDIO_AC_PROCESSING_UNIT 0x07
|
||||
#define USB_DESCR_AUDIO_AC_EXTENSION_UNIT 0x08
|
||||
|
||||
|
||||
/* USB audio class-specific AS interface descriptor subtypes */
|
||||
|
||||
#define USB_DESCR_AUDIO_AS_UNDEFINED 0x00
|
||||
#define USB_DESCR_AUDIO_AS_GENERAL 0x01
|
||||
#define USB_DESCR_AUDIO_AS_FORMAT_TYPE 0x02
|
||||
#define USB_DESCR_AUDIO_AS_FORMAT_SPECIFIC 0x03
|
||||
|
||||
|
||||
/* processing unit process types */
|
||||
|
||||
#define USB_AUDIO_PROCESS_UNDEFINED 0x00
|
||||
#define USB_AUDIO_PROCESS_UP_DOWN_MIX 0x01
|
||||
#define USB_AUDIO_PROCESS_DOLBY_PROLOGIC 0x02
|
||||
#define USB_AUDIO_PROCESS_3D_STEREO_EXT 0x03
|
||||
#define USB_AUDIO_PROCESS_REVERB 0x04
|
||||
#define USB_AUDIO_PROCESS_CHORUS 0x05
|
||||
#define USB_AUDIO_PROCESS_DYN_RANGE_COMP 0x06
|
||||
|
||||
|
||||
/* audio class-specific endpoint descriptor subtypes */
|
||||
|
||||
#define USB_DESCR_AUDIO_EP_UNDEFINED 0x00
|
||||
#define USB_DESCR_AUDIO_EP_GENERAL 0x01
|
||||
|
||||
|
||||
/* USB requests for audio devices */
|
||||
|
||||
#define USB_REQ_AUDIO_UNDEFINED 0x00
|
||||
#define USB_REQ_AUDIO_SET_CUR 0x01
|
||||
#define USB_REQ_AUDIO_GET_CUR 0x81
|
||||
#define USB_REQ_AUDIO_SET_MIN 0x02
|
||||
#define USB_REQ_AUDIO_GET_MIN 0x82
|
||||
#define USB_REQ_AUDIO_SET_MAX 0x03
|
||||
#define USB_REQ_AUDIO_GET_MAX 0x83
|
||||
#define USB_REQ_AUDIO_SET_RES 0x04
|
||||
#define USB_REQ_AUDIO_GET_RES 0x84
|
||||
#define USB_REQ_AUDIO_SET_MEM 0x05
|
||||
#define USB_REQ_AUDIO_GET_MEM 0x86
|
||||
#define USB_REQ_AUDIO_GET_STAT 0xff
|
||||
|
||||
|
||||
/* terminal control selectors */
|
||||
|
||||
#define USB_AUDIO_TCS_UNDEFINED 0x00
|
||||
#define USB_AUDIO_TCS_COPY_PROTECT 0x01
|
||||
|
||||
|
||||
/* feature unit control selectors */
|
||||
|
||||
#define USB_AUDIO_FCS_UNDEFINED 0x00
|
||||
#define USB_AUDIO_FCS_MUTE 0x01
|
||||
#define USB_AUDIO_FCS_VOLUME 0x02
|
||||
#define USB_AUDIO_FCS_BASS 0x03
|
||||
#define USB_AUDIO_FCS_MID 0x04
|
||||
#define USB_AUDIO_FCS_TREBLE 0x05
|
||||
#define USB_AUDIO_FCS_GRAPHIC_EQUALIZER 0x06
|
||||
#define USB_AUDIO_FCS_AUTOMATIC_GAIN 0x07
|
||||
#define USB_AUDIO_FCS_DELAY 0x08
|
||||
#define USB_AUDIO_FCS_BASS_BOOST 0x09
|
||||
#define USB_AUDIO_FCS_LOUDNESS 0x0a
|
||||
|
||||
|
||||
/* control bit mask in a feature unit descriptor */
|
||||
|
||||
#define USB_AUDIO_FCM_MUTE 0x0001
|
||||
#define USB_AUDIO_FCM_VOLUME 0x0002
|
||||
#define USB_AUDIO_FCM_BASS 0x0004
|
||||
#define USB_AUDIO_FCM_MID 0x0008
|
||||
#define USB_AUDIO_FCM_TREBLE 0x0010
|
||||
#define USB_AUDIO_FCM_GRAPHIC_EQUALIZER 0x0020
|
||||
#define USB_AUDIO_FCM_AUTOMATIC_GAIN 0x0040
|
||||
#define USB_AUDIO_FCM_DELAY 0x0080
|
||||
#define USB_AUDIO_FCM_BASS_BOOST 0x0100
|
||||
#define USB_AUDIO_FCM_LOUDNESS 0x0200
|
||||
|
||||
|
||||
/* Width of values for feature unit controls */
|
||||
|
||||
#define USB_AUDIO_MUTE_ATTR_WIDTH 1
|
||||
#define USB_AUDIO_VOLUME_ATTR_WIDTH 2
|
||||
#define USB_AUDIO_BASS_ATTR_WIDTH 1
|
||||
#define USB_AUDIO_MID_ATTR_WIDTH 1
|
||||
#define USB_AUDIO_TREBLE_ATTR_WIDTH 1
|
||||
|
||||
|
||||
/* up/down mix processing unit selectors */
|
||||
|
||||
#define USB_AUDIO_UDM_UNDEFINED 0x00
|
||||
#define USB_AUDIO_UDM_ENABLE 0x01
|
||||
#define USB_AUDIO_UDM_MODE_SELECT 0x02
|
||||
|
||||
|
||||
/* dolby prologic processing unit control sectors */
|
||||
|
||||
#define USB_AUDIO_DPL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_DPL_ENABLE 0x01
|
||||
#define USB_AUDIO_DPL_MODE_SELECT 0x02
|
||||
|
||||
|
||||
/* 3d stereo extender processing unit control selectors */
|
||||
|
||||
#define USB_AUDIO_3D_UNDEFINED 0x00
|
||||
#define USB_AUDIO_3D_ENABLE 0x01
|
||||
#define USB_AUDIO_3D_SPACIOUSNESS 0x03
|
||||
|
||||
|
||||
/* reverberation processing unit control selectors */
|
||||
|
||||
#define USB_AUDIO_RCS_UNDEFINED 0x00
|
||||
#define USB_AUDIO_RCS_ENABLE 0x01
|
||||
#define USB_AUDIO_RCS_REVERB_LEVEL 0x02
|
||||
#define USB_AUDIO_RCS_REVERB_TIME 0x03
|
||||
#define USB_AUDIO_RCS_REVERB_FEEDBACK 0x04
|
||||
|
||||
|
||||
/* chorus processing unit control selectors */
|
||||
|
||||
#define USB_AUDIO_CH_UNDEFINED 0x00
|
||||
#define USB_AUDIO_CH_ENABLE 0x01
|
||||
#define USB_AUDIO_CH_CHORUS_LEVEL 0x02
|
||||
#define USB_AUDIO_CH_CHORUS_RATE 0x03
|
||||
#define USB_AUDIO_CH_CHORUS_DEPTH 0x04
|
||||
|
||||
|
||||
/* dynamic range compressor processing unit control selectors */
|
||||
|
||||
#define USB_AUDIO_DRC_UNDEFINED 0x00
|
||||
#define USB_AUDIO_DRC_ENABLE 0x01
|
||||
#define USB_AUDIO_DRC_COMPRESSION_RATE 0x02
|
||||
#define USB_AUDIO_DRC_MAXAMPL 0x03
|
||||
#define USB_AUDIO_DRC_THRESHOLD 0x04
|
||||
#define USB_AUDIO_DRC_ATTACK_TIME 0x05
|
||||
#define USB_AUDIO_DRC_RELEASE_TIME 0x06
|
||||
|
||||
|
||||
/* extension unit control selectors */
|
||||
|
||||
#define USB_AUDIO_ECS_UNDEFINED 0x00
|
||||
#define USB_AUDIO_ECS_ENABLE 0x01
|
||||
|
||||
|
||||
/* endpoint control selectors */
|
||||
|
||||
#define USB_AUDIO_EPS_UNDEFINED 0x00
|
||||
#define USB_AUDIO_EPS_SAMPLING_FREQ 0x01
|
||||
#define USB_AUDIO_EPS_PITCH 0x02
|
||||
|
||||
|
||||
/* spatial locations in an audio cluster */
|
||||
|
||||
#define USB_AUDIO_LOC_LEFT_FRONT 0x0001
|
||||
#define USB_AUDIO_LOC_RIGHT_FRONT 0x0002
|
||||
#define USB_AUDIO_LOC_CENTER_FRONT 0x0004
|
||||
#define USB_AUDIO_LOC_LOW_FREQ_ENHANCE 0x0008
|
||||
#define USB_AUDIO_LOC_LEFT_SURROUND 0x0010
|
||||
#define USB_AUDIO_LOC_RIGHT_SURROUND 0x0020
|
||||
#define USB_AUDIO_LOC_LEFT_OF_CENTER 0x0040
|
||||
#define USB_AUDIO_LOC_RIGHT_OF_CENTER 0x0080
|
||||
#define USB_AUDIO_LOC_SURROUND 0x0100
|
||||
#define USB_AUDIO_LOC_SIDE_LEFT 0x0200
|
||||
#define USB_AUDIO_LOC_SIDE_RIGHT 0x0400
|
||||
#define USB_AUDIO_LOC_TOP 0x0800
|
||||
|
||||
|
||||
/* terminal types */
|
||||
|
||||
#define USB_AUDIO_TERM_UNDEFINED 0x0100
|
||||
#define USB_AUDIO_TERM_STREAMING 0x0101
|
||||
#define USB_AUDIO_TERM_VENDOR_SPECIFIC 0x01ff
|
||||
|
||||
|
||||
/* input terminal types */
|
||||
|
||||
#define USB_AUDIO_INTERM_UNDEFINED 0x0200
|
||||
#define USB_AUDIO_INTERM_MIC 0x0201
|
||||
#define USB_AUDIO_INTERM_DESKTOP_MIC 0x0202
|
||||
#define USB_AUDIO_INTERM_PERSONAL_MIC 0x0203
|
||||
#define USB_AUDIO_INTERM_OMNI_DIR_MIC 0x0204
|
||||
#define USB_AUDIO_INTERM_MIC_ARRAY 0x0205
|
||||
#define USB_AUDIO_INTERM_PROC_MIC_ARRAY 0x0206
|
||||
|
||||
|
||||
/* output terminal types */
|
||||
|
||||
#define USB_AUDIO_OUTTERM_UNDEFINED 0x0300
|
||||
#define USB_AUDIO_OUTTERM_SPEAKER 0x0301
|
||||
#define USB_AUDIO_OUTTERM_HEADPHONES 0x0302
|
||||
#define USB_AUDIO_OUTTERM_HEAD_MOUNT 0x0303
|
||||
#define USB_AUDIO_OUTTERM_DESKTOP_SPKR 0x0304
|
||||
#define USB_AUDIO_OUTTERM_ROOM_SPKR 0x0305
|
||||
#define USB_AUDIO_OUTTERM_COMM_SPKR 0x0306
|
||||
#define USB_AUDIO_OUTTERM_LOW_FREQ_SPKR 0x0307
|
||||
|
||||
|
||||
/* bi-directional terminal types */
|
||||
|
||||
#define USB_AUDIO_BITERM_UNDEFINED 0x0400
|
||||
#define USB_AUDIO_BITERM_HEADSET 0x0401
|
||||
#define USB_AUDIO_BITERM_HEADSET_ALT 0x0402
|
||||
#define USB_AUDIO_BITERM_SPKRPHONE 0x0403
|
||||
#define USB_AUDIO_BITERM_SPKRPHONE_ECHO_SUP 0x0404
|
||||
#define USB_AUDIO_BITERM_SPKRPHONE_ECHO_CAN 0x0405
|
||||
|
||||
|
||||
/* telephony terminal types */
|
||||
|
||||
#define USB_AUDIO_TELTERM_UNDEFINED 0x0500
|
||||
#define USB_AUDIO_TELTERM_PHONE_LINE 0x0501
|
||||
#define USB_AUDIO_TELTERM_TELEPHONE 0x0502
|
||||
#define USB_AUDIO_TELTERM_DOWN_LINE_PHONE 0x0503
|
||||
|
||||
|
||||
/* external terminal types */
|
||||
|
||||
#define USB_AUDIO_EXTTERM_UNDEFINED 0x0600
|
||||
#define USB_AUDIO_EXTTERM_ANALOG 0x0601
|
||||
#define USB_AUDIO_EXTTERM_DIGITAL 0x0602
|
||||
#define USB_AUDIO_EXTTERM_LINE 0x0603
|
||||
#define USB_AUDIO_EXTTERM_LEGACY 0x0604
|
||||
#define USB_AUDIO_EXTTERM_SPDIF 0x0605
|
||||
#define USB_AUDIO_EXTTERM_1394_DA 0x0606
|
||||
#define USB_AUDIO_EXTTERM_1394_DV_SOUND 0x0607
|
||||
|
||||
|
||||
/* embedded function terminal types */
|
||||
|
||||
#define USB_AUDIO_EMBTERM_UNDEFINED 0x0700
|
||||
#define USB_AUDIO_EMBTERM_LEVEL_CAL_NOISE 0x0701
|
||||
#define USB_AUDIO_EMBTERM_EQUAL_NOISE 0x0702
|
||||
#define USB_AUDIO_EMBTERM_CD_PLAYER 0x0703
|
||||
#define USB_AUDIO_EMBTERM_DAT 0x0704
|
||||
#define USB_AUDIO_EMBTERM_DCC 0x0705
|
||||
#define USB_AUDIO_EMBTERM_MINIDISK 0x0706
|
||||
#define USB_AUDIO_EMBTERM_ANALOG_TAPE 0x0707
|
||||
#define USB_AUDIO_EMBTERM_PHONOGRAPH 0x0708
|
||||
#define USB_AUDIO_EMBTERM_VCR_AUDIO 0x0709
|
||||
#define USB_AUDIO_EMBTERM_VIDEO_DISC 0x070a
|
||||
#define USB_AUDIO_EMBTERM_DVD_AUDIO 0x070b
|
||||
#define USB_AUDIO_EMBTERM_TV_TUNER 0x070c
|
||||
#define USB_AUDIO_EMBTERM_SAT_RECEIVER 0x070d
|
||||
#define USB_AUDIO_EMBTERM_CABLE_TUNER 0x070e
|
||||
#define USB_AUDIO_EMBTERM_DSS 0x070f
|
||||
#define USB_AUDIO_EMBTERM_RADIO_RECEIVER 0x0710
|
||||
#define USB_AUDIO_EMBTERM_RADIO_TRANSMITTER 0x0711
|
||||
#define USB_AUDIO_EMBTERM_MULTI_TRACK_REC 0x0712
|
||||
#define USB_AUDIO_EMBTERM_SYNTHESIZER 0x0713
|
||||
|
||||
|
||||
/* audio data format type I codes */
|
||||
|
||||
#define USB_AUDIO_TYPE1_UNDEFINED 0x0000
|
||||
#define USB_AUDIO_TYPE1_PCM 0x0001
|
||||
#define USB_AUDIO_TYPE1_PCM8 0x0002
|
||||
#define USB_AUDIO_TYPE1_IEEE_FLOAT 0x0003
|
||||
#define USB_AUDIO_TYPE1_ALAW 0x0004
|
||||
#define USB_AUDIO_TYPE1_MULAW 0x0005
|
||||
|
||||
|
||||
/* audio data format type II codes */
|
||||
|
||||
#define USB_AUDIO_TYPE2_UNDEFINED 0x1000
|
||||
#define USB_AUDIO_TYPE2_MPEG 0x1001
|
||||
#define USB_AUDIO_TYPE2_AC3 0x1002
|
||||
|
||||
|
||||
/* audio data format type III codes */
|
||||
|
||||
#define USB_AUDIO_TYPE3_UNDEFINED 0x2000
|
||||
#define USB_AUDIO_TYPE3_1937_AC3 0x2001
|
||||
#define USB_AUDIO_TYPE3_1937_MPEG1_L1 0x2002
|
||||
#define USB_AUDIO_TYPE3_1937_MPEG1_L2_3 0x2003
|
||||
#define USB_AUDIO_TYPE3_1937_MPEG2_NOEXT 0x2003
|
||||
#define USB_AUDIO_TYPE3_1937_MPEG2_EXT 0x2004
|
||||
#define USB_AUDIO_TYPE3_1937_MPEG2_L1_LS 0x2005
|
||||
#define USB_AUDIO_TYPE3_1937_MPEG2_L2_3_LS 0x2006
|
||||
|
||||
|
||||
/* format type codes */
|
||||
|
||||
#define USB_AUDIO_FORMAT_UNDEFINED 0x00
|
||||
#define USB_AUDIO_FORMAT_TYPE1 0x01
|
||||
#define USB_AUDIO_FORMAT_TYPE2 0x02
|
||||
#define USB_AUDIO_FORMAT_TYPE3 0x03
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/* status word format */
|
||||
|
||||
typedef struct usb_audio_status_word
|
||||
{
|
||||
UINT8 statusType;
|
||||
UINT8 originatorId;
|
||||
} USB_AUDIO_STATUS_WORD, *pUSB_AUDIO_STATUS_WORD;
|
||||
|
||||
|
||||
/* USB_AUDIO_STATUS_WORD.statusType */
|
||||
|
||||
#define USB_AUDIO_ST_AUDIO_CONTROL 0x00
|
||||
#define USB_AUDIO_ST_AUDIO_STREAMING_IF 0x01
|
||||
#define USB_AUDIO_ST_AUDIO_STREAMING_EP 0x02
|
||||
#define USB_AUDIO_ST_MEMORY_CHANGED 0x40
|
||||
#define USB_AUDIO_ST_INT_PENDING 0x80
|
||||
|
||||
|
||||
/* common audio descriptor header */
|
||||
|
||||
typedef struct usb_audio_descr_header
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
} USB_AUDIO_DESCR_HEADER, *pUSB_AUDIO_DESCR_HEADER;
|
||||
|
||||
|
||||
/* standard AC (AudioControl) interface descriptor.
|
||||
*
|
||||
* NOTE: This structure is identical to the standard USB interface descriptor,
|
||||
* except that interfaceClass is defined as the Audio interface class,
|
||||
* interfaceSubClass is defined as the audio interface subclass, and
|
||||
* interfaceProtocol is always 0.
|
||||
*/
|
||||
|
||||
|
||||
/* class-specific AC interface descriptor */
|
||||
|
||||
typedef struct usb_audio_ac_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 bcdAdc [2]; /* release level in BCD */
|
||||
UINT8 totalLength [2]; /* combined length of all descr */
|
||||
UINT8 inCollection; /* number of streaming interfaces */
|
||||
UINT8 interfaceNbr [1]; /* variable number of interface numbers */
|
||||
} USB_AUDIO_AC_DESCR, *pUSB_AUDIO_AC_DESCR;
|
||||
|
||||
|
||||
/* header common to all AudioControl unit/terminal descriptors */
|
||||
|
||||
typedef struct usb_audio_ac_common
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 unitId; /* unit/terminal ID */
|
||||
} USB_AUDIO_AC_COMMON, *pUSB_AUDIO_AC_COMMON;
|
||||
|
||||
|
||||
/* input terminal descriptor */
|
||||
|
||||
typedef struct usb_audio_input_term_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 terminalId; /* ID of this terminal */
|
||||
UINT8 terminalType [2]; /* type of terminal */
|
||||
UINT8 assocTerminal; /* ID of associated output terminal */
|
||||
UINT8 channels; /* count of channels */
|
||||
UINT8 channelConfig [2]; /* see USB_AUDIO_LOC_xxxx */
|
||||
UINT8 channelNamesIndex; /* index of first string descr */
|
||||
UINT8 terminalNameIndex; /* index of string descr for this term */
|
||||
} USB_AUDIO_INPUT_TERM_DESCR, *pUSB_AUDIO_INPUT_TERM_DESCR;
|
||||
|
||||
|
||||
/* output terminal descriptor */
|
||||
|
||||
typedef struct usb_audio_output_term_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 terminalId; /* ID of this terminal */
|
||||
UINT8 terminalType [2]; /* type of terminal */
|
||||
UINT8 assocTerminal; /* ID of associate input terminal */
|
||||
UINT8 sourceId; /* ID of connected unit/terminal */
|
||||
UINT8 terminalNameIndex; /* index of string desdr for this term */
|
||||
} USB_AUDIO_OUTPUT_TERM_DESCR, *pUSB_AUDIO_OUTPUT_TERM_DESCR;
|
||||
|
||||
|
||||
/* mixer unit descriptor */
|
||||
|
||||
typedef struct usb_audio_mixer_unit_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 unitId; /* ID of this unit */
|
||||
UINT8 nbrInPins; /* number of input pins */
|
||||
UINT8 sourceId [1]; /* array of sources */
|
||||
/* followed by a cluster descr */
|
||||
/* followed by a controls byte */
|
||||
/* followed by iMixer */
|
||||
} USB_AUDIO_MIXER_UNIT_DESCR, *pUSB_AUDIO_MIXER_UNIT_DESCR;
|
||||
|
||||
|
||||
/* selector unit descriptor */
|
||||
|
||||
typedef struct usb_audio_selector_unit_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 unitId; /* ID of this unit */
|
||||
UINT8 nbrInPins; /* number of input pins */
|
||||
UINT8 sourceId [1]; /* array of sources */
|
||||
/* followed by iMixer */
|
||||
} USB_AUDIO_SELECTOR_UNIT_DESCR, *pUSB_AUDIO_SELECTOR_UNIT_DESCR;
|
||||
|
||||
|
||||
/* feature unit descriptor */
|
||||
|
||||
typedef struct usb_audio_feature_unit_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 unitId; /* unique ID of this unit */
|
||||
UINT8 sourceId; /* ID of source unit/terminal */
|
||||
UINT8 controlSize; /* size of entries in controls array */
|
||||
UINT8 controls [1]; /* variable length, 1 + no. of channels */
|
||||
/* iFeature byte follows controls array */
|
||||
} USB_AUDIO_FEATURE_UNIT_DESCR, *pUSB_AUDIO_FEATURE_UNIT_DESCR;
|
||||
|
||||
|
||||
/* processing unit descriptor (common part) */
|
||||
|
||||
typedef struct usb_audio_process_unit_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 unitId; /* unique ID of this unit */
|
||||
UINT8 processType [2]; /* type of process performed by unit */
|
||||
UINT8 nbrInPins; /* number of input pins */
|
||||
UINT8 sourceId [1]; /* array of sources */
|
||||
/* ... */
|
||||
} USB_AUDIO_PROCESS_UNIT_DESCR, *pUSB_AUDIO_PROCESS_UNIT_DESCR;
|
||||
|
||||
|
||||
/* extension unit descriptor */
|
||||
|
||||
typedef struct usb_audio_ext_unit_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 unitId; /* unique ID of this unit */
|
||||
UINT8 extensionCode [2]; /* type of extension */
|
||||
UINT8 nbrInPins; /* number of input pins */
|
||||
UINT8 sourceId [1]; /* array of sources */
|
||||
/* ... */
|
||||
} USB_AUDIO_EXT_UNIT_DESCR, *pUSB_AUDIO_EXT_UNIT_DESCR;
|
||||
|
||||
|
||||
/* standard AC interrupt endpoint descriptor */
|
||||
|
||||
typedef struct usb_audio_int_ep_descr
|
||||
{
|
||||
UINT8 length; /* bLength */
|
||||
UINT8 descriptorType; /* bDescriptorType */
|
||||
UINT8 endpointAddress; /* bEndpointAddress */
|
||||
UINT8 attributes; /* bmAttributes */
|
||||
UINT8 maxPacketSize [2]; /* wMaxPacketSize */
|
||||
UINT8 interval; /* bInterval */
|
||||
UINT8 refresh; /* reset to 0 */
|
||||
UINT8 synchAddress; /* reset to 0 */
|
||||
} USB_AUDIO_INT_EP_DESCR, *pUSB_AUDIO_INT_EP_DESCR;
|
||||
|
||||
|
||||
/* standard AS (AudioStreaming) interface descriptor
|
||||
*
|
||||
* NOTE: This structure is identical to the standard USB interface descriptor,
|
||||
* except that interfaceClass is defined as the Audio interface class,
|
||||
* interfaceSubClass is defined as the audio interface subclass, and
|
||||
* interfaceProtocol is always 0.
|
||||
*/
|
||||
|
||||
|
||||
/* class-specific AS interface descriptor */
|
||||
|
||||
typedef struct usb_audio_as_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 terminalLink; /* ID of connected terminal */
|
||||
UINT8 delay; /* delay introduced by data path */
|
||||
UINT8 formatTag [2]; /* audio data format */
|
||||
} USB_AUDIO_AS_DESCR, *pUSB_AUDIO_AS_DESCR;
|
||||
|
||||
|
||||
/* standard AS isochronous audio data endpoint descriptor */
|
||||
|
||||
typedef struct usb_audio_std_isoch_ep_descr
|
||||
{
|
||||
UINT8 length; /* bLength */
|
||||
UINT8 descriptorType; /* bDescriptorType */
|
||||
UINT8 endpointAddress; /* bEndpointAddress */
|
||||
UINT8 attributes; /* bmAttributes */
|
||||
UINT8 maxPacketSize [2]; /* wMaxPacketSize */
|
||||
UINT8 interval; /* bInterval */
|
||||
UINT8 refresh; /* reset to 0 */
|
||||
UINT8 synchAddress; /* address of synch endpoint */
|
||||
} USB_AUDIO_STD_ISOCH_EP_DESCR, *pUSB_AUDIO_STD_ISOCH_EP_DESCR;
|
||||
|
||||
|
||||
/* class-specific isochronous audio data endpoint descriptor */
|
||||
|
||||
typedef struct usb_audio_class_isoch_ep_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 attributes; /* bmAttributes */
|
||||
UINT8 lockDelayUnits; /* indicates units for lockDelay */
|
||||
UINT8 lockDelay; /* internal clock lock time */
|
||||
} USB_AUDIO_CLASS_ISOCH_EP_DESCR, *pUSB_AUDIO_CLASS_ISOCH_EP_DESCR;
|
||||
|
||||
|
||||
/* standard AS isoch synch endpoint descriptor */
|
||||
|
||||
typedef struct usb_audio_isoch_synch_ep_descr
|
||||
{
|
||||
UINT8 length; /* bLength */
|
||||
UINT8 descriptorType; /* bDescriptorType */
|
||||
UINT8 endpointAddress; /* bEndpointAddress */
|
||||
UINT8 attributes; /* bmAttributes */
|
||||
UINT8 maxPacketSize [2]; /* wMaxPacketSize */
|
||||
UINT8 interval; /* bInterval */
|
||||
UINT8 refresh; /* synch refresh rate (pwr of 2) */
|
||||
UINT8 synchAddress; /* reset to 0 */
|
||||
} USB_AUDIO_ISOCH_SYNCH_EP_DESCR, *pUSB_AUDIO_ISOCH_SYNCH_EP_DESCR;
|
||||
|
||||
|
||||
/* common sampling frequency information */
|
||||
|
||||
typedef UINT8 USB_AUDIO_SAM_FREQ [3];
|
||||
|
||||
typedef struct usb_audio_sample_info
|
||||
{
|
||||
UINT8 freqType; /* how sampling freq. can be programmed */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
USB_AUDIO_SAM_FREQ lowerFreq; /* lower bound */
|
||||
USB_AUDIO_SAM_FREQ upperFreq; /* upper bound */
|
||||
} continous;
|
||||
struct
|
||||
{
|
||||
USB_AUDIO_SAM_FREQ freq [1]; /* discrete sampling frequency */
|
||||
} discrete;
|
||||
} freq;
|
||||
} USB_AUDIO_SAMPLE_INFO, *pUSB_AUDIO_SAMPLE_INFO;
|
||||
|
||||
|
||||
/* type I format type descriptor */
|
||||
|
||||
typedef struct usb_audio_type_1_type_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 formatType; /* identifies format type */
|
||||
UINT8 nbrChannels; /* number of channels */
|
||||
UINT8 subFrameSize; /* number of bytes for one audio subframe */
|
||||
UINT8 bitResolution; /* number of bits used per audio subframe */
|
||||
USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */
|
||||
} USB_AUDIO_TYPE_1_TYPE_DESCR, *pUSB_AUDIO_TYPE_1_TYPE_DESCR;
|
||||
|
||||
|
||||
/* type II format type descriptor */
|
||||
|
||||
typedef struct usb_audio_type_2_type_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 formatType; /* identifies format type */
|
||||
UINT8 maxBitRate [2]; /* max bits per second sup. by interface */
|
||||
UINT8 samplesPerFrame [2]; /* nbr PCM audio samples in audio frame */
|
||||
USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */
|
||||
} USB_AUDIO_TYPE_2_TYPE_DESCR, *pUSB_AUDIO_TYPE_2_TYPE_DESCR;
|
||||
|
||||
|
||||
/* type III format type descriptor */
|
||||
|
||||
typedef struct usb_audio_type_3_type_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 formatType; /* identifies format type */
|
||||
UINT8 nbrChannels; /* number of channels */
|
||||
UINT8 subFrameSize; /* number of bytes for one audio subframe */
|
||||
UINT8 bitResolution; /* number of bits used per audio subframe */
|
||||
USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */
|
||||
} USB_AUDIO_TYPE_3_TYPE_DESCR, *pUSB_AUDIO_TYPE_3_TYPE_DESCR;
|
||||
|
||||
|
||||
/* composite type descriptor */
|
||||
|
||||
typedef struct usb_audio_type_descr
|
||||
{
|
||||
UINT8 length; /* length of descriptor in bytes */
|
||||
UINT8 descriptorType; /* descriptor type */
|
||||
UINT8 descriptorSubType; /* descriptor sub type */
|
||||
UINT8 formatType; /* identifies format type */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UINT8 nbrChannels; /* number of channels */
|
||||
UINT8 subFrameSize; /* number of bytes for one audio subframe */
|
||||
UINT8 bitResolution; /* number of bits used per audio subframe */
|
||||
USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */
|
||||
} type1;
|
||||
struct
|
||||
{
|
||||
UINT8 maxBitRate [2]; /* max bits per second sup. by interface */
|
||||
UINT8 samplesPerFrame [2]; /* nbr PCM audio samples in audio frame */
|
||||
USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */
|
||||
} type2;
|
||||
struct
|
||||
{
|
||||
UINT8 nbrChannels; /* number of channels */
|
||||
UINT8 subFrameSize; /* number of bytes for one audio subframe */
|
||||
UINT8 bitResolution; /* number of bits used per audio subframe */
|
||||
USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */
|
||||
} type3;
|
||||
} ts;
|
||||
} USB_AUDIO_TYPE_DESCR, *pUSB_AUDIO_TYPE_DESCR;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbAudioh */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,498 @@
|
||||
/* usbCdc.h - Definitions for USB CDC class */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01b,29apr10,pad Moved extern C statement after include statements.
|
||||
01a,05mar09,w_x Created.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbCdch
|
||||
#define __INCusbCdch
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <usb/usb.h>
|
||||
#include <usb/usbPlatform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/*
|
||||
* USB CDC classes
|
||||
*/
|
||||
|
||||
/*
|
||||
* 4.1 Communication Device Class Code
|
||||
* 4.2 Communication Interface Class Code
|
||||
*
|
||||
* Note that both the device level and interface level use
|
||||
* the same value as the class code.
|
||||
*/
|
||||
|
||||
#define USB_CLASS_COMM 0x02
|
||||
|
||||
/*
|
||||
* 4.5 Data Interface Class Codes
|
||||
*/
|
||||
|
||||
#define USB_CLASS_CDC_DATA 0x0A
|
||||
|
||||
/*
|
||||
* USB CDC subclasses
|
||||
*/
|
||||
|
||||
/*
|
||||
* 4.3 Communication Interface Class SubClass Codes
|
||||
*
|
||||
* Note that codes from 0x08 up to 0x0C are added
|
||||
* in CDC 1.2 specification.
|
||||
*/
|
||||
|
||||
#define USB_CDC_SUBCLASS_DLCM 0x01 /* Direct Line Control Model */
|
||||
#define USB_CDC_SUBCLASS_ACM 0x02 /* Abstract Control Model */
|
||||
#define USB_CDC_SUBCLASS_TCM 0x03 /* Telephone Control Model */
|
||||
#define USB_CDC_SUBCLASS_MCCM 0x04 /* Multi-Channel Control Model */
|
||||
#define USB_CDC_SUBCLASS_CAPI 0x05 /* CAPI Control Model */
|
||||
#define USB_CDC_SUBCLASS_ETH 0x06 /* Ethernet Networking Control Model */
|
||||
#define USB_CDC_SUBCLASS_ATM 0x07 /* ATM Networking Control Model */
|
||||
#define USB_CDC_SUBCLASS_WHCM 0x08 /* Wireless Handset Control Model */
|
||||
#define USB_CDC_SUBCLASS_DM 0x09 /* Device Management */
|
||||
#define USB_CDC_SUBCLASS_MDLM 0x0A /* Mobile Direct Line Model */
|
||||
#define USB_CDC_SUBCLASS_OBEX 0x0B /* OBject EXchange */
|
||||
#define USB_CDC_SUBCLASS_EEM 0x0C /* Ethernet Emulation Model */
|
||||
|
||||
/*
|
||||
* USB CDC protocols
|
||||
*/
|
||||
|
||||
/*
|
||||
* 4.4 Communication Interface Class Control Protocol Codes
|
||||
*
|
||||
* Note that codes from 0x02 and up are added in CDC 1.2
|
||||
* specification.
|
||||
*/
|
||||
|
||||
#define USB_CDC_PROTO_NONE 0x00 /* No class specific protocol required */
|
||||
#define USB_CDC_PROTO_AT_V25TER 0x01 /* AT Commands: V.250 etc */
|
||||
#define USB_CDC_PROTO_AT_PCCA101 0x02 /* AT Commands defined by PCCA-101 */
|
||||
#define USB_CDC_PROTO_AT_PCCA101_ANNEX 0x03 /* AT Commands defined by PCCA-101 & Annex O */
|
||||
#define USB_CDC_PROTO_AT_GSM 0x04 /* AT Commands defined by GSM 07.07 */
|
||||
#define USB_CDC_PROTO_AT_3GPP 0x05 /* AT Commands defined by 3GPP 27.007 */
|
||||
#define USB_CDC_PROTO_AT_CDMA 0x06 /* AT Commands defined by TIA for CDMA */
|
||||
#define USB_CDC_PROTO_EEM 0x07 /* Ethernet Emulation Model */
|
||||
#define USB_CDC_PROTO_EXT 0xFE /* External Protocol: Commands
|
||||
* defined by Command Set
|
||||
* Functional Descriptor */
|
||||
#define USB_CDC_ACM_PROTO_VENDOR 0xFF /* Vendor-specific */
|
||||
|
||||
/*
|
||||
* 5.2.3 Functional Descriptors
|
||||
*
|
||||
* Table 24: Type Values for the bDescriptorType Field
|
||||
*
|
||||
* Note that these are class specific descriptor types,
|
||||
* may need to move to common places.
|
||||
*/
|
||||
|
||||
#define USB_DESCR_CS_INTERFACE (0x20 | USB_DESCR_INTERFACE)
|
||||
#define USB_DESCR_CS_ENDPOINT (0x20 | USB_DESCR_ENDPOINT)
|
||||
|
||||
/*
|
||||
* USB CDC class specific sub-descriptor types
|
||||
*
|
||||
* Table 25: bDescriptor SubType in Functional Descriptors
|
||||
*/
|
||||
|
||||
#define USB_CDC_CS_HEADER_TYPE 0x00 /* Header */
|
||||
#define USB_CDC_CS_CALL_MANAGEMENT_TYPE 0x01 /* Call Management */
|
||||
#define USB_CDC_CS_ACM_TYPE 0x02 /* Abstract Control Management */
|
||||
#define USB_CDC_CS_DLM_TYPE 0x03 /* Direct Line Management */
|
||||
#define USB_CDC_CS_TEL_RING_TYPE 0x04 /* Telephone Ringer */
|
||||
#define USB_CDC_CS_TEL_CALL_CAP_TYPE 0x05 /* Telephone Call and Line
|
||||
* State Reporting Capabilities */
|
||||
#define USB_CDC_CS_UNION_TYPE 0x06 /* Union */
|
||||
#define USB_CDC_CS_COUNTRY_TYPE 0x07 /* Country Selection */
|
||||
#define USB_CDC_CS_TEL_OP_MODE_TYPE 0x08 /* Telephone Operational Modes */
|
||||
#define USB_CDC_CS_USB_TERMINAL_TYPE 0x09 /* USB Terminal */
|
||||
#define USB_CDC_CS_NWK_TERMINAL_TYPE 0x0A /* Network Channel Terminal */
|
||||
#define USB_CDC_CS_PROTO_UNION_TYPE 0x0B /* Protocol Unit */
|
||||
#define USB_CDC_CS_EXTENSION_UNION_TYPE 0x0C /* Extension Unit */
|
||||
#define USB_CDC_CS_MULTI_CHAN_MGMT_TYPE 0x0D /* Multi-Channel Management */
|
||||
#define USB_CDC_CS_CAPI_CTRL_MGMT_TYPE 0x0E /* CAPI Control Management */
|
||||
#define USB_CDC_CS_ETH_NWK_TYPE 0x0F /* Ethernet Networking */
|
||||
#define USB_CDC_CS_ATM_NWK_TYPE 0x10 /* ATM Networking */
|
||||
#define USB_CDC_CS_WHCM_TYPE 0x11 /* Wireless Handset Control Model */
|
||||
#define USB_CDC_CS_MDLM_TYPE 0x12 /* Mobile Direct Line Model */
|
||||
#define USB_CDC_CS_MDLM_DETAIL_TYPE 0x13 /* MDLM Detail */
|
||||
#define USB_CDC_CS_DEV_MGMT_MODEL_TYPE 0x14 /* Device Management Model */
|
||||
#define USB_CDC_CS_OBEX_TYPE 0x15 /* OBEX */
|
||||
#define USB_CDC_CS_CMD_SET_TYPE 0x16 /* Command Set */
|
||||
#define USB_CDC_CS_CMD_SET_DETAIL_TYPE 0x17 /* Command Set Detail */
|
||||
#define USB_CDC_CS_TEL_CTRL_MODEL_TYPE 0x18 /* Telephone Control Model */
|
||||
#define USB_CDC_CS_OBEX_SERVICE_ID_TYPE 0x19 /* OBEX Service Identifier */
|
||||
|
||||
/*
|
||||
* 5.2.3.1 Header Functional Descriptor
|
||||
*
|
||||
* The class-specific descriptor shall start with a header
|
||||
* that is defined in Table 23. The bcdCDC field identifies
|
||||
* the release of the USB Class Definitions for Communication
|
||||
* Devices Specification (this specification) with which this
|
||||
* interface and its descriptors comply.
|
||||
*/
|
||||
|
||||
typedef struct usb_cdc_header_descr
|
||||
{
|
||||
UINT8 bLength; /* Size of this descriptor in bytes */
|
||||
UINT8 bDescriptorType; /* CS_INTERFACE descriptor type */
|
||||
UINT8 bDescriptorSubType; /* Header functional descriptor subtype */
|
||||
UINT16 bcdCDC; /* USB Class Definitions for Communication
|
||||
* Devices Specification release number in
|
||||
* binary-coded decimal */
|
||||
} __attribute__ ((packed)) USB_CDC_HEADER_DESCR;
|
||||
|
||||
/*
|
||||
* 5.2.3.2 Call Management Functional Descriptor
|
||||
*
|
||||
* The Call Management functional descriptor describes the
|
||||
* processing of calls for the Communication Class interface.
|
||||
* It can only occur within the class-specific portion of
|
||||
* an Interface descriptor.
|
||||
*/
|
||||
|
||||
typedef struct usb_cdc_call_mgmt_descr
|
||||
{
|
||||
UINT8 bLength; /* Size of this descriptor in bytes */
|
||||
UINT8 bDescriptorType; /* CS_INTERFACE descriptor type */
|
||||
UINT8 bDescriptorSubType; /* Call Management functional descriptor */
|
||||
UINT8 bmCapabilities; /* The capabilities this configuration supports */
|
||||
UINT8 bDataInterface; /* Interface number of Data Class interface
|
||||
* optionally used for call management */
|
||||
} __attribute__ ((packed)) USB_CDC_CALL_MGMT_DESCR;
|
||||
|
||||
/* USB_CDC_CALL_MGMT_DESCR::bmCapabilities bitmap definitions - START */
|
||||
|
||||
/*
|
||||
* Call management indication:
|
||||
*
|
||||
* 0 - Device does not handle call management itself.
|
||||
* 1 - Device handles call management itself.
|
||||
*/
|
||||
|
||||
#define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01
|
||||
|
||||
/*
|
||||
* Call management information interface indication:
|
||||
*
|
||||
* 0 - Device sends/receives call management information only over
|
||||
* the Communication Class interface.
|
||||
* 1 - Device can send/receive call management information over a
|
||||
* Data Class interface.
|
||||
*/
|
||||
|
||||
#define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02
|
||||
|
||||
/* USB_CDC_CALL_MGMT_DESCR::bmCapabilities bitmap definitions - END */
|
||||
|
||||
/*
|
||||
* 5.2.3.3 Abstract Control Management Functional Descriptor
|
||||
*
|
||||
* The Abstract Control Management functional descriptor
|
||||
* describes the commands supported by the Communication
|
||||
* Class interface, as defined in Section 3.6.2, with the
|
||||
* SubClass code of Abstract Control Model. It can only occur
|
||||
* within the class-specific portion of an Interface descriptor.
|
||||
*/
|
||||
|
||||
typedef struct usb_cdc_acm_mgmt_descr
|
||||
{
|
||||
UINT8 bLength; /* Size of this descriptor in bytes */
|
||||
UINT8 bDescriptorType; /* CS_INTERFACE descriptor type */
|
||||
UINT8 bDescriptorSubType; /* Abstract Control Management functional descriptor */
|
||||
UINT8 bmCapabilities; /* The capabilities this configuration supports */
|
||||
} __attribute__ ((packed)) USB_CDC_ACM_MGMT_DESCR;
|
||||
|
||||
/* USB_CDC_ACM_MGMT_DESCR::bmCapabilities bitmap definitions - START */
|
||||
|
||||
/*
|
||||
* Device supports the request combination of
|
||||
* Set_Comm_Feature,Clear_Comm_Feature, and Get_Comm_Feature.
|
||||
*/
|
||||
|
||||
#define USB_CDC_COMM_FEATURE 0x01
|
||||
|
||||
/*
|
||||
* Device supports the request combination of Set_Line_Coding,
|
||||
* Set_Control_Line_State, Get_Line_Coding, and the notification
|
||||
* Serial_State.
|
||||
*/
|
||||
|
||||
#define USB_CDC_CAP_LINE_CODING 0x02
|
||||
|
||||
/* Device supports the request Send_Break */
|
||||
|
||||
#define USB_CDC_CAP_SEND_BREAK 0x04
|
||||
|
||||
/* Device supports the notification Network_Connection */
|
||||
|
||||
#define USB_CDC_CAP_NOTIFY_NWK_CONN 0x08
|
||||
|
||||
/* USB_CDC_ACM_MGMT_DESCR::bmCapabilities bitmap definitions - END */
|
||||
|
||||
/*
|
||||
* 5.2.3.8 Union Functional Descriptor
|
||||
*
|
||||
* The Union functional descriptor describes the relationship
|
||||
* between a group of interfaces that can be considered to form
|
||||
* a functional unit. It can only occur within the class-specific
|
||||
* portion of an Interface descriptor. One of the interfaces in
|
||||
* the group is designated as a master or controlling interface
|
||||
* for the group, and certain class-specific messages can be
|
||||
* sent to this interface to act upon the group as a whole.
|
||||
* Similarly, notifications for the entire group can be sent from
|
||||
* this interface but apply to the entire group of interfaces.
|
||||
* Interfaces in this group can include Communication, Data, or
|
||||
* any other valid USB interface class (including, but not limited
|
||||
* to, Audio, HID, and Monitor).
|
||||
*/
|
||||
|
||||
typedef struct usb_cdc_union_descr
|
||||
{
|
||||
UINT8 bLength; /* Size of this descriptor in bytes */
|
||||
UINT8 bDescriptorType; /* CS_INTERFACE descriptor type */
|
||||
UINT8 bDescriptorSubType; /* Union functional descriptor */
|
||||
UINT8 bMasterInterface0; /* The interface number of the Communications
|
||||
* or Data Class interface, designated as
|
||||
* the controlling interface for the union
|
||||
*/
|
||||
UINT8 bSlaveInterface0; /* Interface number of first interface in the union */
|
||||
/* This may be followed by more slave interface numbers */
|
||||
} __attribute__ ((packed)) USB_CDC_UNION_DESCR;
|
||||
|
||||
/*
|
||||
* 5.2.3.9 Country Selection Functional Descriptor
|
||||
*
|
||||
* The Country Selection functional descriptor identifies
|
||||
* the countries in which the communication device is qualified to
|
||||
* operate. The parameters of the network connection often vary
|
||||
* from one country to another, especially in Europe. Also legal
|
||||
* requirements impose certain restrictions on devices because of
|
||||
* different regulations by the governing body of the network to
|
||||
* which the device must adhere. This descriptor can only occur
|
||||
* within the class-specific portion of an Interface descriptor
|
||||
* and should only be provided to a master Communication Class
|
||||
* interface of a union. The country codes used in the Country
|
||||
* Selection Functional Descriptor are not the same as the country
|
||||
* codes used in dialing international telephone calls. Implementers
|
||||
* should refer to the ISO 3166 specification for more information.
|
||||
*/
|
||||
|
||||
typedef struct usb_cdc_country_selection_descr
|
||||
{
|
||||
UINT8 bLength; /* Size of this descriptor in bytes */
|
||||
UINT8 bDescriptorType; /* CS_INTERFACE descriptor type */
|
||||
UINT8 bDescriptorSubType; /* Country Selection functional descriptor */
|
||||
UINT8 iCountryCodeRelDate; /* Index of a string giving the release date
|
||||
* for the implemented ISO 3166 Country Codes.
|
||||
* Date shall be presented as ddmmyyyy with
|
||||
* dd=day, mm=month, and yyyy=year */
|
||||
UINT16 wCountyCode0; /* Country code in the format as defined
|
||||
* in [ISO3166], release date as specified
|
||||
* in offset 3 for the first supported
|
||||
* country
|
||||
*/
|
||||
/* This may be followed by more supported country code */
|
||||
} __attribute__ ((packed)) USB_CDC_COUNTRY_SELECTION_DESCR;
|
||||
|
||||
/*
|
||||
* 5.2.3.11 Network Channel Terminal Functional Descriptor
|
||||
*
|
||||
* The Network Channel Terminal Functional descriptor provides
|
||||
* a means to indicate a relationship between a Unit and a
|
||||
* Network Channel. It can only occur within the class-specific
|
||||
* portion of an Interface descriptor.
|
||||
*/
|
||||
|
||||
typedef struct usb_cdc_network_channel_terminal_descr
|
||||
{
|
||||
UINT8 bLength; /* Size of this descriptor in bytes */
|
||||
UINT8 bDescriptorType; /* CS_INTERFACE descriptor type */
|
||||
UINT8 bDescriptorSubType; /* Network Channel Terminal functional descriptor */
|
||||
UINT8 bEntityId; /* Constant uniquely identifying the Terminal */
|
||||
UINT8 iName; /* Index of string descriptor, describing
|
||||
* the name of the Network Channel Terminal.\
|
||||
*/
|
||||
UINT8 bChannelIndex; /* The channel index of the associated network
|
||||
* channel according to indexing rules
|
||||
*/
|
||||
UINT8 bPhysicalInterface; /* Type of physical interface */
|
||||
} __attribute__ ((packed)) USB_CDC_NETWORK_CHANNEL_TERMINAL_DESCR;
|
||||
|
||||
/*
|
||||
* 5.2.3.16 Ethernet Networking Functional Descriptor
|
||||
*
|
||||
* The Ethernet Networking functional descriptor describes
|
||||
* the operational modes supported by the Communication Class
|
||||
* interface, as defined in Section 3.8.2, with the SubClass
|
||||
* code of Ethernet Networking Control. It can only occur within
|
||||
* the class-specific portion of an Interface descriptor.
|
||||
*/
|
||||
|
||||
typedef struct usb_cdc_ether_descr
|
||||
{
|
||||
UINT8 bLength; /* Size of this descriptor in bytes */
|
||||
UINT8 bDescriptorType; /* CS_INTERFACE descriptor type */
|
||||
UINT8 bDescriptorSubType; /* Ethernet Networking functional descriptor */
|
||||
UINT8 iMACAddress; /* Index of string descriptor. The string
|
||||
* descriptor holds the 48bit Ethernet MAC
|
||||
* address.
|
||||
*/
|
||||
UINT32 bmEthernetStatistics; /* Indicates which Ethernet statistics functions
|
||||
* the device collects. If a bit is set to 0,
|
||||
* the host network driver is expected to keep
|
||||
* count for the corresponding statistic (if able).
|
||||
*/
|
||||
UINT16 wMaxSegmentSize; /* The maximum segment size that the Ethernet
|
||||
* device is capable of supporting. This is
|
||||
* typically 1514 bytes, but could be extended
|
||||
*(e.g., 802.1d VLAN)
|
||||
*/
|
||||
UINT16 wNumberMCFilters; /* Contains the number of multicast filters that
|
||||
* can be configured by the host.
|
||||
*/
|
||||
UINT8 bNumberPowerFilters; /* Contains the number of pattern filters that are
|
||||
* available for causing wake-up of the host.
|
||||
*/
|
||||
} __attribute__ ((packed)) USB_CDC_ETHER_DESCR;
|
||||
|
||||
/*
|
||||
* Class-Specific Notifications
|
||||
*
|
||||
* Table 68: Class-Specific Notification Codes
|
||||
*/
|
||||
|
||||
#define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00
|
||||
#define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01
|
||||
#define USB_CDC_NOTIFY_AUX_JACK_HOOK_STATE 0x08
|
||||
#define USB_CDC_NOTIFY_RING_DETECT 0x09
|
||||
#define USB_CDC_NOTIFY_SERIAL_STATE 0x20
|
||||
#define USB_CDC_NOTIFY_CALL_STATE_CHANGE 0x28
|
||||
#define USB_CDC_NOTIFY_LINE_STATE_CHANGE 0x29
|
||||
#define USB_CDC_NOTIFY_CONNECTION_SPEED_CHANGE 0x2A
|
||||
|
||||
typedef struct usb_cdc_notification
|
||||
{
|
||||
UINT8 bmRequestType;
|
||||
UINT8 bNotification;
|
||||
UINT16 wValue;
|
||||
UINT16 wIndex;
|
||||
UINT16 wLength;
|
||||
} __attribute__ ((packed)) USB_CDC_NOTIFICATION;
|
||||
|
||||
/*
|
||||
* USB CDC Class-Specific Control Requests
|
||||
*
|
||||
* Table 46: Class-Specific Request Codes
|
||||
*/
|
||||
|
||||
#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00
|
||||
#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01
|
||||
#define USB_CDC_SET_COMM_FEATURE 0x02
|
||||
#define USB_CDC_GET_COMM_FEATURE 0x03
|
||||
#define USB_CDC_CLEAR_COMM_FEATURE 0x04
|
||||
/* 05h-0Fh reserved */
|
||||
#define USB_CDC_SET_AUX_LINE_STATE 0x10
|
||||
#define USB_CDC_SET_HOOK_STATE 0x11
|
||||
#define USB_CDC_PULSE_SETUP 0x12
|
||||
#define USB_CDC_SEND_PULSE 0x13
|
||||
#define USB_CDC_SET_PULSE_TIME 0x14
|
||||
#define USB_CDC_RING_AUX_JACK 0x15
|
||||
/* 16h-1Fh reserved */
|
||||
#define USB_CDC_REQ_SET_LINE_CODING 0x20
|
||||
#define USB_CDC_REQ_GET_LINE_CODING 0x21
|
||||
#define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22
|
||||
#define USB_CDC_REQ_SEND_BREAK 0x23
|
||||
/* 24h-2Fh reserved */
|
||||
#define USB_CDC_SET_RINGER_PARMS 0x30
|
||||
#define USB_CDC_GET_RINGER_PARMS 0x31
|
||||
#define USB_CDC_SET_OPERATION_PARMS 0x32
|
||||
#define USB_CDC_GET_OPERATION_PARMS 0x33
|
||||
#define USB_CDC_SET_LINE_PARMS 0x34
|
||||
#define USB_CDC_GET_LINE_PARMS 0x35
|
||||
#define USB_CDC_DIAL_DIGITS 0x36
|
||||
#define USB_CDC_SET_UNIT_PARAMETER 0x37
|
||||
#define USB_CDC_GET_UNIT_PARAMETER 0x38
|
||||
#define USB_CDC_CLEAR_UNIT_PARAMETER 0x39
|
||||
#define USB_CDC_GET_PROFILE 0x3A
|
||||
/* 3Bh-3Fh reserved */
|
||||
#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
|
||||
#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41
|
||||
#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
|
||||
#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
|
||||
#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
|
||||
/* 45h-4Fh reserved */
|
||||
#define USB_CDC_SET_ATM_DATA_FORMAT 0x50
|
||||
#define USB_CDC_GET_ATM_DEVICE_STATISTICS 0x51
|
||||
#define USB_CDC_SET_ATM_DEFAULT_VC 0x52
|
||||
#define USB_CDC_GET_ATM_VC_STATISTICS 0x53
|
||||
/* 54h-5Fh reserved */
|
||||
/* 60h-7Fh MDLM Semantic-Model specific Requests */
|
||||
|
||||
/* Table 50: Line Coding Structure */
|
||||
|
||||
typedef struct usb_cdc_line_coding
|
||||
{
|
||||
UINT32 dwDTERate; /* Data terminal rate, in bits per second */
|
||||
UINT8 bCharFormat; /* Stop bits */
|
||||
UINT8 bParityType; /* Parity */
|
||||
UINT8 bDataBits; /* Data bits */
|
||||
} __attribute__ ((packed)) USB_CDC_LINE_CODING;
|
||||
|
||||
/* USB_CDC_LINE_CODING:: bCharFormat bitmap defintions - START */
|
||||
|
||||
#define USB_CDC_1_STOP_BITS 0
|
||||
|
||||
#define USB_CDC_1_5_STOP_BITS 1
|
||||
|
||||
#define USB_CDC_2_STOP_BITS 2
|
||||
|
||||
/* USB_CDC_LINE_CODING:: bCharFormat bitmap defintions - END */
|
||||
|
||||
/* USB_CDC_LINE_CODING:: bParityType bitmap defintions - START */
|
||||
|
||||
#define USB_CDC_NO_PARITY 0
|
||||
#define USB_CDC_ODD_PARITY 1
|
||||
#define USB_CDC_EVEN_PARITY 2
|
||||
#define USB_CDC_MARK_PARITY 3
|
||||
#define USB_CDC_SPACE_PARITY 4
|
||||
|
||||
/* USB_CDC_LINE_CODING:: bParityType bitmap defintions - END */
|
||||
|
||||
/* 6.2.30 SetEthernetPacketFilter */
|
||||
|
||||
/* Table 62: Ethernet Packet Filter Bitmap */
|
||||
|
||||
#define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0)
|
||||
#define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */
|
||||
#define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2)
|
||||
#define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3)
|
||||
#define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) /* filtered */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbCdch */
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/* usbCommdevices.h - Class-specific definitions for USB Communications class */
|
||||
|
||||
/* Copyright 2000-2001 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
|
||||
01a,02may00,vis created.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __INCusbCommDevicesh
|
||||
#define __INCusbCommDevicesh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* Communications Device Class code */
|
||||
|
||||
#define USB_CLASS_COMMDEVICE 0x02
|
||||
|
||||
/* Communications Interface Class code */
|
||||
|
||||
#define USB_CLASS_COMMINTERFACE 0x02
|
||||
|
||||
/* Data Interface Class code */
|
||||
|
||||
#define USB_CLASS_DATAINTERFACE 0x0a
|
||||
|
||||
|
||||
/* Communications Interface Class Subclass codes */
|
||||
|
||||
#define USB_SUBCLASS_DLCM 0x01 /* Direct Line Control Model */
|
||||
#define USB_SUBCLASS_ACM 0x02 /* Abstract Control Model */
|
||||
#define USB_SUBCLASS_TCM 0x03 /* Telephone Control Model */
|
||||
#define USB_SUBCLASS_MCCM 0x04 /* MultiChannel Control Model */
|
||||
#define USB_SUBCLASS_CAPI 0x05 /* CAPI Control Model */
|
||||
#define USB_SUBCLASS_ENET 0x06 /* Ethernet Control Model */
|
||||
#define USB_SUBCLASS_ATM 0x07 /* ATM Control Model */
|
||||
|
||||
/* Data Interface Class Subclass codes */
|
||||
|
||||
#define USB_SUBCLASS_DATA 0x00 /* Currently not used */
|
||||
|
||||
|
||||
/* Communication Interface Class Control Protocol codes */
|
||||
|
||||
#define USB_COMM_PROTOCOL_NONE 0x00 /* No protocol required */
|
||||
#define USB_COMM_PROTOCOL_COMMONAT 0x01 /* common AT commands (hayes */
|
||||
/* compatible ) */
|
||||
#define USB_COMM_PROTOCOL_VENDOR 0xff /* Vendor Specific protocol */
|
||||
|
||||
|
||||
/* Data Interface Class Control Protocol codes */
|
||||
|
||||
#define USB_COMM_PROTOCOL_ISDN 0x30 /* Physical interface protocol*/
|
||||
/* for ISDN BRI */
|
||||
#define USB_COMM_PROTOCOL_HDLC 0x31 /* HDLC */
|
||||
#define USB_COMM_PROTOCOL_TRANSPARENT 0x32 /* None.. */
|
||||
#define USB_COMM_PROTOCOL_Q921M 0x50 /* Management protocol for */
|
||||
/* Q.921 data link protocol */
|
||||
#define USB_COMM_PROTOCOL_Q921 0x51 /* data link protocol for */
|
||||
/* Q.921 */
|
||||
#define USB_COMM_PROTOCOL_Q921T 0x52 /* TEI multiplexor for */
|
||||
/* Q.921 data link protocol */
|
||||
#define USB_COMM_PROTOCOL_V42BIS 0x90 /* Data compression procedures */
|
||||
#define USB_COMM_PROTOCOL_Q931 0x91 /* Q.931 or Euro ISDN */
|
||||
#define USB_COMM_PROTOCOL_V120 0x92 /* V.24 adaptation to ISDN */
|
||||
#define USB_COMM_PROTOCOL_CAPI20 0x93 /* CAPI Commands */
|
||||
#define USB_COMM_PROTOCOL_HBD 0xfd /* Host based driver */
|
||||
#define USB_COMM_PROTOCOL_CDC 0xfe /* CDC Specification */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCusbCommDevicesh */
|
||||
@@ -0,0 +1,68 @@
|
||||
/* usbDescrCopyLib.h - USB descriptor copy utility functions */
|
||||
|
||||
/* Copyright 2000, 2010 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01c,29apr10,pad Moved extern C statement after include statements.
|
||||
01b,13apr00,wef fixed #ifndef bug
|
||||
01a,05apr00,wef First -removed these functions from usbLib.c to decouple host /
|
||||
peripheral stack interdependency.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbDescrCopyLibh
|
||||
#define __INCusbDescrCopyLibh
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usb.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
VOID usbDescrCopy
|
||||
(
|
||||
pUINT8 pBfr, /* destination buffer */
|
||||
pVOID pDescr, /* source buffer */
|
||||
UINT16 bfrLen, /* dest len */
|
||||
pUINT16 pActLen /* actual length copied */
|
||||
);
|
||||
|
||||
VOID usbDescrCopy32
|
||||
(
|
||||
pUINT8 pBfr, /* destination buffer */
|
||||
pVOID pDescr, /* source buffer */
|
||||
UINT32 bfrLen, /* dest len */
|
||||
pUINT32 pActLen /* actual length copied */
|
||||
);
|
||||
|
||||
VOID usbDescrStrCopy
|
||||
(
|
||||
pUINT8 pBfr, /* destination buffer */
|
||||
char *pStr, /* source buffer */
|
||||
UINT16 bfrLen, /* dest len */
|
||||
pUINT16 pActLen /* actual length copied */
|
||||
);
|
||||
|
||||
VOID usbDescrStrCopy32
|
||||
(
|
||||
pUINT8 pBfr, /* destination buffer */
|
||||
char *pStr, /* source buffer */
|
||||
UINT32 bfrLen, /* dest len */
|
||||
pUINT32 pActLen /* actual length copied */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbDescrCopyLibh*/
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/* usbEnet.h - Class-specific definitions for USB Ethernet Adapters */
|
||||
|
||||
/* Copyright 2000-2001, 2010 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01a,29apr10,pad Moved extern C statement after include statements.
|
||||
01a,02may00, vis Created
|
||||
*/
|
||||
|
||||
#ifndef __INCusbEneth
|
||||
#define __INCusbEneth
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usbCommdevices.h"
|
||||
#include "usb/usbPlatform.h"
|
||||
#include "usb/ossLib.h"
|
||||
#include "usb/usbListLib.h"
|
||||
#include "usb/usbQueueLib.h"
|
||||
#include "usb/usbdLib.h"
|
||||
#include "usb/usbdCoreLib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* USB Ethernet Control Model Sub class-specific requests */
|
||||
|
||||
#define USB_ENET_REQ_SEND_ENCAP_COMMAND 0x00
|
||||
#define USB_ENET_REQ_GET_ENCAP_RESPONSE 0x01
|
||||
#define USB_ENET_REQ_SET_MCAST_FILTERS 0x40
|
||||
#define USB_ENET_REQ_SET_POWMGMT_FILTER 0x41
|
||||
#define USB_ENET_REQ_GET_POWMGMT_FILTER 0x42
|
||||
#define USB_ENET_REQ_SET_PACKET_FILTER 0x43
|
||||
#define USB_ENET_REQ_GET_ENET_STATISTIC 0x44
|
||||
|
||||
/* USB Ethernet Control Model Notification codes.*/
|
||||
|
||||
#define USB_ENET_NOTIFY_NETWORK_CONNECTION 0x00
|
||||
#define USB_ENET_NOTIFY_RESPONSE_AVAILABLE 0x01
|
||||
#define USB_ENET_NOTIFY_CONNECTION_SPD_CHANGE 0x2a
|
||||
|
||||
/*
|
||||
* USB Ethernet Control Model - Statistics
|
||||
* These values are used in 2 places.
|
||||
* 1. In GetEthernetStatistic request, as feature selector
|
||||
* 2. In decifering the Function descriptor.
|
||||
*/
|
||||
|
||||
#define USB_ENET_STAT_XMIT_OK 1
|
||||
#define USB_ENET_STAT_RVC_OK 2
|
||||
#define USB_ENET_STAT_XMIT_ERROR 3
|
||||
#define USB_ENET_STAT_RVC_ERROR 4
|
||||
#define USB_ENET_STAT_RVC_NO_BUFFER 5
|
||||
#define USB_ENET_STAT_DIRECTED_BYTES_XMIT 6
|
||||
#define USB_ENET_STAT_DIRECTED_FRAMES_XMIT 7
|
||||
#define USB_ENET_STAT_MULTICAST_BYTES_XMIT 8
|
||||
#define USB_ENET_STAT_MULTICAST_FRAMES_XMIT 9
|
||||
#define USB_ENET_STAT_BROADCAST_BYTES_XMIT 10
|
||||
#define USB_ENET_STAT_BROADCAST_FRAMES_XMIT 11
|
||||
#define USB_ENET_STAT_DIRECTED_BYTES_RCV 12
|
||||
#define USB_ENET_STAT_DIRECTED_FRAMES_RCV 13
|
||||
#define USB_ENET_STAT_MULTICAST_BYTES_RCV 14
|
||||
#define USB_ENET_STAT_MULTICAST_FRAMES_RCV 15
|
||||
#define USB_ENET_STAT_BROADCAST_BYTES_RCV 16
|
||||
#define USB_ENET_STAT_BROADCAST_FRAMES_RCV 17
|
||||
#define USB_ENET_STAT_RCV_CRC_ERROR 18
|
||||
#define USB_ENET_STAT_TRANSMIT_QUEUE_LENGTH 19
|
||||
#define USB_ENET_STAT_RCV_ERROR_ALIGNMENT 20
|
||||
#define USB_ENET_STAT_XMIT_ONE_COLLISION 21
|
||||
#define USB_ENET_STAT_XMIT_MORE_COLLISIONS 22
|
||||
#define USB_ENET_STAT_XMIT_DEFERRED 23
|
||||
#define USB_ENET_STAT_XMIT_MAX_COLLISIONS 24
|
||||
#define USB_ENET_STAT_RCV_OVERRUN 25
|
||||
#define USB_ENET_STAT_XMIT_UNDERRUN 26
|
||||
#define USB_ENET_STAT_XMIT_HEARTBEAT_FAILURE 27
|
||||
#define USB_ENET_STAT_XMIT_TIMES_CRS_LOST 28
|
||||
#define USB_ENET_STAT_XMIT_LATE_COLLISIONS 29
|
||||
|
||||
/* here is how the Function descriptor is deciphered */
|
||||
|
||||
#define GetEnetStat(x) (0x1<<(x-1))
|
||||
|
||||
#define MCAST_FILTER_MASK 0x1000
|
||||
|
||||
/*
|
||||
* USB Ethernet Control Model - Packet Filter Setup Options.
|
||||
* These are used in the SetEthernetPacketFilter request.
|
||||
* The Packet Filter is the inclusive OR ofthe below options
|
||||
*/
|
||||
|
||||
#define USB_ENET_PKT_TYPE_PROMISCOUS 0x0001
|
||||
#define USB_ENET_PKT_TYPE_ALL_MULTICAST 0x0002
|
||||
#define USB_ENET_PKT_TYPE_DIRECTED 0x0004
|
||||
#define USB_ENET_PKT_TYPE_BROADCAST 0x0008
|
||||
#define USB_ENET_PKT_TYPE_MULTICAST 0x0010
|
||||
|
||||
/* USB Ethernet Control Model - Function descriptor */
|
||||
|
||||
typedef struct usbEnet_Func_descr
|
||||
{
|
||||
UINT8 length; /* bFunctionLength */
|
||||
UINT8 descriptorType; /* bDescriptorType */
|
||||
UINT8 descriptorSubType; /* bDescriptorType */
|
||||
UINT8 macAddressIndex; /* iMACAddress */
|
||||
UINT32 statisticsBitmap; /* bmEthernetStatistics */
|
||||
UINT16 maxSegmentSize; /* wMaxSegmentSize */
|
||||
UINT16 noOfMCastFilters; /* wNumbereMCFilters */
|
||||
UINT8 noOfPowerFilters; /* bNumberPowerFilters */
|
||||
} USB_ENET_FUNC_DESCR, *pUSB_ENET_FUNC_DESCR;
|
||||
|
||||
#define USB_ENET_FUNC_DESCR_LEN 13
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCusbEneth */
|
||||
@@ -0,0 +1,118 @@
|
||||
/* usbHandleLib.h - handle utility functions */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2001, 2010, 2011 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01i,30jun11,s_z Move USB_TARG_PIPE to usbHandleLib.h (WIND00285554)
|
||||
01h,29apr10,pad Moved extern C statement after include statements.
|
||||
01g,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01f,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce
|
||||
01e,07may01,wef changed module number to be (module sub num << 8) |
|
||||
M_usbHostLib
|
||||
01d,02may01,wef changed module number to be M_<module> + M_usbHostLib
|
||||
01c,05dec00,wef moved Module number defs to vwModNum.h - add this
|
||||
to #includes
|
||||
01b,07mar00,rcb Change definition of GENERIC_HANDLE from UINT32 to
|
||||
pVOID so handles can be compared against NULL without
|
||||
generating warnings (e.g., on MIPS gnu toolchain).
|
||||
01a,07jun99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines a set of general-purpose handle creation and validation functions.
|
||||
|
||||
Using these services, libraries can return handles to callers which can
|
||||
subsequently be validated for authenticity. This provides libraries with
|
||||
an additional measure of "bullet-proofing."
|
||||
*/
|
||||
|
||||
#ifndef __INCusbHandleLibh
|
||||
#define __INCusbHandleLibh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usbPlatform.h" /* USB Module number def's */
|
||||
#include "vwModNum.h" /* USB Module number def's */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* Handle utility library return values */
|
||||
|
||||
/*
|
||||
* USB errnos are defined as being part of the USB host Module, as are all
|
||||
* vxWorks module numbers, but the USB Module number is further divided into
|
||||
* sub-modules. Each sub-module has upto 255 values for its own error codes
|
||||
*/
|
||||
|
||||
#define USB_HANDLE_SUB_MODULE 3
|
||||
|
||||
#define M_usbHandleLib ( (USB_HANDLE_SUB_MODULE << 8) | M_usbHostLib )
|
||||
|
||||
#define hdlErr(x) (M_usbHandleLib | (x))
|
||||
|
||||
#define S_usbHandleLib_OUT_OF_MEMORY hdlErr(1)
|
||||
#define S_usbHandleLib_OUT_OF_RESOURCES hdlErr(2)
|
||||
#define S_usbHandleLib_OUT_OF_HANDLES hdlErr(3)
|
||||
#define S_usbHandleLib_BAD_PARAM hdlErr(4)
|
||||
#define S_usbHandleLib_BAD_HANDLE hdlErr(5)
|
||||
#define S_usbHandleLib_NOT_INITIALIZED hdlErr(6)
|
||||
#define S_usbHandleLib_GENERAL_FAULT hdlErr(7)
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef pVOID GENERIC_HANDLE; /* type of a generic handle */
|
||||
typedef GENERIC_HANDLE *pGENERIC_HANDLE;
|
||||
typedef UINT32 USB_TARG_CHANNEL, *pUSB_TARG_CHANNEL;
|
||||
typedef GENERIC_HANDLE USB_TARG_PIPE, *pUSB_TARG_PIPE;
|
||||
|
||||
/* functions */
|
||||
|
||||
STATUS usbHandleInitialize
|
||||
(
|
||||
UINT32 maxHandles /* max handles allocated by library */
|
||||
);
|
||||
|
||||
STATUS usbHandleShutdown (void);
|
||||
|
||||
STATUS usbHandleCreate
|
||||
(
|
||||
UINT32 handleSignature, /* Arbitrary handle signature */
|
||||
pVOID handleParam, /* Arbitrary handle parameter */
|
||||
pGENERIC_HANDLE pHandle /* Newly allocated handle */
|
||||
);
|
||||
|
||||
STATUS usbHandleDestroy
|
||||
(
|
||||
USB_TARG_CHANNEL handle /* handle to be destroyed */
|
||||
);
|
||||
|
||||
STATUS usbHandleValidate
|
||||
(
|
||||
GENERIC_HANDLE handle, /* handle to be validated */
|
||||
UINT32 handleSignature, /* signature used to validate handle */
|
||||
pVOID *pHandleParam /* Handle parameter on return */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbHandleLibh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/* usbHcdInstr.h - WindView Instrumentation definitions for HCD module */
|
||||
|
||||
/* Copyright 2004 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01b,22sep04,tcr move event ids from user-event range
|
||||
01a,03jun03,nld Initial Version
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file contains the definitions for the WindView Instrumentation for all
|
||||
three HCD modules i.e. EHCD, OHCD and UHCD.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbHcdInstrh
|
||||
#define __INCusbHcdInstrh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/* Event IDs for EHCD module */
|
||||
#define USB_EHCI_WV_INIT_EXIT 10150
|
||||
#define USB_EHCI_WV_EVENT_HANDLER 10151
|
||||
#define USB_EHCI_WV_PORT_ROUTE 10152
|
||||
#define USB_EHCI_WV_TRANSFER 10153
|
||||
|
||||
/* Event IDs for OHCD module */
|
||||
#define USB_OHCI_WV_INIT_EXIT 10160
|
||||
#define USB_OHCI_WV_EVENT_HANDLER 10161
|
||||
#define USB_OHCI_WV_TRANSFER 10162
|
||||
|
||||
/* Event IDs for UHCD module */
|
||||
#define USB_UHCI_WV_INIT_EXIT 10170
|
||||
#define USB_UHCI_WV_EVENT_HANDLER 10171
|
||||
#define USB_UHCI_WV_TRANSFER 10172
|
||||
|
||||
/* Event IDs for USBD module */
|
||||
#define USB_USBD_WV_INIT_EXIT 10180
|
||||
#define USB_USBD_WV_REGISTER 10181
|
||||
#define USB_USBD_WV_DEVICE 10182
|
||||
#define USB_USBD_WV_REQUEST 10183
|
||||
|
||||
|
||||
/* Event IDs for HUB module */
|
||||
#define USB_HUB_WV_INIT_EXIT 10190
|
||||
#define USB_HUB_WV_EVENT_HANDLER 10191
|
||||
#define USB_HUB_WV_DEVICE 10192
|
||||
#define USB_HUB_WV_TRANSFER 10193
|
||||
|
||||
|
||||
/* Event filters */
|
||||
#define USB_EHCD_WV_FILTER 0x00000001
|
||||
#define USB_OHCD_WV_FILTER 0x00000002
|
||||
#define USB_UHCD_WV_FILTER 0x00000004
|
||||
#define USB_USBD_WV_FILTER 0x00000008
|
||||
#define USB_HUB_WV_FILTER 0x0000000F
|
||||
|
||||
extern void usb2WindViewLog (UINT32, char *, UINT32);
|
||||
|
||||
/* Macro to log the instrumentation event */
|
||||
#define USB_HCD_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \
|
||||
usb2WindViewLog(eventId, eventBuf, USB2_FILTER);
|
||||
|
||||
#define USB_USBD_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \
|
||||
usb2WindViewLog(eventId, eventBuf, USB2_FILTER);
|
||||
|
||||
#define USB_HUB_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \
|
||||
usb2WindViewLog(eventId, eventBuf, USB2_FILTER);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbHcdInstrh */
|
||||
|
||||
/* End of file usbHcdInstr.h */
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/* usbHid.h - USB HID (Human Interface Devices) definitions */
|
||||
|
||||
/* Copyright 2000 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01b,07oct99,rcb Add definitions for mouse device.
|
||||
01a,30aug99,rcb First.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbHidh
|
||||
#define __INCusbHidh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* USB HID subclass codes */
|
||||
|
||||
#define USB_SUBCLASS_HID_NONE 0x00
|
||||
#define USB_SUBCLASS_HID_BOOT 0x01
|
||||
|
||||
|
||||
/* USB HID BOOT protocol codes (part of interface class)
|
||||
*
|
||||
* NOTE: Do not confuse with similarly named USB_HID_PROTOCOL_xxxx defines
|
||||
* later in this file. */
|
||||
|
||||
#define USB_PROTOCOL_HID_BOOT_NONE 0x00
|
||||
#define USB_PROTOCOL_HID_BOOT_KEYBOARD 0x01
|
||||
#define USB_PROTOCOL_HID_BOOT_MOUSE 0x02
|
||||
|
||||
|
||||
/* USB requests for HID devices */
|
||||
|
||||
#define USB_REQ_HID_GET_REPORT 0x01
|
||||
#define USB_REQ_HID_GET_IDLE 0x02
|
||||
#define USB_REQ_HID_GET_PROTOCOL 0x03
|
||||
#define USB_REQ_HID_SET_REPORT 0x09
|
||||
#define USB_REQ_HID_SET_IDLE 0x0a
|
||||
#define USB_REQ_HID_SET_PROTOCOL 0x0b
|
||||
|
||||
|
||||
/* USB HID report types */
|
||||
|
||||
#define USB_HID_RPT_TYPE_INPUT 0x01
|
||||
#define USB_HID_RPT_TYPE_OUTPUT 0x02
|
||||
#define USB_HID_RPT_TYPE_FEATURE 0x03
|
||||
|
||||
|
||||
/* USB HID idle interval */
|
||||
|
||||
#define USB_HID_IDLE_MSEC_PER_UNIT 4
|
||||
|
||||
|
||||
/* USB HID protocol values (used for USB_REQ_HID_SET_PROTOCOL)
|
||||
*
|
||||
* NOTE: Do not confuse with similarly named USB_PROTOCOL_HID_xxxx
|
||||
* defines earlier in this file.
|
||||
*/
|
||||
|
||||
#define USB_HID_PROTOCOL_BOOT 0
|
||||
#define USB_HID_PROTOCOL_REPORT 1
|
||||
|
||||
|
||||
/* HID keyboard definitions */
|
||||
|
||||
#define BOOT_RPT_KEYCOUNT 6 /* 6 keys returned in std boot report */
|
||||
|
||||
|
||||
/* HID keyboard modifier key definitions */
|
||||
|
||||
#define MOD_KEY_LEFT_CTRL 0x01
|
||||
#define MOD_KEY_LEFT_SHIFT 0x02
|
||||
#define MOD_KEY_LEFT_ALT 0x04
|
||||
#define MOD_KEY_LEFT_GUI 0x08
|
||||
#define MOD_KEY_RIGHT_CTRL 0x10
|
||||
#define MOD_KEY_RIGHT_SHIFT 0x20
|
||||
#define MOD_KEY_RIGHT_ALT 0x40
|
||||
#define MOD_KEY_RIGHT_GUI 0x80
|
||||
|
||||
#define MOD_KEY_CTRL (MOD_KEY_LEFT_CTRL | MOD_KEY_RIGHT_CTRL)
|
||||
#define MOD_KEY_SHIFT (MOD_KEY_LEFT_SHIFT | MOD_KEY_RIGHT_SHIFT)
|
||||
#define MOD_KEY_ALT (MOD_KEY_LEFT_ALT | MOD_KEY_RIGHT_ALT)
|
||||
#define MOD_KEY_GUI (MOD_KEY_LEFT_GUI | MOD_KEY_RIGHT_GUI)
|
||||
|
||||
|
||||
/* HID keyboard LED definitions for output report */
|
||||
|
||||
#define RPT_LED_NUM_LOCK 0x01
|
||||
#define RPT_LED_CAPS_LOCK 0x02
|
||||
#define RPT_LED_SCROLL_LOCK 0x04
|
||||
#define RPT_LED_COMPOSE 0x08
|
||||
#define RPT_LED_KANA 0x10
|
||||
|
||||
|
||||
/* HID mouse report definitions */
|
||||
|
||||
#define MOUSE_BUTTON_1 0x01
|
||||
#define MOUSE_BUTTON_2 0x02
|
||||
#define MOUSE_BUTTON_3 0x04
|
||||
|
||||
|
||||
/* Maximum length for a HID "boot report" */
|
||||
|
||||
#define HID_BOOT_REPORT_MAX_LEN 8
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/*
|
||||
* HID_KBD_BOOT_REPORT
|
||||
*/
|
||||
|
||||
typedef struct hid_kbd_boot_report
|
||||
{
|
||||
UINT8 modifiers; /* modifier keys */
|
||||
UINT8 reserved; /* reserved */
|
||||
UINT8 scanCodes [BOOT_RPT_KEYCOUNT]; /* individual scan codes */
|
||||
} HID_KBD_BOOT_REPORT, *pHID_KBD_BOOT_REPORT;
|
||||
|
||||
|
||||
/*
|
||||
* HID_MSE_BOOT_REPORT
|
||||
*/
|
||||
|
||||
typedef struct hid_mse_boot_report
|
||||
{
|
||||
UINT8 buttonState; /* buttons */
|
||||
char xDisplacement; /* signed x-displacement */
|
||||
char yDisplacement; /* signed y-displacement */
|
||||
} HID_MSE_BOOT_REPORT, *pHID_MSE_BOOT_REPORT;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbHidh */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,103 @@
|
||||
/* usbHubInitialization.h - Initialization and cleanup for hub class driver */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/* Copyright 2003, 2010 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01b,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01a,27jun03,nrv Changing the code to WRS standards
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This module provides the initialization and the clean up
|
||||
functions for the USB Hub Class Driver.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
INTERNAL
|
||||
*******************************************************************************
|
||||
* Filename : HUB_Initialization.h
|
||||
*
|
||||
* Copyright :
|
||||
*
|
||||
* THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO
|
||||
* LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING
|
||||
* ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE
|
||||
* 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY
|
||||
* ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY
|
||||
* PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE
|
||||
* ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL.
|
||||
* THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF
|
||||
* THIS COPYRIGHT AS PER APPLICABLE LAWS.
|
||||
*
|
||||
*
|
||||
* Description : This module provides the initialization and the clean up
|
||||
* functions for the USB Hub Class Driver.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __USBHUBINITIALIZATION_H___
|
||||
#define __USBHUBINITIALIZATION_H___
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : HUB_Init
|
||||
* Description : This function initializes the global variables and
|
||||
* registers USB Hub Class Driver function pointers with the
|
||||
* USB Host Software Stack.
|
||||
* This also retrieves the USB Host Software Stack functions
|
||||
* for future access.
|
||||
* Parameters : None.
|
||||
* Return Type : This returns 0 if the operation was successful.
|
||||
* Else this returns -1.
|
||||
******************************************************************************/
|
||||
|
||||
INT8 usbHubInit(void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : HUB_Exit
|
||||
* Description : This function de-registers and cleans up the
|
||||
* USB Hub Class Driver from the USB Host Software Stack.
|
||||
* Parameters : None.
|
||||
* Return Type : This returns 0 if the operation was successful.
|
||||
* Else this returns -1.
|
||||
******************************************************************************/
|
||||
|
||||
INT8 usbHubExit(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* End of #ifndef __HUB_INITIALIZATION_H___ */
|
||||
|
||||
/**************************** End of file HUB_Initialization.h ****************/
|
||||
@@ -0,0 +1,106 @@
|
||||
/* usbHubMisc.h - Miscellaneous for hub class driver */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2017 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/* Copyright 2003, 2017 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01b,05dec17,whu Added extern C statement (VXW6-86542)
|
||||
01a,27jun03,cfc Changing the code to WRS standards
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
INTERNAL
|
||||
*******************************************************************************
|
||||
* Filename : usbHubMisc.h
|
||||
*
|
||||
* Copyright :
|
||||
*
|
||||
* THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO
|
||||
* LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING
|
||||
* ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE
|
||||
* 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY
|
||||
* ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY
|
||||
* PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE
|
||||
* ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL.
|
||||
* THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF
|
||||
* THIS COPYRIGHT AS PER APPLICABLE LAWS.
|
||||
*
|
||||
*
|
||||
* Description : This module provides the debug functionality function
|
||||
* header file for the USB Hub Class Driver.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef __usbHubMisch
|
||||
#define __usbHubMisch
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/************************ GLOBAL FUNCTIONS ************************************/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : usbHubPortCntGet
|
||||
* Description : This function returns the number of ports connected to a
|
||||
* hub.
|
||||
* Parameters : uHubId IN Hub Device Handle
|
||||
* pPortCount OUT pointer to the Port count
|
||||
* Return Type : a) USBHST_SUCCESS if port count was successfully returned
|
||||
* b) USBHST_FAILURE if error occured.
|
||||
******************************************************************************/
|
||||
USBHST_STATUS usbHubPortCntGet(UINT32 uHubId, PUINT16 pPortCount);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : usbHubNodeIDGet
|
||||
* Description : Gets the node id of the node connected to hub port
|
||||
* Parameters : uHubId IN Handle to the hub.
|
||||
* uPortIndex IN port index
|
||||
* pNodeType OUT pointer to recieve the node type
|
||||
* pNodeId OUT pointer to recive the node Id
|
||||
* Return Type : a) USBHST_SUCCESS if node id was successfully returned
|
||||
* b) USBHST_FAILURE if error occured.
|
||||
******************************************************************************/
|
||||
USBHST_STATUS usbHubNodeIDGet(UINT32 uHubId,
|
||||
UINT16 uPortIndex,
|
||||
PUINT16 pNodeType,
|
||||
PUINT32 pNodeId);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : usbHubGetRootHubHandle
|
||||
* Description : This function is called by the USB Host Software Stack for
|
||||
* Finding the root hub handle of a Bus.
|
||||
* Parameters : uBusHandle IN Unique identifier for the bus
|
||||
* pRootHubHandle OUT Pointer to the root hub handle
|
||||
* Return Type : a) USBHST_SUCCESS if handle was successfully returned
|
||||
* b) USBHST_FAILURE if error occured.
|
||||
******************************************************************************/
|
||||
USBHST_STATUS usbHubGetRootHubHandle (UINT8 uBusHandle, PUINT32 pRootHubHandle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* End of #ifndef __usbHubMisch */
|
||||
|
||||
|
||||
/**************************** End of File usbHubMisc.h *************************/
|
||||
@@ -0,0 +1,136 @@
|
||||
/* usbLib.h - USB utility functions */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2000, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/* Copyright 1999-2000, 2010 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01f,29apr10,pad Moved extern C statement after include statements.
|
||||
01e,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01d,26jan00,rcb Modify usbRecurringTime() to accept <bandwidth> instead
|
||||
of <bytesPerFrame>.
|
||||
Add usbDescrCopy32() and usbDescrStrCopy32().
|
||||
01c,17jan99,rcb Add usbConfigDescrGet() function.
|
||||
01b,23nov99,rcb Add usbRecurringTime() function.
|
||||
01a,16jul99,rcb First.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbLibh
|
||||
#define __INCusbLibh
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usb.h"
|
||||
#include "usb/usbHid.h"
|
||||
#include "usb/usbdLib.h"
|
||||
#include "usb/usbDescrCopyLib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
UINT32 usbTransferTime
|
||||
(
|
||||
UINT16 transferType, /* transfer type */
|
||||
UINT16 direction, /* transfer direction */
|
||||
UINT16 speed, /* speed of pipe */
|
||||
UINT32 bytes, /* number of bytes for packet to be calc'd */
|
||||
UINT32 hostDelay, /* host controller delay per packet */
|
||||
UINT32 hostHubLsSetup /* host controller time for low-speed setup */
|
||||
);
|
||||
|
||||
UINT32 usbRecurringTime
|
||||
(
|
||||
UINT16 transferType, /* transfer type */
|
||||
UINT16 direction, /* transfer direction */
|
||||
UINT16 speed, /* speed of pipe */
|
||||
UINT16 packetSize, /* max packet size for endpoint */
|
||||
UINT32 bandwidth, /* number of bytes to transfer per second */
|
||||
UINT32 hostDelay, /* host controller delay per packet */
|
||||
UINT32 hostHubLsSetup /* host controller time for low-speed setup */
|
||||
);
|
||||
|
||||
pVOID usbDescrParseSkip
|
||||
(
|
||||
pUINT8 *ppBfr, /* buffer to parse */
|
||||
pUINT16 pBfrLen, /* length of buffer to parse */
|
||||
UINT8 descriptorType /* type of descriptor being sought */
|
||||
);
|
||||
|
||||
pVOID usbDescrParse
|
||||
(
|
||||
pUINT8 pBfr, /* buffer to parse */
|
||||
UINT16 bfrLen, /* length of buffer to parse */
|
||||
UINT8 descriptorType /* type of descriptor being sought */
|
||||
);
|
||||
|
||||
STATUS usbConfigCountGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */
|
||||
USBD_NODE_ID nodeId, /* device node ID */
|
||||
pUINT16 pNumConfig /* bfr to receive nbr of config */
|
||||
);
|
||||
|
||||
STATUS usbConfigDescrGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */
|
||||
USBD_NODE_ID nodeId, /* device node ID */
|
||||
UINT16 cfgNo, /* specifies configuration nbr */
|
||||
pUINT16 pBfrLen, /* receives length of buffer */
|
||||
pUINT8 *ppBfr /* receives pointer to buffer */
|
||||
);
|
||||
|
||||
STATUS usbHidReportSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */
|
||||
USBD_NODE_ID nodeId, /* desired node */
|
||||
UINT16 interface, /* desired interface */
|
||||
UINT16 reportType, /* report type */
|
||||
UINT16 reportId, /* report Id */
|
||||
pUINT8 reportBfr, /* report value */
|
||||
UINT16 reportLen /* length of report */
|
||||
);
|
||||
|
||||
STATUS usbHidIdleSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */
|
||||
USBD_NODE_ID nodeId, /* desired node */
|
||||
UINT16 interface, /* desired interface */
|
||||
UINT16 reportId, /* desired report */
|
||||
UINT16 duration /* idle duration */
|
||||
);
|
||||
|
||||
STATUS usbHidProtocolSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */
|
||||
USBD_NODE_ID nodeId, /* desired node */
|
||||
UINT16 interface, /* desired interface */
|
||||
UINT16 protocol /* USB_HID_PROTOCOL_xxxx */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbLibh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
/* usbListLib.h - Linked list utility functions */
|
||||
|
||||
/* Copyright 2000, 2010 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01b,29apr10,pad Moved extern C statement after include statements.
|
||||
01a,10jun99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file defines a set of general-purpose linked-list functions which are
|
||||
portable across OS's.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbListLibh
|
||||
#define __INCusbListLibh
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/ossLib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* Arguments passed to the usbListLink/usbListLinkProt utility function. */
|
||||
|
||||
#define LINK_HEAD 0
|
||||
#define LINK_TAIL 1
|
||||
|
||||
/* Arguments passed to the usbListFind utility function. */
|
||||
|
||||
#define LINK_TEST 0
|
||||
#define LINK_REMOVE 1
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/*
|
||||
* LINK
|
||||
*
|
||||
* Linked-list management structure.
|
||||
*
|
||||
* NOTE: Code relies on the fact that LINK.linkFwd and LIST_HEAD.pLink are
|
||||
* both the first fields in their respective structures.
|
||||
*/
|
||||
|
||||
typedef struct link
|
||||
{
|
||||
struct link *linkFwd; /* Link to next entry */
|
||||
struct link *linkBack; /* Link to previous entry */
|
||||
pVOID pStruct; /* Points to base of structure being linked */
|
||||
} LINK, *pLINK;
|
||||
|
||||
/*
|
||||
* LIST_HEAD
|
||||
*
|
||||
* Defines the head of a linked list.
|
||||
*/
|
||||
|
||||
typedef struct list_head
|
||||
{
|
||||
pLINK pLink; /* Pointer to first entry on list */
|
||||
} LIST_HEAD, *pLIST_HEAD;
|
||||
|
||||
|
||||
/* Function prototypes. */
|
||||
|
||||
VOID usbListLink
|
||||
(
|
||||
pLIST_HEAD pHead, /* list head */
|
||||
pVOID pStruct, /* ptr to base of structure to be linked */
|
||||
pLINK pLink, /* ptr to LINK structure to be linked */
|
||||
UINT16 flag /* indicates LINK_HEAD or LINK_TAIL */
|
||||
);
|
||||
|
||||
VOID usbListLinkProt
|
||||
(
|
||||
pLIST_HEAD pHead, /* list head */
|
||||
pVOID pStruct, /* ptr to base of structure to be linked */
|
||||
pLINK pLink, /* ptr to LINK structure to be linked */
|
||||
UINT16 flag, /* indicates LINK_HEAD or LINK_TAIL */
|
||||
MUTEX_HANDLE mutex /* list guard mutex */
|
||||
);
|
||||
|
||||
|
||||
VOID usbListUnlink
|
||||
(
|
||||
pLINK pLink /* LINK structure to be unlinked */
|
||||
);
|
||||
|
||||
VOID usbListUnlinkProt
|
||||
(
|
||||
pLINK pLink, /* LINK structure to be unlinked */
|
||||
MUTEX_HANDLE mutex /* list guard mutex */
|
||||
);
|
||||
|
||||
pVOID usbListFirst
|
||||
(
|
||||
pLIST_HEAD pListHead /* head of linked list */
|
||||
);
|
||||
|
||||
pVOID usbListNext
|
||||
(
|
||||
pLINK pLink /* LINK structure */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbListLibh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/* usbMassStorage.h - Definitions for USB mass storage class */
|
||||
|
||||
/* Copyright 2000 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01a,14dec00,wef First.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbMassStorageh
|
||||
#define __INCusbMassStorageh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
|
||||
/* USB Command execution status codes */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
USB_COMMAND_SUCCESS = 0,
|
||||
USB_COMMAND_FAILED,
|
||||
USB_INVALID_CSW,
|
||||
USB_PHASE_ERROR,
|
||||
USB_IRP_FAILED,
|
||||
USB_DATA_INCOMPLETE,
|
||||
USB_BULK_IO_ERROR,
|
||||
USB_INTERNAL_ERROR
|
||||
} USB_COMMAND_STATUS;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbMassStorageh */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,748 @@
|
||||
/* usbOsal.h - USB OS Abstraction Layer Definitions */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003-2004, 2007, 2009-2014, 2017 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/* Copyright 2003-2004, 2007, 2009-2014, 2017 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01w,05dec17,whu Added extern C statement (VXW6-86542)
|
||||
01v,04dec14,wyy Clean compiler warning
|
||||
01u,15jun14,j_x Modified OS_LOCKED_DECREMENT and OS_LOCKED_INCREMENT (VXW6-80778)
|
||||
01t,03sep13,wyy Add macro OS_BUSY_WAIT_US and OS_BUSY_WAIT_MS to busy wait
|
||||
when rebooting (WIND00432482)
|
||||
01s,19jul12,w_x Add support for USB 3.0 host (WIND00188662)
|
||||
01r,10aug11,ljg Increase the max number of HCI Controllers (WIND00286762)
|
||||
01q,01aug11,ghs Fix VxWorks version check macro (WIND00287708)
|
||||
01p,07sep10,ghs Add MHCD max count.
|
||||
01o,02sep10,ghs Use OS_THREAD_FAILURE to check taskSpawn failure (WIND00229830)
|
||||
01n,22jun10,ghs Change macro OS_CREATE_THREAD(WIND00218930)
|
||||
01m,18may10,w_x USB transition to vxbDmaBufLib supporting 64 bit (WIND00193267)
|
||||
01l,20mar10,y_l Changed for defect (WIND00196728)
|
||||
01k,15mar10,j_x Changed for USB debug (WIND00184542)
|
||||
01j,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01j,03dec09,m_y Move the max synopsys hcd define into this file.
|
||||
01i,11sep09,ghs Add global max hcd defines(WIND00152418)
|
||||
01h,29jun09,ghs Add USB_VXB_VERSIONID for usb (WIND00172037)
|
||||
01g,18mar09,j_x Fix timing bug in OS_DELAY_MS()(WIND00155914)
|
||||
01f,10jul07,jrp Removing OS_ENTER_CRITICAL_SECTION
|
||||
01e,26oct04,ami Debug Messages Changes
|
||||
01d,06oct04,ami SPR #94684 Fix
|
||||
01c,02jun04,hch remove duplicate definition of TRUE and FALSE macros
|
||||
01b,09may04,dat add parens around TRUE and FALSE.
|
||||
01a,17mar03,ssh written
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file contains the definitions of the OS Abstraction Layer for the USB2.0
|
||||
Host Stack core code
|
||||
*/
|
||||
|
||||
/*
|
||||
INTERNAL
|
||||
*******************************************************************************
|
||||
* Filename : OSAL.h
|
||||
*
|
||||
* Copyright :
|
||||
*
|
||||
* THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO
|
||||
* LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING
|
||||
* ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE
|
||||
* 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY
|
||||
* ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY
|
||||
* PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE
|
||||
* ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL.
|
||||
* THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF
|
||||
* THIS COPYRIGHT AS PER APPLICABLE LAWS.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Description : OS Abstraction layer (OSAL) - for VxWorks 5.4.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __USBOSAL_H__
|
||||
#define __USBOSAL_H__
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <logLib.h> /* For error logging */
|
||||
#include <assert.h>
|
||||
#include <semLib.h> /* For semaphores */
|
||||
#include <taskLib.h> /* For task */
|
||||
#include <string.h> /* For memset(), memcpy() */
|
||||
#include <intLib.h> /* For intLock() */
|
||||
#include <sysLib.h> /* For sysClkRateGet(), etc */
|
||||
#include <stdio.h> /* For printf() and scanf() support */
|
||||
#include <wdLib.h> /* For watch dog timers */
|
||||
#include <math.h> /* For using floor() */
|
||||
#include <vxAtomicLib.h> /* Atomic increment/decrement */
|
||||
#include <usb/usbPlatform.h>
|
||||
#include <usb/ossLib.h> /* os specific services */
|
||||
#include <usb/usbQueueLib.h>
|
||||
#include <usb/usbListLib.h>
|
||||
#include "hwif/vxbus/vxBus.h"
|
||||
#include <vxbTimerLib.h>
|
||||
|
||||
#include "usbOsalDebug.h" /* For module level message logging support */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* To define a structure with the packed attribute */
|
||||
#define OS_STRUCT_PACKED __attribute__((__packed__))
|
||||
|
||||
/* Define usb vxBus version number */
|
||||
|
||||
#ifndef VXB_VER_4_0_0
|
||||
#define USB_VXB_VERSIONID VXBUS_VERSION_3
|
||||
#else
|
||||
#define USB_VXB_VERSIONID VXB_VER_5_0_0
|
||||
#endif
|
||||
|
||||
#define USB_MAX_HOSTS_PER_HCD 20 /* max number of host Controllers per HCD */
|
||||
#define USB_MAX_UHCI_COUNT 20 /* max number of UHCI Controllers */
|
||||
#define USB_MAX_OHCI_COUNT 20 /* max number of OHCI Controllers */
|
||||
#define USB_MAX_EHCI_COUNT 20 /* max number of EHCI Controllers */
|
||||
#define USB_MAX_SYNOPSYSHCI_COUNT 5 /* max number of Synopsys HCI
|
||||
* Controllers
|
||||
*/
|
||||
#define USB_MAX_MHCI_COUNT 5 /* max number of MHCI Controllers */
|
||||
|
||||
/* Just in case anyone else has redefined BOOLEAN */
|
||||
#ifdef BOOLEAN
|
||||
#undef BOOLEAN
|
||||
#endif
|
||||
|
||||
/* To hold a boolean variable */
|
||||
typedef UINT8 BOOLEAN;
|
||||
|
||||
/* To hold a pointer to UINT8 */
|
||||
typedef UINT8 *PUINT8;
|
||||
|
||||
|
||||
/* To hold a pointer to UINT16 */
|
||||
typedef UINT16 *PUINT16;
|
||||
|
||||
/* To hold a pointer to UINT32 */
|
||||
typedef UINT32 *PUINT32;
|
||||
|
||||
/* To hold a pointer to an UCHAR */
|
||||
typedef UCHAR *PUCHAR;
|
||||
|
||||
/* To hold the type definition for void and pointer to void */
|
||||
typedef VOID *PVOID;
|
||||
|
||||
/************************* MACROS FOR PRINTF AND SCANF ************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_PRINTF
|
||||
* DESCRIPTION : Macro to print a text.
|
||||
*
|
||||
* NOTE: Avoid using this macro in the code. This should be
|
||||
* used only for diagnostics.
|
||||
*
|
||||
* PARAMETERS : None
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_PRINTF(FORMAT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
|
||||
printf(FORMAT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 )
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_SCANF
|
||||
* DESCRIPTION : Macro to obtain inputs from the user.
|
||||
*
|
||||
* NOTE: Avoid using this macro in the code. This should be
|
||||
* used only for diagnostics.
|
||||
*
|
||||
* PARAMETERS : None
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_SCANF(FORMAT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
|
||||
scanf(FORMAT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6)
|
||||
|
||||
|
||||
/****************************** MACROS FOR ASSERT *****************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_ASSERT
|
||||
* DESCRIPTION : Macro for asserting the program execution. This is used to
|
||||
* identify invalid conditions.
|
||||
*
|
||||
* NOTE: This macro will be enabled only for debug mode.
|
||||
* PARAMETERS : BOOLEAN_EXPRESSION IN Boolean expression.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#ifdef DEBUG
|
||||
#define OS_ASSERT(BOOLEAN_EXPRESSION) \
|
||||
assert(BOOLEAN_EXPRESSION)
|
||||
#else
|
||||
#define OS_ASSERT(BOOLEAN_EXPRESSION)
|
||||
#endif /* End of #ifdef DEBUG */
|
||||
|
||||
|
||||
/*********************** MACROS FOR MEMORY OPERATION **************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_MEMPOOL_INIT
|
||||
* DESCRIPTION : Initialize memory pool information.
|
||||
* PARAMETERS : NONE.
|
||||
* RETURN TYPE : OK
|
||||
******************************************************************************/
|
||||
#define OS_MEMPOOL_INIT() \
|
||||
ossInitialize()
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_MALLOC
|
||||
* DESCRIPTION : Macro to allocate memory.
|
||||
* PARAMETERS : MEMORY_SIZE IN Size of memory to be allocated.
|
||||
* RETURN TYPE : On success, returns the pointer to the memory. Else returns
|
||||
* NULL.
|
||||
******************************************************************************/
|
||||
#define OS_MALLOC(MEMORY_SIZE) \
|
||||
OSS_MALLOC(MEMORY_SIZE)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_FREE
|
||||
* DESCRIPTION : Macro to release the specified memory.
|
||||
* PARAMETERS : MEMORY_POINTER IN Pointer to the memory to be released.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_FREE(MEMORY_POINTER) \
|
||||
OSS_FREE(MEMORY_POINTER)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_MEMSET
|
||||
* DESCRIPTION : Macro to initialize the memory with the specified value.
|
||||
* PARAMETERS : SRC_POINTER IN Pointer to the source memory location.
|
||||
* VALUE IN Value to be assigned to the memory location.
|
||||
* LENGTH IN Number of bytes to be copied.
|
||||
* RETURN TYPE : Returns the number of bytes copied.
|
||||
******************************************************************************/
|
||||
#define OS_MEMSET(SRC_POINTER, VALUE, LENGTH) \
|
||||
memset(SRC_POINTER, VALUE, (size_t)(LENGTH))
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_MEMCPY
|
||||
* DESCRIPTION : Macro to copy the memory from the source to the destination.
|
||||
* PARAMETERS : DST_POINTER IN Pointer to the destination memory location.
|
||||
* SRC_POINTER IN Pointer to the source memory location.
|
||||
* LENGTH IN Number of bytes to be copied.
|
||||
* RETURN TYPE : Returns the number of bytes copied.
|
||||
******************************************************************************/
|
||||
#define OS_MEMCPY(DST_POINTER, SRC_POINTER, LENGTH) \
|
||||
memcpy(DST_POINTER, SRC_POINTER, LENGTH)
|
||||
|
||||
|
||||
/************************* MACROS FOR STRING OPERATION ************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_STRLEN
|
||||
* DESCRIPTION : Macro to obtain the length of a null terminated string.
|
||||
* PARAMETERS : STRING IN Pointer to the string.
|
||||
* RETURN TYPE : Returns the length of the string.
|
||||
******************************************************************************/
|
||||
/* To obtain the length of the string */
|
||||
#define OS_STRLEN(STRING) \
|
||||
strlen(STRING)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_STRCPY
|
||||
* DESCRIPTION : Macro to copy the source string into the destination string.
|
||||
* PARAMETERS : DST OUT Pointer to the destination string.
|
||||
* SRC IN Pointer to the source string.
|
||||
* RETURN TYPE : Returns the length of the string.
|
||||
******************************************************************************/
|
||||
#define OS_STRCPY(DST, SRC) \
|
||||
strcpy(DST, SRC)
|
||||
|
||||
|
||||
|
||||
/************************* MACROS FOR USING EVENTS ****************************/
|
||||
|
||||
/* To hold the Event ID */
|
||||
#define OS_EVENT_ID SEM_ID
|
||||
|
||||
/* To hold the invalid Event ID */
|
||||
#define OS_INVALID_EVENT_ID NULL
|
||||
|
||||
/* To create an event in signaled state */
|
||||
#define OS_EVENT_SIGNALED SEM_FULL
|
||||
|
||||
/* To create an event in non signaled state */
|
||||
#define OS_EVENT_NON_SIGNALED SEM_EMPTY
|
||||
|
||||
/* To wait infinitely for an event to become available */
|
||||
#define OS_WAIT_INFINITE WAIT_FOREVER
|
||||
|
||||
/* To come out immediately without waiting for an event to become available */
|
||||
#define OS_NO_WAIT NO_WAIT
|
||||
|
||||
/* Macro to indicate the OS_WAIT_FOR_EVENT returned with a timeout */
|
||||
#define OS_WAIT_TIMEOUT ERROR
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_CREATE_EVENT
|
||||
* DESCRIPTION : Macro to create an event.
|
||||
*
|
||||
* The VxWorks Mutual Exclusion Semaphore is created. The
|
||||
* semBCreate() function allocates memory for the mutual
|
||||
* exclusion semaphore and initializes the semaphore.
|
||||
*
|
||||
* PARAMETERS : INITIAL_EVENT_STATE IN Initial state of the event.
|
||||
*
|
||||
* Use OS_EVENT_SIGNALED to create
|
||||
* an in signaled state.
|
||||
*
|
||||
* Use OS_EVENT_NON_SIGNALED to
|
||||
* create an in non signaled state.
|
||||
*
|
||||
* RETURN TYPE : On success, returns the OS_EVENT_ID corresponding to the
|
||||
* mutual exclustion semaphore. Else returns NULL.
|
||||
******************************************************************************/
|
||||
#define OS_CREATE_EVENT(INITIAL_EVENT_STATE) \
|
||||
semBCreate(SEM_Q_PRIORITY, INITIAL_EVENT_STATE)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_DESTROY_EVENT
|
||||
* DESCRIPTION : Macro to destroy an event.
|
||||
*
|
||||
* NOTE: The semDelete() call terminates a semaphore and
|
||||
* deallocates any associated memory. When deleting event,
|
||||
* first obtain the event by calling OS_WAIT_FOR_EVENT() and
|
||||
* then delete the event. This ensure that the event is not
|
||||
* released when some other task is still using the event.
|
||||
* PARAMETERS : EVENT_ID IN Event ID corresponding to the event to be
|
||||
* destroyed.
|
||||
* RETURN TYPE : Returns the OS_EVENT_ID corresponding to the mutual
|
||||
* exclustion semaphore.
|
||||
******************************************************************************/
|
||||
#define OS_DESTROY_EVENT(EVENT_ID) \
|
||||
(void) semDelete(EVENT_ID)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_WAIT_FOR_EVENT
|
||||
* DESCRIPTION : Macro to wait for an event.
|
||||
* PARAMETERS : EVENT_ID IN Event ID corresponding to the event for
|
||||
* which to wait.
|
||||
* WAIT_VALUE IN Amount of time to wait.
|
||||
*
|
||||
* To wait infinitely, use the macro
|
||||
* OS_WAIT_INFINITE.
|
||||
*
|
||||
* To come out immediately without waiting,
|
||||
* use the macro OS_NO_WAIT.
|
||||
*
|
||||
* To wait for a specified number of milli
|
||||
* seconds, use macro
|
||||
* OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE()
|
||||
* with the parameter specifing the required
|
||||
* milli second.
|
||||
*
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_WAIT_FOR_EVENT(EVENT_ID, WAIT_VALUE) \
|
||||
semTake(EVENT_ID, WAIT_VALUE)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_RELEASE_EVENT
|
||||
* DESCRIPTION : Macro to release an event.
|
||||
* PARAMETERS : EVENT_ID IN Event ID corresponding to the event to be
|
||||
* released.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_RELEASE_EVENT(EVENT_ID) \
|
||||
(void) semGive(EVENT_ID)
|
||||
|
||||
/************************* MACROS FOR USING DELAYS ****************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE
|
||||
* DESCRIPTION : Macro to convert the specified duration parameter in milli
|
||||
* seconds into the number of ticks.
|
||||
*
|
||||
* In order to compute the number of ticks corresponding to the
|
||||
* number of milli seconds specified, the following logic is
|
||||
* used:
|
||||
*
|
||||
* a) Call the sysClkRateGet() function to obtain the number
|
||||
* number of ticks per second.
|
||||
* b) Compute the number of ticks for the specified number of
|
||||
* milli seconds.
|
||||
* c) If the required millisecond cannot be supported, 1 tick
|
||||
* of delay will be introduced.
|
||||
*
|
||||
* PARAMETERS : DURATION IN Duration in milli seconds.
|
||||
* RETURN TYPE : Returns the number of ticks.
|
||||
******************************************************************************/
|
||||
#define OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE(DURATION) \
|
||||
((DURATION == WAIT_FOREVER) ? WAIT_FOREVER : \
|
||||
(0 == ((sysClkRateGet() * DURATION) / 1000) ? 2 : \
|
||||
(((sysClkRateGet() * DURATION) / 1000)+1)))
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_DELAY_MS
|
||||
* DESCRIPTION : Macro to introduce a delay in milli seconds.
|
||||
*
|
||||
* The taskDelay() function is used to introduce the delay.
|
||||
* The taskDelay() function takes the delay in number of ticks.
|
||||
* PARAMETERS : DELAY_INTERVAL IN Specifies the delay interval in milli
|
||||
* seconds.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_DELAY_MS(DELAY_INTERVAL) \
|
||||
(void) taskDelay(OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE(DELAY_INTERVAL))
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_BUSY_WAIT_MS
|
||||
* DESCRIPTION : Macro to introduce a busy wait in milli seconds.
|
||||
* The vxbMsDelay() function is used to introduce the delay.
|
||||
*
|
||||
* PARAMETERS : DELAY_INTERVAL IN Specifies the delay interval in milli
|
||||
* seconds.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_BUSY_WAIT_MS(DELAY_INTERVAL) \
|
||||
vxbMsDelay(DELAY_INTERVAL)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_BUSY_WAIT_US
|
||||
* DESCRIPTION : Macro to introduce a busy wait in micro seconds.
|
||||
* The vxbUsDelay() function is used to introduce the delay.
|
||||
*
|
||||
* PARAMETERS : DELAY_INTERVAL IN Specifies the delay interval in micro
|
||||
* seconds.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_BUSY_WAIT_US(DELAY_INTERVAL) \
|
||||
vxbUsDelay(DELAY_INTERVAL)
|
||||
|
||||
|
||||
/************************ MACROS FOR USING THREADS ****************************/
|
||||
|
||||
/* To hold the thread ID */
|
||||
#define OS_THREAD_ID TASK_ID
|
||||
|
||||
/* To hold the thread options */
|
||||
#define OS_THREAD_OPTIONS 0
|
||||
|
||||
/* To hold the stack size of the thread */
|
||||
#define OS_THREAD_STACK_SIZE 4096 << 1
|
||||
|
||||
/* To hold the value returned when a thread operation fails */
|
||||
#if (_WRS_VXWORKS_MAJOR > 6) || \
|
||||
((_WRS_VXWORKS_MAJOR == 6) && (_WRS_VXWORKS_MINOR >= 9))
|
||||
#define OS_THREAD_FAILURE TASK_ID_ERROR
|
||||
#else
|
||||
#define OS_THREAD_FAILURE ERROR
|
||||
#endif
|
||||
|
||||
/* To hold the value returned when a thread operation is successful */
|
||||
#define OS_THREAD_SUCCESS OK
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_CREATE_THREAD
|
||||
* DESCRIPTION : Macro to create a thread.
|
||||
* PARAMETERS : NAME IN Name of the task.
|
||||
* PRIORITY IN Priority of the task. Tasks may have
|
||||
* priorities ranging from 0 (the highest
|
||||
* priority), to 255 (the lowest priority).
|
||||
* ENTRY_POINT IN Entry point for the task.
|
||||
* ARGS IN Arguments to be passed to the task.
|
||||
* Only one argument can be passed to the task.
|
||||
*
|
||||
* NOTE: Even though VxWorks allows upto 10 parameters to be
|
||||
* passed to the task, this macro takes only one argument.
|
||||
* If there are more than one argument, pass them in a
|
||||
* structure.
|
||||
*
|
||||
* RETURN TYPE : On success, returns the OS_THREAD_ID corresponding to the
|
||||
* thread. Else return OS_THREAD_FAILURE.
|
||||
******************************************************************************/
|
||||
#define OS_CREATE_THREAD(NAME, PRIORITY, ENTRY_POINT, ARGUMENT) \
|
||||
taskSpawn(NAME, \
|
||||
PRIORITY, \
|
||||
OS_THREAD_OPTIONS, \
|
||||
OS_THREAD_STACK_SIZE, \
|
||||
(FUNCPTR)ENTRY_POINT, \
|
||||
(_Vx_usr_arg_t)ARGUMENT, \
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
0)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_DESTROY_THREAD
|
||||
* DESCRIPTION : Macro to destroy a thread.
|
||||
* PARAMETERS : THREAD_ID IN Thread ID corresponding to the thread to be
|
||||
* deleted.
|
||||
* RETURN TYPE : On success, returns OS_THREAD_SUCCESS. Else returns
|
||||
* OS_THREAD_FAILURE.
|
||||
******************************************************************************/
|
||||
#define OS_DESTROY_THREAD(THREAD_ID) \
|
||||
(void) taskDelete((TASK_ID)(THREAD_ID))
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_RESCHEDULE_THREAD
|
||||
* DESCRIPTION : Macro to manually reschedule the thread. This macro allows
|
||||
* the other threads in the schedule queue to execute.
|
||||
* PARAMETERS : None
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_RESCHEDULE_THREAD() \
|
||||
(void) taskDelay(1)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_GET_THREAD_PRIORITY
|
||||
* DESCRIPTION : Macro to obtain the priority of the thread..
|
||||
* PARAMETERS : THREAD_PRIORITY OUT Variable to hold the priority of the
|
||||
* thread. Tasks may have priorities
|
||||
* ranging from 0 (the highest priority),
|
||||
* to 255 (the lowest priority).
|
||||
* ENTRY_POINT IN Entry point for the task.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_GET_THREAD_PRIORITY(THREAD_PRIORITY) \
|
||||
taskPriorityGet(taskIdSelf(), (THREAD_PRIORITY))
|
||||
|
||||
|
||||
/****************** MACROS FOR USING DEFERRED PROCEDURE CALLS *****************/
|
||||
|
||||
/* To hold deferred procedure call (DPC) ID */
|
||||
#define OS_DPC_ID WDOG_ID
|
||||
|
||||
/* To hold the status of a DPC operation */
|
||||
#define OS_DPC_STATUS STATUS
|
||||
|
||||
/* To hold the value returned when a DPC operation fails */
|
||||
#define OS_DPC_FAILURE ERROR
|
||||
|
||||
/* To hold the value returned when a DPC operation is successful */
|
||||
#define OS_DPC_SUCCESS OK
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_CREATE_DPC
|
||||
* DESCRIPTION : Macro to create a deferred procedure call.
|
||||
* PARAMETERS : None.
|
||||
* RETURN TYPE : On success returns OS_DPC_ID. Else returns NULL
|
||||
******************************************************************************/
|
||||
#define OS_CREATE_DPC() \
|
||||
wdCreate()
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_DESTROY_DPC
|
||||
* DESCRIPTION : Macro to destroy a deferred procedure call.
|
||||
* PARAMETERS : DPC_ID IN Specifies the DPC ID.
|
||||
* RETURN TYPE : On success returns OS_DPC_SUCCESS. Else returns
|
||||
* OS_DPC_FAILURE.
|
||||
******************************************************************************/
|
||||
#define OS_DESTROY_DPC(DPC_ID) \
|
||||
wdDelete(DPC_ID)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_START_DPC
|
||||
* DESCRIPTION : Macro to start a deferred procedure call.
|
||||
* PARAMETERS : DPC_ID IN Specifies the DPC ID.
|
||||
* DELAY IN Delay count, in ticks.
|
||||
* DPC_FUNCTION IN Routine to call on time out.
|
||||
* DPC_PARAMETER IN Parameter to be passed to the DPC
|
||||
* routine.
|
||||
* RETURN TYPE : On success returns OS_DPC_SUCCESS. Else returns
|
||||
* OS_DPC_FAILURE.
|
||||
******************************************************************************/
|
||||
#define OS_START_DPC(DPC_ID, DELAY, DPC_FUNCTION, DPC_PARAMETER) \
|
||||
wdStart(DPC_ID, DELAY, (FUNCPTR)DPC_FUNCTION, DPC_PARAMETER)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_CANCEL_DPC
|
||||
* DESCRIPTION : Macro to cancel a deferred procedure call.
|
||||
* PARAMETERS : DPC_ID IN Specifies the DPC ID.
|
||||
* RETURN TYPE : On success returns OS_DPC_SUCCESS. Else returns
|
||||
* OS_DPC_FAILURE.
|
||||
******************************************************************************/
|
||||
#define OS_CANCEL_DPC(DPC_ID) \
|
||||
wdCancel(DPC_ID)
|
||||
|
||||
|
||||
/****************** MACROS FOR LOCKED INCREMENT OR DECREMENT ******************/
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_LOCKED_DECREMENT
|
||||
* DESCRIPTION : Macro to decrement a variable safely.
|
||||
*
|
||||
* NOTE: This macro should be used only when the race condition
|
||||
* with the ISR.
|
||||
*
|
||||
* PARAMETERS : VARIABLE IN Variable to be decremented.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_LOCKED_DECREMENT(VARIABLE) vxAtomicDec (&VARIABLE);
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_LOCKED_INCREMENT
|
||||
* DESCRIPTION : Macro to increment a variable safely.
|
||||
*
|
||||
* NOTE: This macro should be used only when the race condition
|
||||
* with the ISR.
|
||||
*
|
||||
* PARAMETERS : VARIABLE IN Variable to be incremented.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_LOCKED_INCREMENT(VARIABLE) vxAtomicInc (&VARIABLE);
|
||||
|
||||
|
||||
/********************** MACROS FOR HANDLING ENDIANESS *************************/
|
||||
|
||||
#if (_BYTE_ORDER == _BIG_ENDIAN)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_UINT32_CPU_TO_LE
|
||||
* DESCRIPTION : Macro to convert an 32 bit integer from CPU format to the
|
||||
* little endian format.
|
||||
* PARAMETERS : DATA IN Data to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
|
||||
#define OS_UINT32_CPU_TO_LE(DATA) \
|
||||
(((DATA & 0xFF) << 24) | \
|
||||
(((DATA >> 8) & 0xFF) << 16) | \
|
||||
(((DATA >> 16) & 0xFF) << 8) | \
|
||||
((DATA >> 24) & 0xFF))
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_UINT32_LE_TO_CPU
|
||||
* DESCRIPTION : Macro to convert an 32 bit integer from little endian format
|
||||
* to the CPU format.
|
||||
* PARAMETERS : DATA IN Data to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_UINT32_LE_TO_CPU(DATA) \
|
||||
(((DATA & 0xFF) << 24) | \
|
||||
(((DATA >> 8) & 0xFF) << 16) | \
|
||||
(((DATA >> 16) & 0xFF) << 8) | \
|
||||
((DATA >> 24) & 0xFF))
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_UINT16_LE_TO_CPU
|
||||
* DESCRIPTION : Macro to convert an 16 bit integer from little endian format
|
||||
* to the CPU format.
|
||||
* PARAMETERS : DATA IN Data to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_UINT16_LE_TO_CPU(DATA) \
|
||||
((((DATA >> 8) & 0xFF) | ((DATA & 0xFF) << 8)))
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_UINT16_CPU_TO_LE
|
||||
* DESCRIPTION : Macro to convert an 16 bit integer from CPU format to the
|
||||
* little endian format.
|
||||
* PARAMETERS : DATA IN Data to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_UINT16_CPU_TO_LE(DATA) \
|
||||
((((DATA >> 8) & 0xFF) | ((DATA & 0xFF) << 8)))
|
||||
|
||||
#define OS_BUFFER_CPU_TO_LE(BUFFER, LENGTH)
|
||||
|
||||
#define OS_BUFFER_LE_TO_CPU(BUFFER, LENGTH)
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Macros for handling the endianess on little endian
|
||||
* systems
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_BUFFER_LE_TO_CPU
|
||||
* DESCRIPTION : Macro to convert a buffer from little endian format to the
|
||||
* CPU format.
|
||||
* PARAMETERS : BUFFER IN Pointer to the buffer location.
|
||||
* LENGTH IN Number of bytes to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_BUFFER_LE_TO_CPU(BUFFER, LENGTH)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_BUFFER_CPU_TO_LE
|
||||
* DESCRIPTION : Macro to convert a buffer from CPU format to the little
|
||||
* endian format .
|
||||
* PARAMETERS : BUFFER IN Pointer to the buffer location.
|
||||
* LENGTH IN Number of bytes to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_BUFFER_CPU_TO_LE(BUFFER, LENGTH)
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_UINT16_LE_TO_CPU
|
||||
* DESCRIPTION : Macro to convert an 16 bit integer from little endian format
|
||||
* to the CPU format.
|
||||
* PARAMETERS : DATA IN Data to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_UINT16_LE_TO_CPU(DATA) \
|
||||
DATA
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_UINT16_CPU_TO_LE
|
||||
* DESCRIPTION : Macro to convert an 16 bit integer from CPU format to the
|
||||
* little endian format.
|
||||
* PARAMETERS : DATA IN Data to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_UINT16_CPU_TO_LE(DATA) \
|
||||
DATA
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_UINT32_LE_TO_CPU
|
||||
* DESCRIPTION : Macro to convert an 32 bit integer from little endian format
|
||||
* to the CPU format.
|
||||
* PARAMETERS : DATA IN Data to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_UINT32_LE_TO_CPU(DATA) \
|
||||
DATA
|
||||
|
||||
/*******************************************************************************
|
||||
* MACRO NAME : OS_UINT32_CPU_TO_LE
|
||||
* DESCRIPTION : Macro to convert an 32 bit integer from CPU format to the
|
||||
* little endian format.
|
||||
* PARAMETERS : DATA IN Data to be converted.
|
||||
* RETURN TYPE : None
|
||||
******************************************************************************/
|
||||
#define OS_UINT32_CPU_TO_LE(DATA) \
|
||||
DATA
|
||||
|
||||
|
||||
#endif /* End of #if (_BYTE_ORDER != _BIG_ENDIAN) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* End of __OSAL_H__ */
|
||||
|
||||
/****************************** End of File OSAL.h ****************************/
|
||||
|
||||
@@ -0,0 +1,774 @@
|
||||
/* usbOsalDebug.h - USB OS Abstraction Layer Debug Definitions */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2010-2013, 2017 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/* Copyright 2003, 2010-2013, 2017 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01q,05dec17,whu Added extern C statement (VXW6-86542)
|
||||
01p,06jan13,s_z Redefine debug level using bitmap (WIND00371346)
|
||||
01o,18may12,s_z Add support for PLX USB 3.0 TCD support (WIND00188662)
|
||||
01n,19jul12,w_x Add support for USB 3.0 host (WIND00188662)
|
||||
01m,12mar12,ljg Modify debug messages (WIND00334460)
|
||||
01l,22apr11,ljg Add USBTGT printer and USBTGT keyboard emulators debug support
|
||||
01k,13feb11,s_z Initial USB network function driver debug support
|
||||
01j,29jan11,ghs Add USB target serial emulator debug
|
||||
01i,13jan11,w_x Initial USB OTG support changes (WIND00211541)
|
||||
01h,26sep10,ghs Disable debug messages for default configuration (WIND00234470)
|
||||
01g,07sep10,ghs Defined MHCD debug components
|
||||
01f,08jul10,m_y Add synopsys hcd debug
|
||||
01e,10jun10,ghs Add usb serial debug
|
||||
01d,27apr10,j_x Error debug adaption
|
||||
01c,08apr10,jpb Added header file for logLib.h.
|
||||
01b,03mar10,j_x Changed for USB debug (WIND00184542)
|
||||
01a,17mar03,ssh written
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file contains the definitions the debugging macros for the OS Abstraction
|
||||
Layer
|
||||
*/
|
||||
|
||||
/*
|
||||
INTERNAL
|
||||
*******************************************************************************
|
||||
* Filename : OSAL_DEBUG.h
|
||||
*
|
||||
* Copyright :
|
||||
*
|
||||
* THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO
|
||||
* LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING
|
||||
* ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE
|
||||
* 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY
|
||||
* ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY
|
||||
* PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE
|
||||
* ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL.
|
||||
* THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF
|
||||
* THIS COPYRIGHT AS PER APPLICABLE LAWS.
|
||||
*
|
||||
*
|
||||
* Description : OS Abstraction layer debugging support. This file contains
|
||||
* the macros to enable or disable the debugging support on
|
||||
* a module basis.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INCusbOsalDebugh
|
||||
#define __INCusbOsalDebugh
|
||||
|
||||
#include <vsbConfig.h>
|
||||
|
||||
#ifdef USB_DEBUG_ENABLE
|
||||
#include <logLib.h> /* _func_logMsg */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dynamic debug
|
||||
*/
|
||||
|
||||
#define USB_NONE_DEBUG 0 /* Show NONE msgs */
|
||||
#define USB_INFO_DEBUG (0x01 << 0) /* Show INFO msgs */
|
||||
#define USB_ERROR_DEBUG (0x01 << 1) /* Show ERROR msgs */
|
||||
#define USB_WARNING_DEBUG (0x01 << 2) /* Show WARNING msgs */
|
||||
#define USB_NORMAL_DEBUG (0x01 << 3) /* Show NORMAL msgs */
|
||||
#define USB_VERBOSE_DEBUG (0x01 << 4) /* Show VERBOSE msgs */
|
||||
|
||||
#ifdef USB_DEBUG_ENABLE
|
||||
|
||||
#define USB_DBG_INT2SYM(x) #x
|
||||
#define USB_DBG_INT2STR(x) USB_DBG_INT2SYM(x)
|
||||
#define USB_DBG_LOCATION __FILE__"["USB_DBG_INT2STR(__LINE__)"]: "
|
||||
|
||||
#define USB_ERR(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
do { \
|
||||
if (((class##Debug) & USB_ERROR_DEBUG) && \
|
||||
(_func_logMsg != NULL)) \
|
||||
{ \
|
||||
_func_logMsg( \
|
||||
"ERROR: "#class" - "USB_DBG_LOCATION fmt, \
|
||||
(_Vx_usr_arg_t)(arg1), \
|
||||
(_Vx_usr_arg_t)(arg2), \
|
||||
(_Vx_usr_arg_t)(arg3), \
|
||||
(_Vx_usr_arg_t)(arg4), \
|
||||
(_Vx_usr_arg_t)(arg5), \
|
||||
(_Vx_usr_arg_t)(arg6)); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
#define USB_WARN(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
do { \
|
||||
if (((class##Debug) & USB_WARNING_DEBUG) && \
|
||||
(_func_logMsg != NULL)) \
|
||||
{ \
|
||||
_func_logMsg("WARN: "#class" - "fmt, \
|
||||
(_Vx_usr_arg_t)(arg1), \
|
||||
(_Vx_usr_arg_t)(arg2), \
|
||||
(_Vx_usr_arg_t)(arg3), \
|
||||
(_Vx_usr_arg_t)(arg4), \
|
||||
(_Vx_usr_arg_t)(arg5), \
|
||||
(_Vx_usr_arg_t)(arg6)); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
#define USB_DBG(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
do { \
|
||||
if (((class##Debug) & USB_NORMAL_DEBUG) && \
|
||||
(_func_logMsg != NULL)) \
|
||||
{ \
|
||||
_func_logMsg("DBG: "#class" - "fmt, \
|
||||
(_Vx_usr_arg_t)(arg1), \
|
||||
(_Vx_usr_arg_t)(arg2), \
|
||||
(_Vx_usr_arg_t)(arg3), \
|
||||
(_Vx_usr_arg_t)(arg4), \
|
||||
(_Vx_usr_arg_t)(arg5), \
|
||||
(_Vx_usr_arg_t)(arg6)); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
#define USB_VDBG(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6)\
|
||||
do { \
|
||||
if (((class##Debug) & USB_VERBOSE_DEBUG) && \
|
||||
(_func_logMsg != NULL)) \
|
||||
{ \
|
||||
_func_logMsg("VDBG: "#class" - "fmt, \
|
||||
(_Vx_usr_arg_t)(arg1), \
|
||||
(_Vx_usr_arg_t)(arg2), \
|
||||
(_Vx_usr_arg_t)(arg3), \
|
||||
(_Vx_usr_arg_t)(arg4), \
|
||||
(_Vx_usr_arg_t)(arg5), \
|
||||
(_Vx_usr_arg_t)(arg6)); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
#define USB_INFO(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
do { \
|
||||
if (((class##Debug) & USB_INFO_DEBUG) && \
|
||||
(_func_logMsg != NULL)) \
|
||||
{ \
|
||||
_func_logMsg("INFO: "#class" - "fmt, \
|
||||
(_Vx_usr_arg_t)(arg1), \
|
||||
(_Vx_usr_arg_t)(arg2), \
|
||||
(_Vx_usr_arg_t)(arg3), \
|
||||
(_Vx_usr_arg_t)(arg4), \
|
||||
(_Vx_usr_arg_t)(arg5), \
|
||||
(_Vx_usr_arg_t)(arg6)); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
#else
|
||||
|
||||
#define USB_ERR(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
#define USB_DBG(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
#define USB_VDBG(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
#define USB_INFO(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
#define USB_WARN(class, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#endif
|
||||
|
||||
/* XHCD DEBUG */
|
||||
|
||||
#define USB_XHCD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbXhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_XHCD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbXhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_XHCD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbXhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_XHCD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbXhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_XHCD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbXhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* EHCD DEBUG */
|
||||
|
||||
#define USB_EHCD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbEhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_EHCD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbEhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_EHCD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbEhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_EHCD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbEhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_EHCD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbEhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* OHCD DEBUG */
|
||||
|
||||
#define USB_OHCD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbOhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_OHCD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbOhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_OHCD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbOhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_OHCD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbOhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_OHCD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbOhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* UHCD DEBUG */
|
||||
|
||||
#define USB_UHCD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbUhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_UHCD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbUhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_UHCD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbUhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_UHCD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbUhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_UHCD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbUhcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* SYNOPSYSHCD DEBUG */
|
||||
|
||||
#define USB_SHCD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbShcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_SHCD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbShcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_SHCD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbShcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_SHCD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbShcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_SHCD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbShcd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* MHDRC DEBUG */
|
||||
|
||||
#define USB_MHDRC_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbMhdrc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_MHDRC_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbMhdrc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_MHDRC_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbMhdrc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_MHDRC_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbMhdrc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_MHDRC_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbMhdrc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
|
||||
/* USBD DEBUG */
|
||||
|
||||
#define USB_USBD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbUsbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_USBD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbUsbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_USBD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbUsbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_USBD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbUsbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_USBD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbUsbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* TU DEBUG */
|
||||
|
||||
#define USB_TU_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbTu, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_TU_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbTu, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_TU_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbTu, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_TU_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbTu, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_TU_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbTu, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* HUB DEBUG */
|
||||
|
||||
#define USB_HUB_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbHub, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_HUB_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbHub, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_HUB_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbHub, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_HUB_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbHub, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_HUB_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbHub, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* OTG DEBUG */
|
||||
|
||||
#define USBOTG_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbOtg, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBOTG_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbOtg, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBOTG_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbOtg, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBOTG_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbOtg, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBOTG_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbOtg, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN1 BULK DEBUG */
|
||||
|
||||
#define USB1_BLK_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb1Blk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_BLK_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb1Blk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_BLK_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb1Blk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_BLK_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb1Blk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_BLK_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb1Blk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN1 CBI DEBUG */
|
||||
|
||||
#define USB1_CBI_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb1Cbi, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_CBI_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb1Cbi, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_CBI_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb1Cbi, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_CBI_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb1Cbi, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_CBI_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb1Cbi, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN1 KEYBOARD DEBUG */
|
||||
|
||||
#define USB1_KBD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb1Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_KBD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb1Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_KBD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb1Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_KBD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb1Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_KBD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb1Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN1 MOUSE DEBUG */
|
||||
|
||||
#define USB1_MSE_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb1Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_MSE_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb1Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_MSE_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb1Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_MSE_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb1Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_MSE_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb1Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN1 PRINTER DEBUG */
|
||||
|
||||
#define USB1_PRN_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb1Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_PRN_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb1Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_PRN_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb1Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_PRN_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb1Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_PRN_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb1Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN1 PEGASUS DEBUG */
|
||||
|
||||
#define USB1_END_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb1End, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_END_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb1End, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_END_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb1End, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_END_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb1End, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_END_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb1End, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN1 SPEAKER DEBUG */
|
||||
|
||||
#define USB1_SPK_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb1Spk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_SPK_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb1Spk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_SPK_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb1Spk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_SPK_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb1Spk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB1_SPK_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb1Spk, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN2 HELPER DEBUG */
|
||||
|
||||
#define USB2_HLP_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb2Hlp, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_HLP_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb2Hlp, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_HLP_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb2Hlp, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_HLP_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb2Hlp, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_HLP_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb2Hlp, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN2 MASS STORAGE DEBUG */
|
||||
|
||||
#define USB2_MSC_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb2Msc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_MSC_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb2Msc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_MSC_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb2Msc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_MSC_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb2Msc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_MSC_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb2Msc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN2 MOUSE DEBUG */
|
||||
|
||||
#define USB2_MSE_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb2Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_MSE_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb2Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_MSE_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb2Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_MSE_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb2Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_MSE_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb2Mse, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN2 KEYBOARD DEBUG */
|
||||
|
||||
#define USB2_KBD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb2Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_KBD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb2Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_KBD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb2Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_KBD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb2Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_KBD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb2Kbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN2 PRINTER DEBUG */
|
||||
|
||||
#define USB2_PRN_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb2Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_PRN_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb2Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_PRN_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb2Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_PRN_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb2Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_PRN_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb2Prn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN2 END DEBUG */
|
||||
|
||||
#define USB2_END_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb2End, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_END_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb2End, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_END_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb2End,fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_END_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb2End,fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_END_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb2End,fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* GEN2 Serial DEBUG */
|
||||
|
||||
#define USB2_SER_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usb2Ser, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_SER_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usb2Ser, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_SER_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usb2Ser, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_SER_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usb2Ser, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB2_SER_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usb2Ser, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* USB TGT DEBUG */
|
||||
|
||||
#define USB_TGT_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbTgt, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_TGT_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbTgt, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_TGT_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbTgt, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_TGT_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbTgt, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_TGT_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbTgt, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* USB TGT RNDIS DEBUG */
|
||||
|
||||
#define USBTGT_RNDIS_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbTgtRndis, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_RNDIS_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbTgtRndis, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_RNDIS_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbTgtRndis, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_RNDIS_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbTgtRndis, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_RNDIS_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbTgtRndis, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* USB TGT MSC DEBUG */
|
||||
|
||||
#define USBTGT_MSC_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbTgtMsc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_MSC_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbTgtMsc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_MSC_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbTgtMsc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_MSC_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbTgtMsc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_MSC_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbTgtMsc, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* USB TGT END Module Debug */
|
||||
|
||||
#define USBTGT_END_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbTgtEnd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_END_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbTgtEnd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_END_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbTgtEnd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_END_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbTgtEnd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_END_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbTgtEnd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* USB TGT SER DEBUG */
|
||||
|
||||
#define USBTGT_SER_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbTgtSer, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_SER_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbTgtSer, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_SER_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbTgtSer, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_SER_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbTgtSer, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_SER_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbTgtSer, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* USB TGT PRN DEBUG */
|
||||
|
||||
#define USBTGT_PRN_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbTgtPrn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_PRN_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbTgtPrn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_PRN_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbTgtPrn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_PRN_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbTgtPrn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_PRN_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbTgtPrn, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* USB TGT KBD DEBUG */
|
||||
|
||||
#define USBTGT_KBD_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbTgtKbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_KBD_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbTgtKbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_KBD_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbTgtKbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_KBD_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbTgtKbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USBTGT_KBD_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbTgtKbd, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* USB PLX TCD DEBUG */
|
||||
|
||||
#define USB_PLX_ERR(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_ERR(usbPlx, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_PLX_DBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_DBG(usbPlx, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_PLX_VDBG(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_VDBG(usbPlx, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_PLX_INFO(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_INFO(usbPlx, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define USB_PLX_WARN(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
USB_WARN(usbPlx, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
/* IMPORTS */
|
||||
|
||||
IMPORT UINT32 usbXhcdDebug;
|
||||
IMPORT UINT32 usbEhcdDebug;
|
||||
IMPORT UINT32 usbOhcdDebug;
|
||||
IMPORT UINT32 usbUhcdDebug;
|
||||
IMPORT UINT32 usbMhdrcDebug;
|
||||
IMPORT UINT32 usbShcdDebug;
|
||||
IMPORT UINT32 usbUsbdDebug;
|
||||
IMPORT UINT32 usbTuDebug;
|
||||
IMPORT UINT32 usbHubDebug;
|
||||
IMPORT UINT32 usb1BlkDebug;
|
||||
IMPORT UINT32 usb1CbiDebug;
|
||||
IMPORT UINT32 usb1KbdDebug;
|
||||
IMPORT UINT32 usb1MseDebug;
|
||||
IMPORT UINT32 usb1PrnDebug;
|
||||
IMPORT UINT32 usb1EndDebug;
|
||||
IMPORT UINT32 usb1SpkDebug;
|
||||
IMPORT UINT32 usb2HlpDebug;
|
||||
IMPORT UINT32 usb2MscDebug;
|
||||
IMPORT UINT32 usb2MseDebug;
|
||||
IMPORT UINT32 usb2KbdDebug;
|
||||
IMPORT UINT32 usb2PrnDebug;
|
||||
IMPORT UINT32 usb2EndDebug;
|
||||
IMPORT UINT32 usb2SerDebug;
|
||||
IMPORT UINT32 usbOtgDebug;
|
||||
IMPORT UINT32 usbTgtDebug;
|
||||
IMPORT UINT32 usbTgtRndisDebug;
|
||||
IMPORT UINT32 usbTgtMscDebug;
|
||||
IMPORT UINT32 usbTgtEndDebug;
|
||||
IMPORT UINT32 usbTgtSerDebug;
|
||||
IMPORT UINT32 usbTgtPrnDebug;
|
||||
IMPORT UINT32 usbTgtKbdDebug;
|
||||
IMPORT UINT32 usbPlxDebug;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCusbOsalDebugh */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,248 @@
|
||||
/* usbPciLib.h - System-specific PCI Functions */
|
||||
|
||||
/*
|
||||
* Copyright 1999, 2000, 2004 - 2005, 2010 Wind River Systems, Inc
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01g,10aug10,ghs Fix build error
|
||||
01f,08aug10,ghs Remove warning for usbPciStub.c(WIND00222574)
|
||||
01e,08mar05,hch Fixed the USB_PCI_CFG_BYTE_OUT error
|
||||
01d,27oct04,hch adding macros for USB_PCI_CFG_WORD_OUT, USB_PCI_FIND_DEVICE,
|
||||
USB_PCI_ASSIGN_RESOURCE.
|
||||
01c,08mar00,rcb Correct prototype for usbPciMemioOffset()...
|
||||
was incorrectly called usbPciMemOffset().
|
||||
01b,10dec99,rcb Add definition for usbPciMemioOffset().
|
||||
01a,31may99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file defines platform-independent functions accessing PCI bus
|
||||
capabilities. These functions allow PCI device drivers to be written
|
||||
independent of the underlying O/S's PCI access mechanisms.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbPciLibh
|
||||
#define __INCusbPciLibh
|
||||
|
||||
|
||||
/* Includes */
|
||||
|
||||
#include "usb/pciConstants.h"
|
||||
#include "usb/usbPlatform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/* function prototype for an interrupt vector */
|
||||
|
||||
typedef VOID (*INT_HANDLER_PROTOTYPE) (pVOID param);
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
BOOL usbPciClassFind
|
||||
(
|
||||
UINT8 pciClass, /* PCI device class */
|
||||
UINT8 subClass, /* PCI device sub-class */
|
||||
UINT8 pgmIf, /* Programming interface */
|
||||
UINT16 index, /* Caller wants nth matching dev */
|
||||
pUINT8 pBusNo, /* Bus number of matching dev */
|
||||
pUINT8 pDeviceNo, /* Device number of matching dev */
|
||||
pUINT8 pFuncNo /* Function number of matching dev */
|
||||
);
|
||||
|
||||
|
||||
UINT8 usbPciByteGet
|
||||
(
|
||||
UINT8 busNo, /* Bus number of device */
|
||||
UINT8 deviceNo, /* Device number of device */
|
||||
UINT8 funcNo, /* Function number of device */
|
||||
UINT16 regOffset /* Offset into PCI config space */
|
||||
);
|
||||
|
||||
#define USB_PCI_CFG_BYTE_GET(busNo, deviceNo, funcNo, regOffset) \
|
||||
usbPciByteGet (busNo, deviceNo, funcNo, regOffset)
|
||||
|
||||
|
||||
UINT32 usbPciWordGet
|
||||
(
|
||||
UINT8 busNo, /* Bus number of device */
|
||||
UINT8 deviceNo, /* Device number of device */
|
||||
UINT8 funcNo, /* Function number of device */
|
||||
UINT16 regOffset /* Offset into PCI config space */
|
||||
);
|
||||
|
||||
#define USB_PCI_CFG_WORD_GET(busNo, deviceNo, funcNo, regOffset) \
|
||||
usbPciWordGet (busNo, deviceNo, funcNo, regOffset)
|
||||
|
||||
|
||||
UINT32 usbPciDwordGet
|
||||
(
|
||||
UINT8 busNo, /* Bus number of device */
|
||||
UINT8 deviceNo, /* Device number of device */
|
||||
UINT8 funcNo, /* Function number of device */
|
||||
UINT16 regOffset /* Offset into PCI config space */
|
||||
);
|
||||
|
||||
#define USB_PCI_CFG_DWORD_GET(busNo, deviceNo, funcNo, regOffset) \
|
||||
usbPciDwordGet (busNo, deviceNo, funcNo, regOffset)
|
||||
|
||||
|
||||
VOID usbPciConfigHeaderGet
|
||||
(
|
||||
UINT8 busNo, /* Bus number of device */
|
||||
UINT8 deviceNo, /* Device number of device */
|
||||
UINT8 funcNo, /* Function number of device */
|
||||
pPCI_CFG_HEADER pCfgHdr /* Buffer provided by caller */
|
||||
);
|
||||
|
||||
|
||||
UINT8 usbPciByteIn
|
||||
(
|
||||
UINT32 address /* PCI I/O address */
|
||||
);
|
||||
|
||||
#define USB_PCI_BYTE_IN(address) usbPciByteIn (address)
|
||||
|
||||
|
||||
UINT16 usbPciWordIn
|
||||
(
|
||||
UINT32 address /* PCI I/O address */
|
||||
);
|
||||
|
||||
#define USB_PCI_WORD_IN(address) usbPciWordIn (address)
|
||||
|
||||
|
||||
UINT32 usbPciDwordIn
|
||||
(
|
||||
UINT32 address /* PCI I/O address */
|
||||
);
|
||||
|
||||
#define USB_PCI_DWORD_IN(address) usbPciDwordIn (address)
|
||||
|
||||
|
||||
VOID usbPciByteOut
|
||||
(
|
||||
UINT32 address, /* PCI I/O address */
|
||||
UINT8 value /* value */
|
||||
);
|
||||
|
||||
#define USB_PCI_BYTE_OUT(address, value) usbPciByteOut (address, value)
|
||||
|
||||
|
||||
VOID usbPciWordOut
|
||||
(
|
||||
UINT32 address, /* PCI I/O address */
|
||||
UINT16 value /* value */
|
||||
);
|
||||
|
||||
#define USB_PCI_WORD_OUT(address, value) usbPciWordOut (address, value)
|
||||
|
||||
|
||||
VOID usbPciDwordOut
|
||||
(
|
||||
UINT32 address, /* PCI I/O address */
|
||||
UINT32 value /* value */
|
||||
);
|
||||
|
||||
#define USB_PCI_DWORD_OUT(address, value) usbPciDwordOut (address, value)
|
||||
|
||||
|
||||
UINT32 usbPciMemioOffset (void);
|
||||
|
||||
#define USB_PCI_MEMIO_OFFSET() usbPciMemioOffset ()
|
||||
|
||||
|
||||
UINT32 usbMemToPci
|
||||
(
|
||||
pVOID pMem /* memory address to convert */
|
||||
);
|
||||
|
||||
#define USB_MEM_TO_PCI(pMem) usbMemToPci (pMem)
|
||||
|
||||
|
||||
pVOID usbPciToMem
|
||||
(
|
||||
UINT32 pciAdrs /* 32-bit PCI address to be converted */
|
||||
);
|
||||
|
||||
#define USB_PCI_TO_MEM(pciAdrs) usbPciToMem (pciAdrs)
|
||||
|
||||
|
||||
VOID usbPciMemInvalidate
|
||||
(
|
||||
pVOID pMem, /* base of memory region to invalidate */
|
||||
UINT32 size /* size of region to invalidate */
|
||||
);
|
||||
|
||||
#define USB_PCI_MEM_INVALIDATE(pMem, size) usbPciMemInvalidate (pMem, size)
|
||||
|
||||
|
||||
VOID usbPciMemFlush
|
||||
(
|
||||
pVOID pMem, /* base of memory region to invalidate */
|
||||
UINT32 size /* size of region to invalidate */
|
||||
);
|
||||
|
||||
#define USB_PCI_MEM_FLUSH(pMem, size) usbPciMemFlush (pMem, size)
|
||||
|
||||
|
||||
STATUS usbPciIntConnect
|
||||
(
|
||||
INT_HANDLER_PROTOTYPE func, /* new interrupt handler */
|
||||
pVOID param, /* parameter for int handler */
|
||||
UINT16 intNo /* interrupt vector number */
|
||||
);
|
||||
|
||||
|
||||
VOID usbPciIntRestore
|
||||
(
|
||||
INT_HANDLER_PROTOTYPE func, /* int handler to be removed */
|
||||
pVOID param, /* parameter for int handler */
|
||||
UINT16 intNo /* interrupt vector number */
|
||||
);
|
||||
|
||||
#ifndef USB_PCI_CFG_WORD_OUT
|
||||
#define USB_PCI_CFG_WORD_OUT(busNo, deviceNo, funcNo, address, data) \
|
||||
pciConfigOutWord (busNo, deviceNo, funcNo, address, data)
|
||||
#endif
|
||||
|
||||
#ifndef USB_PCI_FIND_DEVICE
|
||||
#define USB_PCI_FIND_DEVICE(vendorId, deviceId, index, pBusNo, pDeviceNo, \
|
||||
pFuncNo) \
|
||||
pciFindDevice (vendorId, deviceId, index, pBusNo, pDeviceNo,pFuncNo)
|
||||
#endif
|
||||
|
||||
#ifndef USB_PCI_ASSIGN_RESOURCES
|
||||
#define USB_PCI_ASSIGN_RESOURCES(busNo, deviceNo, funcNo) \
|
||||
pciAssignResources (busNo, deviceNo, funcNo);
|
||||
#endif
|
||||
|
||||
#ifndef USB_PCI_CFG_BYTE_OUT
|
||||
#define USB_PCI_CFG_BYTE_OUT(busNo, deviceNo, funcNo, address, data) \
|
||||
pciConfigOutByte (busNo, deviceNo, funcNo, address, data)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbPciLibh */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
/* usbPhyUlpi.h - USB ULPI PHY Common Header File */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, 2011 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01c,09mar11,w_x add ULPI DEBUG register bit masks
|
||||
01b,18feb11,w_x remove duplicated definitions
|
||||
01a,30may10,w_x written
|
||||
*/
|
||||
|
||||
#ifndef __INCusbPhyUlpih
|
||||
#define __INCusbPhyUlpih
|
||||
|
||||
#include <vxWorks.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Define ULPI Phy Register Address */
|
||||
|
||||
#define USB_ULPI_VID_LOW 0x00 /* Vendor ID Low */
|
||||
#define USB_ULPI_VID_HIGH 0x01 /* Vendor ID High */
|
||||
#define USB_ULPI_PID_LOW 0x02 /* Product ID Low */
|
||||
#define USB_ULPI_PID_HIGH 0x03 /* Product ID High */
|
||||
#define USB_ULPI_FUNCTION_CTL 0x04 /* Function Control */
|
||||
#define USB_ULPI_INTERFACE_CTL 0x07 /* Interface Control */
|
||||
#define USB_ULPI_OTG_CTL 0x0A /* OTG Control */
|
||||
#define USB_ULPI_INTR_EN_RISING 0x0D /* USB Interrupt Enable Rising */
|
||||
#define USB_ULPI_INTR_EN_FALLING 0x10 /* USB Interrupt Enable Falling */
|
||||
#define USB_ULPI_INTR_STATUS 0x13 /* USB Interrupt Status */
|
||||
#define USB_ULPI_INTR_LATCH 0x14 /* USB Interrupt Latch */
|
||||
#define USB_ULPI_DEBUG 0x15 /* Debug */
|
||||
#define USB_ULPI_SCRATCH 0x16 /* Scratch Register */
|
||||
#define USB_ULPI_CARKIT_CTL 0x19 /* Carkit Control (Optional) */
|
||||
#define USB_ULPI_CARKIT_INTR_DELAY 0x1C /* Carkit Interrupt Delay (Optional) */
|
||||
#define USB_ULPI_CARKIT_INTR_EN 0x1D /* Carkit Interrupt Enable (Optional) */
|
||||
#define USB_ULPI_CARKIT_INTR_STATUS 0x20 /* Carkit Interrupt Status (Optional) */
|
||||
#define USB_ULPI_CARKIT_INTR_LATCH 0x21 /* Carkit Interrupt Latch (Optional) */
|
||||
#define USB_ULPI_CARKIT_PULSE_CTL 0x22 /* Carkit Pulse Control (Optional) */
|
||||
#define USB_ULPI_TRANS_POS_WIIDTH 0x25 /* Transmit Positive Width (Optional) */
|
||||
#define USB_ULPI_TRANS_NEG_WIIDTH 0x26 /* Transmit Negative Width (Optional) */
|
||||
#define USB_ULPI_RECEV_POL_RECOVERY 0x27 /* Receive Polarity Recovery (Optional) */
|
||||
|
||||
#define USB_ULPI_SET_ADJ 0x01
|
||||
#define USB_ULPI_CLR_ADJ 0x02
|
||||
|
||||
/* ULPI PHY OTG Control Register bits */
|
||||
|
||||
#define ULPI_OTG_CTL_USE_EXT_VBUS_IND (1 << 7) /* Use ext. Vbus indicator */
|
||||
#define ULPI_OTG_CTL_DRV_VBUS_EXT (1 << 6) /* Drive Vbus external */
|
||||
#define ULPI_OTG_CTL_DRV_VBUS (1 << 5) /* Drive Vbus */
|
||||
#define ULPI_OTG_CTL_CHRG_VBUS (1 << 4) /* Charge Vbus */
|
||||
#define ULPI_OTG_CTL_DISCHRG_VBUS (1 << 3) /* Discharge Vbus */
|
||||
#define ULPI_OTG_CTL_DM_PULL_DOWN (1 << 2) /* enable DM Pull Down */
|
||||
#define ULPI_OTG_CTL_DP_PULL_DOWN (1 << 1) /* enable DP Pull Down */
|
||||
#define ULPI_OTG_CTL_ID_PULL_UP (1 << 0) /* enable ID Pull Up */
|
||||
|
||||
/* FUNC_CTRL */
|
||||
|
||||
#define ULPI_FUNC_CTRL_SUSPENDM (1 << 6) /* Active low PHY suspend.*/
|
||||
#define ULPI_FUNC_CTRL_RESET (1 << 5) /* Active high transceiver reset.*/
|
||||
#define ULPI_FUNC_CTRL_OPMODE_MSK (3 << 3) /* Select the required bit encoding style.*/
|
||||
#define ULPI_FUNC_CTRL_XCVRSELECT_MSK (3 << 0) /* Select the required transceiver speed.*/
|
||||
#define ULPI_FUNC_CTRL_TERMSELECT (1 << 2) /* Controls the internal 1.5-k pullup resistor
|
||||
* and 45 HS terminations */
|
||||
|
||||
/* IFC_CTRL - Enables alternate interfaces and PHY features */
|
||||
|
||||
#define ULPI_IFC_CTRL_INTERFACE_PROTECT_DISABLE (1 << 7)
|
||||
#define ULPI_IFC_CTRL_AUTORESUME (1 << 4)
|
||||
#define ULPI_IFC_CTRL_CLOCK_SUSPENDM (1 << 3)
|
||||
#define ULPI_IFC_CTRL_CARKITMODE (1 << 2)
|
||||
#define ULPI_IFC_CTRL_FSLSSERIALMODE_3PIN (1 << 1)
|
||||
|
||||
/*
|
||||
* 0x0: Normal operation
|
||||
* 0x1: Nondriving
|
||||
* 0x2: Disable bit-stuff and NRZI encoding
|
||||
* 0x3: Reserved
|
||||
*/
|
||||
|
||||
#define ULPI_OPMODE_NORMAL ((0) << 3)
|
||||
#define ULPI_OPMODE_NONDRIVING ((1) << 3)
|
||||
#define ULPI_OPMODE_NO_BITSTUFF_NRZI ((2) << 3)
|
||||
|
||||
/*
|
||||
* 0x0: Enable HS transceiver
|
||||
* 0x1: Enable FS transceiver
|
||||
* 0x2: Enable LS transceiver
|
||||
* 0x3: Enable FS transceiver for LS packets
|
||||
* (FS preamble is automatically prepended.)
|
||||
*/
|
||||
|
||||
#define ULPI_XCVRSELECT_HS 0
|
||||
#define ULPI_XCVRSELECT_FS 1
|
||||
#define ULPI_XCVRSELECT_LS 2
|
||||
#define ULPI_XCVRSELECT_FS_LS 3
|
||||
|
||||
/*
|
||||
* Current value of UTMI+ Hostdisconnect output.
|
||||
* Applicable only in host mode. Automatically reset to 0b when
|
||||
* Low Power Mode is entered.
|
||||
*/
|
||||
|
||||
#define ULPI_INTR_Hostdisconnect (UINT8)(1 << 0)
|
||||
|
||||
/*
|
||||
* Current value of UTMI+ VbusValid output.
|
||||
*/
|
||||
|
||||
#define ULPI_INTR_VbusValid (UINT8)(1 << 1)
|
||||
|
||||
|
||||
/*
|
||||
* Current value of UTMI+ SessValid output. SessValid is
|
||||
* the same as UTMI+ AValid.
|
||||
*/
|
||||
|
||||
#define ULPI_INTR_SessValid (UINT8)(1 << 2)
|
||||
|
||||
/* Current value of UTMI+ SessEnd output. */
|
||||
|
||||
#define ULPI_INTR_SessEnd (UINT8)(1 << 3)
|
||||
|
||||
/*
|
||||
* Current value of UTMI+ IdGnd output. IdGnd is valid
|
||||
* 50ms after IdPullup is set to 1b, otherwise IdGnd is
|
||||
* undefined and should be ignored.
|
||||
*/
|
||||
|
||||
#define ULPI_INTR_IdGnd (UINT8)(1 << 4)
|
||||
|
||||
#define ULPI_INTR_ALL \
|
||||
(ULPI_INTR_Hostdisconnect | \
|
||||
ULPI_INTR_VbusValid | \
|
||||
ULPI_INTR_SessValid | \
|
||||
ULPI_INTR_SessEnd | \
|
||||
ULPI_INTR_IdGnd)
|
||||
|
||||
/* ULPI DEBUG register bit masks */
|
||||
|
||||
#define ULPI_DEBUG_LINESTATE0 (UINT8)(1 << 0)
|
||||
#define ULPI_DEBUG_LINESTATE1 (UINT8)(1 << 1)
|
||||
#define ULPI_DEBUG_LINESTATE_SE0 (UINT8)(0)
|
||||
#define ULPI_DEBUG_LINESTATE_FSK (UINT8)(1)
|
||||
#define ULPI_DEBUG_LINESTATE_FSJ (UINT8)(2)
|
||||
#define ULPI_DEBUG_LINESTATE_SE1 (UINT8)(3)
|
||||
#define ULPI_DEBUG_LINESTATE_MSK (UINT8)(3)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbPhyUlpih */
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/* usbPlatform.h - Basic platform definitions for USB driver stack */
|
||||
|
||||
/* Copyright 2000, 2010 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01f,29apr10,pad Moved extern C statement after include statements.
|
||||
01e,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce
|
||||
01d,05dec00,wef removed M_usb* and put in vwModNum.h
|
||||
01c,12jan00,rcb Add definition for M_usbSpeakerLib.
|
||||
01b,26may99,rcb Add definition of VOLATILE.
|
||||
01a,31may99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file contains basic platform definitions used to write portable (O/S-
|
||||
independent) code.
|
||||
|
||||
By convention, this should be the only file in a set of "portable" code which
|
||||
contains #ifdef's and other constructs used to accomodate machine or O/S
|
||||
dependencies.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbPlatformh
|
||||
#define __INCusbPlatformh
|
||||
|
||||
|
||||
/*
|
||||
* Structure packing
|
||||
*
|
||||
* By convention, all code wants "zero-byte packing". That is, the compiler
|
||||
* should assemble structures so that fields are contiguous in memory...no
|
||||
* padding should be added. CMC's use of this convention was approved by
|
||||
* D'Anne Thompson of WRS on 09jun99.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Basic data types
|
||||
*
|
||||
* vxWorks.h defines UINT8, UINT16, UINT32, BOOL, VOID, and STATUS.
|
||||
*
|
||||
* vxWorks.h defines min(x,y), max(x,y).
|
||||
*
|
||||
* vxWorks.h defines _BIG_ENDIAN, _BYTE_ORDER, MSB, LSB, LONGSWAP.
|
||||
*
|
||||
* vxWorks.h defines OK, ERROR.
|
||||
*/
|
||||
|
||||
#include "vxWorks.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* pointers to data types */
|
||||
|
||||
typedef UINT8 *pUINT8;
|
||||
typedef UINT16 *pUINT16;
|
||||
typedef UINT32 *pUINT32;
|
||||
typedef BOOL *pBOOL;
|
||||
typedef char *pCHAR;
|
||||
typedef VOID *pVOID;
|
||||
|
||||
/* VOLATILE */
|
||||
|
||||
#define VOLATILE volatile
|
||||
|
||||
/* Macros to deal with byte order issues */
|
||||
|
||||
#if (_BYTE_ORDER == _BIG_ENDIAN)
|
||||
|
||||
#define FROM_LITTLEW(w) (MSB((w)) | (LSB((w)) << 8))
|
||||
#define FROM_LITTLEL(l) (LONGSWAP((l)))
|
||||
#define FROM_BIGW(w) (w)
|
||||
#define FROM_BIGL(l) (l)
|
||||
|
||||
#else
|
||||
|
||||
#define FROM_LITTLEW(w) (w)
|
||||
#define FROM_LITTLEL(l) (l)
|
||||
#define FROM_BIGW(w) (MSB((w)) | (LSB((w)) << 8))
|
||||
#define FROM_BIGL(l) (LONGSWAP((l)))
|
||||
|
||||
#endif
|
||||
|
||||
#define TO_LITTLEW(w) FROM_LITTLEW((w))
|
||||
#define TO_LITTLEL(l) FROM_LITTLEL((l))
|
||||
#define TO_BIGW(w) FROM_BIGW((w))
|
||||
#define TO_BIGL(w) FROM_BIGL((l))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbPlatformh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/* usbPrinter.h - Class-specific definitions for USB printers */
|
||||
|
||||
/* Copyright 2000 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01a,,rcb First.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbPrinterh
|
||||
#define __INCusbPrinterh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* USB PRINTER subclass codes */
|
||||
|
||||
#define USB_SUBCLASS_PRINTER 0x01
|
||||
|
||||
|
||||
/* USB PRINTER protocol codes */
|
||||
|
||||
#define USB_PROTOCOL_PRINTER_UNIDIR 0x01
|
||||
#define USB_PROTOCOL_PRINTER_BIDIR 0x02
|
||||
|
||||
|
||||
/* USB PRINTER class-specific requests */
|
||||
|
||||
#define USB_REQ_PRN_GET_DEVICE_ID 0x00
|
||||
#define USB_REQ_PRN_GET_PORT_STATUS 0x01
|
||||
#define USB_REQ_PRN_SOFT_RESET 0x02
|
||||
|
||||
|
||||
/* USB_PRINTER_PORT_STATUS.status bit definitions */
|
||||
|
||||
#define USB_PRN_STS_PAPER_EMPTY 0x20
|
||||
#define USB_PRN_STS_SELECTED 0x10
|
||||
#define USB_PRN_STS_NOT_ERROR 0x08
|
||||
|
||||
|
||||
#define USB_PRN_MAX_DEVICE_ID_LEN 256
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/* USB_PRINTER_CAPABILITIES
|
||||
*
|
||||
* NOTE: The USB_PRINTER_CAPABILITIES structure matches that of the IEEE-1284
|
||||
* "device ID" string.
|
||||
*/
|
||||
|
||||
typedef struct usb_printer_capabilities
|
||||
{
|
||||
UINT16 length; /* length of string, big-endian */
|
||||
UINT8 caps [1]; /* variable length string */
|
||||
} USB_PRINTER_CAPABILITIES, *pUSB_PRINTER_CAPABILITIES;
|
||||
|
||||
|
||||
/* USB_PRINTER_PORT_STATUS */
|
||||
|
||||
typedef struct usb_printer_port_status
|
||||
{
|
||||
UINT8 status;
|
||||
} USB_PRINTER_PORT_STATUS, *pUSB_PRINTER_PORT_STATUS;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbPrinterh */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/* usbQueueLib.h - O/S-independent queue services */
|
||||
|
||||
/* Copyright 2000, 2010 Wind River Systems, Inc. */
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01g,29apr10,pad Moved extern C statement after include statements.
|
||||
01f,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce
|
||||
01e,07may01,wef changed module number to be (module sub num << 8) |
|
||||
M_usbHostLib
|
||||
01d,02may01,wef changed module number to be M_<module> + M_usbHostLib
|
||||
01c,05dec00,wef moved Module number defs to vwModNum.h - add this
|
||||
to #includes
|
||||
01b,07mar00,rcb Change QUEUE_HANDLE from UINT32 to pVOID.
|
||||
01a,13jul99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines an O/S-independent queueing mechanism which is typically used for
|
||||
inter-thread communication in a multi-threaded environment.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbQueueLibh
|
||||
#define __INCusbQueueLibh
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/ossLib.h"
|
||||
#include "vwModNum.h" /* USB Module number def's */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Defines */
|
||||
|
||||
/* USB return codes. */
|
||||
|
||||
/*
|
||||
* USB errnos are defined as being part of the USB host Module, as are all
|
||||
* vxWorks module numbers, but the USB Module number is further divided into
|
||||
* sub-modules. Each sub-module has upto 255 values for its own error codes
|
||||
*/
|
||||
|
||||
#define USB_QUEUE_SUB_MODULE 2
|
||||
|
||||
#define M_usbQueueLib ( (USB_QUEUE_SUB_MODULE << 8) | M_usbHostLib )
|
||||
|
||||
#define usbQueueErr(x) (M_usbQueueLib | (x))
|
||||
|
||||
#define S_usbQueueLib_BAD_HANDLE usbQueueErr (1)
|
||||
#define S_usbQueueLib_BAD_PARAMETER usbQueueErr (2)
|
||||
#define S_usbQueueLib_OUT_OF_MEMORY usbQueueErr (3)
|
||||
#define S_usbQueueLib_OUT_OF_RESOURCES usbQueueErr (4)
|
||||
#define S_usbQueueLib_Q_NOT_AVAILABLE usbQueueErr (5)
|
||||
|
||||
/* Structure definitions. */
|
||||
|
||||
/* Handles. */
|
||||
|
||||
typedef pVOID QUEUE_HANDLE; /* Queue handle */
|
||||
typedef QUEUE_HANDLE *pQUEUE_HANDLE;
|
||||
|
||||
/*
|
||||
* USB_MESSAGE
|
||||
*
|
||||
* Defines the format of a message which can be passed through a queue.
|
||||
*/
|
||||
|
||||
typedef struct usb_message
|
||||
{
|
||||
UINT16 msg; /* Message code - application specific */
|
||||
UINT16 wParam; /* WORD parameter - application specific */
|
||||
UINT32 lParam; /* DWORD parameter - application specific */
|
||||
} USB_MESSAGE, *pUSB_MESSAGE;
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
STATUS usbQueueCreate
|
||||
(
|
||||
UINT16 depth, /* Max entries queue can handle */
|
||||
pQUEUE_HANDLE pQueueHandle /* Handle of newly created queue */
|
||||
);
|
||||
|
||||
STATUS usbQueueDestroy
|
||||
(
|
||||
QUEUE_HANDLE queueHandle /* Hnadle of queue to destroy */
|
||||
);
|
||||
|
||||
STATUS usbQueuePut
|
||||
(
|
||||
QUEUE_HANDLE queueHandle, /* queue handle */
|
||||
UINT16 msg, /* app-specific message */
|
||||
UINT16 wParam, /* app-specific parameter */
|
||||
UINT32 lParam, /* app-specific parameter */
|
||||
UINT32 blockFlag /* specifies blocking action */
|
||||
);
|
||||
|
||||
STATUS usbQueueGet
|
||||
(
|
||||
QUEUE_HANDLE queueHandle, /* queue handle */
|
||||
pUSB_MESSAGE pMsg, /* USB_MESSAGE to receive msg */
|
||||
UINT32 blockFlag /* specifies blocking action */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbQueueLibh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,201 @@
|
||||
/* usbTgtCommon.h - Common Definitions for USB GEN2 Target Stack */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01a,17may12,s_z Writen based usbTargLib.h
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file includes the common defination and routines of the USB target
|
||||
stack management modules.
|
||||
|
||||
INCLUDE FILES: usb/usb.h
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTgtCommonh
|
||||
#define __INCusbTgtCommonh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <usb/usb.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TARG_MNGMT_ATTACH 0x0000 /* TARG Attach Management Code */
|
||||
#define TARG_MNGMT_DETACH 0x0001 /* TARG Detach Management Code */
|
||||
#define TARG_MNGMT_DISCONNECT 0x0002 /* TARG Disconnect Management Code */
|
||||
#define TARG_MNGMT_BUS_RESET 0x0003 /* TARG Bus Reset Management Code */
|
||||
#define TARG_MNGMT_SUSPEND 0x0004 /* TARG Suspend Management Code */
|
||||
#define TARG_MNGMT_RESUME 0x0005 /* TARG Resume Managemnt Code */
|
||||
#define TARG_MNGMT_DESC_TABLE_GET 0x0006 /* Code to get descriptor table with TCD speed */
|
||||
|
||||
|
||||
|
||||
/* caller-supplied target callbacks */
|
||||
|
||||
/* target management callback */
|
||||
|
||||
typedef STATUS (*USB_TARG_MANAGEMENT_FUNC)
|
||||
(
|
||||
pVOID param,
|
||||
USB_TARG_CHANNEL targChannel,
|
||||
UINT16 mngmtCode, /* management code */
|
||||
pVOID pContext
|
||||
);
|
||||
|
||||
/* control pipe callbacks */
|
||||
|
||||
typedef STATUS (*USB_TARG_FEATURE_CLEAR_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT8 requestType, /* request type */
|
||||
UINT16 feature, /* feature to clear */
|
||||
UINT16 uIndex /* wIndex */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_FEATURE_SET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD Specific Parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT8 requestType, /* request type */
|
||||
UINT16 feature, /* feature to set */
|
||||
UINT16 index /* wIndex */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_CONFIGURATION_GET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
pUINT8 pConfiguration /* pointer to configuration value */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_CONFIGURATION_SET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific paramter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT8 configuration /* configuration value */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_DESCRIPTOR_GET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT8 requestType, /* request type */
|
||||
UINT8 descriptorType, /* descriptor type */
|
||||
UINT8 descriptorIndex,/* descriptor index */
|
||||
UINT16 languageId, /* language ID */
|
||||
UINT16 length, /* length of descriptor */
|
||||
pUINT8 pBfr, /* pointer to buffer */
|
||||
pUINT16 pActLen /* length of data sent */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_DESCRIPTOR_SET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD Specific Parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT8 requestType, /* request type */
|
||||
UINT8 descriptorType, /* descriptor type */
|
||||
UINT8 descriptorIndex,/* descriptor index */
|
||||
UINT16 languageId, /* language ID */
|
||||
UINT16 length, /* length of descriptor */
|
||||
pUINT8 pBfr, /* pointer to buffer */
|
||||
pUINT16 pActLen /* length of data in buffer */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_INTERFACE_GET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT16 interface, /* interface number */
|
||||
pUINT8 pAlternateSetting /* alternate setting */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_INTERFACE_SET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT16 interface, /* interface number */
|
||||
UINT8 alternateSetting /* alternate setting */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_STATUS_GET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT16 requestType, /* request type */
|
||||
UINT16 index, /* wIndex */
|
||||
UINT16 length, /* length */
|
||||
pUINT8 pBfr /* pointer to buffer */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_ADDRESS_SET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT16 deviceAddress /* device address */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_SYNCH_FRAME_GET_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT16 endpoint, /* endpoint */
|
||||
pUINT16 pFrameNo /* frame number obtained */
|
||||
);
|
||||
|
||||
typedef STATUS (*USB_TARG_VENDOR_SPECIFIC_FUNC)
|
||||
(
|
||||
pVOID param, /* TCD specific parameter */
|
||||
USB_TARG_CHANNEL targChannel, /* target channel */
|
||||
UINT8 requestType, /* type of request */
|
||||
UINT8 request, /* request name */
|
||||
UINT16 value, /* wValue */
|
||||
UINT16 index, /* wIndex */
|
||||
UINT16 length /* wLength */
|
||||
);
|
||||
|
||||
typedef struct usbTargCallbackTable /* USB_TARG_CALLBACK_TABLE */
|
||||
{
|
||||
/* device management callbacks */
|
||||
|
||||
USB_TARG_MANAGEMENT_FUNC mngmtFunc; /* management callback */
|
||||
|
||||
/* Control pipe callbacks */
|
||||
|
||||
USB_TARG_FEATURE_CLEAR_FUNC featureClear; /* feature clear */
|
||||
USB_TARG_FEATURE_SET_FUNC featureSet; /* feature set */
|
||||
USB_TARG_CONFIGURATION_GET_FUNC configurationGet; /*configuration get*/
|
||||
USB_TARG_CONFIGURATION_SET_FUNC configurationSet; /*configuration set*/
|
||||
USB_TARG_DESCRIPTOR_GET_FUNC descriptorGet; /* descriptor get */
|
||||
USB_TARG_DESCRIPTOR_SET_FUNC descriptorSet; /* descriptor set */
|
||||
USB_TARG_INTERFACE_GET_FUNC interfaceGet; /* interface get */
|
||||
USB_TARG_INTERFACE_SET_FUNC interfaceSet; /* interface set */
|
||||
USB_TARG_STATUS_GET_FUNC statusGet; /* status get */
|
||||
USB_TARG_ADDRESS_SET_FUNC addressSet; /* address set */
|
||||
USB_TARG_SYNCH_FRAME_GET_FUNC synchFrameGet; /* frame get */
|
||||
USB_TARG_VENDOR_SPECIFIC_FUNC vendorSpecific; /* vendor specific */
|
||||
} USB_TARG_CALLBACK_TABLE, *pUSB_TARG_CALLBACK_TABLE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTgtCommonh */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/* usbTgtFuncDemo.h - Definitions for USB target */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01a,17may10,s_z created
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Common definitions for the Omap USB controler (device side).
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTgtFuncDemoh
|
||||
#define __INCusbTgtFuncDemoh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <semLib.h>
|
||||
#include <lstLib.h>
|
||||
#include <vwModNum.h>
|
||||
#include <hwif/vxbus/vxBus.h>
|
||||
#include <usb/usb.h>
|
||||
|
||||
IMPORT STATUS usbTgtFuncDemoInit
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
IMPORT STATUS usbTgtFuncDemoUnInit
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* usbTgtFuncDemo */
|
||||
@@ -0,0 +1,94 @@
|
||||
/* usbTgtKbd.h - USB Target Keyboard Class library module common header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, 2012 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01c,04aug12,s_z Adjust the usbtgt_kbd_dev sturcture
|
||||
01c,04aug11,ljg Add HID Desc and Report Desc (WIND00291023)
|
||||
01b,12jul11,s_z Import usbTgtKbdInit and usbTgtKbdUnInit routines
|
||||
01a,11apr11,ljg written
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTgtKbdh
|
||||
#define __INCusbTgtKbdh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <usb/usbTgt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* keyboard interface */
|
||||
|
||||
#define USBTGT_KBD_INTERFACE_NUM 0 /* interface number */
|
||||
#define USBTGT_KBD_INTERFACE_ALT_SETTING 0 /* alternate setting */
|
||||
#define USBTGT_KBD_NUM_ENDPOINTS 1 /* number of endpoints */
|
||||
#define USBTGT_KBD_INT_IN_ENDPOINT_NUM 0x81 /* INT IN endpoint number */
|
||||
#define USBTGT_KBD_INTERRUPT_ENDPOINT_INTERVAL 0x0A /* milliseconds */
|
||||
|
||||
#define USBTGT_KBD_BINARY_CODED_DECIMAL 0x101 /* bcdHID */
|
||||
#define USBTGT_KBD_HARDWARE_TARGET_COUNTRY 0 /* bCountryCode */
|
||||
#define USBTGT_KBD_DESCRIPTORS_NUMBER 0x01 /* bNumDescriptors */
|
||||
#define USBTGT_KBD_REPORT_DESCRIPTOR_LENGTH 0x3F /* wDescriptorLength */
|
||||
|
||||
/* structure of target Kbd device */
|
||||
|
||||
typedef struct usbtgt_kbd_dev
|
||||
{
|
||||
NODE kbdNode;
|
||||
USB_TARG_CHANNEL targChannel; /* Target channel */
|
||||
UINT32 uDeviceFeature; /* Device feature */
|
||||
USB_TARG_PIPE intInPipeHandle; /* Bulk pipe handle */
|
||||
HID_KBD_BOOT_REPORT intInBfr; /* Buffer used by Interrupt In transaction */
|
||||
SEM_HANDLE intInErpSem; /* Interrupt In transfer mutex */
|
||||
BOOL bIntInErpUsed;
|
||||
UINT8 uIntInPipeStatus; /* Interrupt In pipe stall or not */
|
||||
UINT8 uAlternateSetting; /* Current altsetting value */
|
||||
UINT8 uConfigurationValue; /* Configuration value */
|
||||
UINT8 uInterfaceNubmer; /* Number of interface which holds this endpoint */
|
||||
USB_ERP intInErp; /* Bulk ERP */
|
||||
}USBTGT_KBD_DEV,*pUSBTGT_KBD_DEV;
|
||||
|
||||
typedef struct usr_usbTgt_kbd_config
|
||||
{
|
||||
char tcdName[USBTGT_MAX_NAME_SZ]; /* The TCD name to be attached */
|
||||
UINT8 uTcdUnit; /* The TCD unit to be attached */
|
||||
char kbdName[USBTGT_MAX_NAME_SZ]; /* The Kbd function driver name */
|
||||
UINT8 uKbdUnit; /* The Kbd function driver unit */
|
||||
UINT8 uConfigNum; /* The configuration num build in the TCD */
|
||||
}USR_USBTGT_KBD_CONFIG, *pUSR_USBTGT_KBD_CONFIG;
|
||||
|
||||
typedef enum usbtgt_kbd_pipe_state
|
||||
{
|
||||
USBTGT_KBD_PIPE_IDLE = 0,
|
||||
USBTGT_KBD_PIPE_STALL = 1,
|
||||
USBTGT_KBD_PIPE_UNSTALL = 2,
|
||||
USBTGT_KBD_PIPE_BUSY = 3
|
||||
}USBTGT_KBD_PIPE_STATE;
|
||||
|
||||
IMPORT STATUS usbTgtKbdInit
|
||||
(
|
||||
int devCount
|
||||
);
|
||||
|
||||
IMPORT STATUS usbTgtKbdUnInit
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTgtKbdh */
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/* usbTgtMsc.h - usb target mass storage common header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01d,18may12,s_z Add support for USB 3.0 target (WIND00326012)
|
||||
01c,12jul11,s_z Import usbTgtMscInit and usbTgtMscExit routines
|
||||
01b,24mar11,s_z Changed based on the code review
|
||||
01a,24mar11,m_y written
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTgtMsch
|
||||
#define __INCusbTgtMsch
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <usb/usbTgt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define USBTGT_MSC_MAX_ERP_BUF_SIZE 0x800
|
||||
|
||||
/* USB target MSC function driver configuration */
|
||||
|
||||
typedef struct usr_usbTgt_msc_config
|
||||
{
|
||||
char tcdName[USBTGT_MAX_NAME_SZ];
|
||||
UINT8 tcdUnit;
|
||||
char funcName[USBTGT_COMMON_STR_LEN];
|
||||
char devProtocol[USBTGT_COMMON_STR_LEN];
|
||||
UINT8 funcUnit;
|
||||
UINT8 configNum;
|
||||
char devName[255];
|
||||
char devRemovable[USBTGT_COMMON_STR_LEN];
|
||||
char devReadonly[USBTGT_COMMON_STR_LEN];
|
||||
}USR_USBTGT_MSC_CONFIG, *pUSR_USBTGT_MSC_CONFIG;
|
||||
|
||||
STATUS usbTgtMscLunAdd
|
||||
(
|
||||
char * tcdName,
|
||||
int tcdUnit,
|
||||
char * devName,
|
||||
char * devReadonly,
|
||||
char * devRemovable,
|
||||
char * devProtocol
|
||||
);
|
||||
STATUS usbTgtMscLunDel
|
||||
(
|
||||
char * tcdName,
|
||||
int tcdUnit,
|
||||
char * devName
|
||||
);
|
||||
|
||||
void usbTgtMscExit(void);
|
||||
STATUS usbTgtMscInit
|
||||
(
|
||||
int devCount
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTgtMsch */
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
/* usbTgtPrn.h - USB Target Printer Class library module common header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01c,04aug12,s_z Adjust the usbtgt_prn_dev sturcture
|
||||
01b,12jul11,s_z Import usbTgtPrnInit and usbTgtPrnUnInit routines
|
||||
01a,22feb11,ljg created
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTgtPrnh
|
||||
#define __INCusbTgtPrnh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <usb/usbPrinter.h>
|
||||
#include <usb/usbTgt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* printer configuration */
|
||||
|
||||
#define USBTGT_PRN_INTERFACE_NUM 0 /* interface number */
|
||||
#define USBTGT_PRN_INTERFACE_ALT_SETTING 0 /* alternate setting */
|
||||
#define USBTGT_PRN_NUM_ENDPOINTS 2 /* number of endpoints */
|
||||
|
||||
#define USBTGT_PRN_HIGH_SPEED_MAX_PACKET_SIZE 512 /* maximum packet size for
|
||||
* the default control
|
||||
* endpoint, if the device
|
||||
* is operating at high
|
||||
* speed
|
||||
*/
|
||||
|
||||
#define USBTGT_PRN_FULL_SPEED_MAX_PACKET_SIZE 64 /* maximum packet size for
|
||||
* the default control
|
||||
* endpoint, if the device
|
||||
* is operating at high
|
||||
* speed
|
||||
*/
|
||||
|
||||
#define USBTGT_PRN_MAX_BUFF_LEN USBTGT_PRN_HIGH_SPEED_MAX_PACKET_SIZE
|
||||
|
||||
#define USBTGT_PRN_BULK_OUT_ENDPOINT_NUM 0x01 /* PIO mode bulk out endpoint number */
|
||||
|
||||
#define USBTGT_PRN_BULK_IN_ENDPOINT_NUM 0x81 /* PIO mode bulk in endpoint number */
|
||||
|
||||
#define USBTGT_PRN_BULK_TASK_PRIORITY 254 /* PIO - Bulk OUT endpoint ID */
|
||||
|
||||
#define USBTGT_PRN_DEFAULT_TIMEOUT 1000 /* Default bulk in/out time out */
|
||||
|
||||
|
||||
#define USBTGT_PRN_MAX_ERP_BUF_SIZE 0x800
|
||||
|
||||
typedef struct usr_usbTgt_prn_config
|
||||
{
|
||||
char tcdName[USBTGT_MAX_NAME_SZ]; /* The TCD name to be attached */
|
||||
UINT8 uTcdUnit; /* The TCD unit to be attached */
|
||||
char prnName[USBTGT_MAX_NAME_SZ]; /* The Prn function driver name */
|
||||
UINT8 uPrnUnit; /* The Prn function driver unit */
|
||||
UINT8 uConfigNum; /* The configuration num build in the TCD */
|
||||
char prnCapsString[USB_PRN_MAX_DEVICE_ID_LEN - 2]; /* The Prn capabilities string exclude 2 bytes length */
|
||||
}USR_USBTGT_PRN_CONFIG, *pUSR_USBTGT_PRN_CONFIG;
|
||||
|
||||
#define USBTGT_PRN_COUNT NELEMENTS(usrUsbTgtPrnConfigTable)
|
||||
|
||||
/* structure of target prn device */
|
||||
|
||||
typedef struct usbtgt_prn_dev
|
||||
{
|
||||
NODE prnNode;
|
||||
USB_TARG_CHANNEL targChannel; /* Target channel */
|
||||
MSG_Q_ID prnTaskMsgQID; /* Task msgQ id */
|
||||
OS_THREAD_ID prnTaskID; /* Tasl ID */
|
||||
USB_PRINTER_PORT_STATUS prnState;
|
||||
UINT8 uAlternateSetting; /* Current altsetting value */
|
||||
UINT8 uConfigurationValue; /* Configuration value */
|
||||
UINT8 uInterfaceNubmer; /* Number of interface which holds this endpoint */
|
||||
int deviceTimeout; /* Timeout (ms) to wait reqs. */
|
||||
UINT32 uDeviceFeature; /* Device feature */
|
||||
|
||||
USB_TARG_PIPE bulkOutPipeHandle; /* Bulk pipe handle */
|
||||
USB_TARG_PIPE bulkInPipeHandle; /* Bulk pipe handle */
|
||||
USB_ERP bulkOutErp; /* Bulk ERP */
|
||||
USB_ERP bulkInErp; /* Bulk ERP */
|
||||
UINT8 * pBulkOutBuf;
|
||||
UINT8 * pBulkInBuf;
|
||||
SEM_HANDLE bulkOutErpSem; /* Bulk Out transfer mutex */
|
||||
SEM_HANDLE bulkInErpSem; /* Bulk In transfer mutex */
|
||||
UINT8 uBulkOutPipeStatus;
|
||||
UINT8 uBulkInPipeStatus;
|
||||
BOOL bBulkOutErpUsed;
|
||||
BOOL bBulkInErpUsed;
|
||||
BOOL bBulkOutBufValid;
|
||||
BOOL bBulkInBufValid;
|
||||
}USBTGT_PRN_DEV,*pUSBTGT_PRN_DEV;
|
||||
|
||||
/* The notify command */
|
||||
|
||||
typedef enum usbtgt_prn_notify_code
|
||||
{
|
||||
USBTGT_PRN_NOTIFY_UNKNOWN = (0),
|
||||
USBTGT_PRN_NOTIFY_RESET = (1),
|
||||
USBTGT_PRN_NOTIFY_BULK_IN = (6),
|
||||
USBTGT_PRN_NOTIFY_BULK_OUT = (7)
|
||||
}USBTGT_PRN_NOTIFY_CODE;
|
||||
|
||||
/* Notify info data structure */
|
||||
|
||||
typedef struct usbtgt_prn_notify_info
|
||||
{
|
||||
struct usbtgt_prn_dev * pUsbTgtPrn; /* PRN device pointer */
|
||||
USBTGT_PRN_NOTIFY_CODE notifyCode; /* The code of the notification */
|
||||
} USBTGT_PRN_NOTIFY_INFO, *pUSBTGT_PRN_NOTIFY_INFO;
|
||||
|
||||
typedef enum usbtgt_prn_pipe_state
|
||||
{
|
||||
USBTGT_PRN_PIPE_IDLE = 0,
|
||||
USBTGT_PRN_PIPE_STALL = 1,
|
||||
USBTGT_PRN_PIPE_UNSTALL = 2,
|
||||
USBTGT_PRN_PIPE_BUSY = 3
|
||||
}USBTGT_PRN_PIPE_STATE;
|
||||
|
||||
IMPORT STATUS usbTgtPrnInit
|
||||
(
|
||||
int devCount
|
||||
);
|
||||
IMPORT STATUS usbTgtPrnUnInit
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTgtPrnh */
|
||||
|
||||
@@ -0,0 +1,673 @@
|
||||
/* usbTgtRndis.h - Definitions of USB rndis function drivers */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01c,04aug12,s_z Adjust the usbtgt_rndis sturcture
|
||||
01f,29sep11,s_z Add direct callback mode to avoid asynch issue (WIND00306920)
|
||||
01e,17aug11,s_z Remove redefined macro
|
||||
01d,11apr11,s_z Add Open Specifications Documentation description
|
||||
01c,22mar11,s_z Code clean based on code review
|
||||
01b,08mar11,s_z Code clean up
|
||||
01a,04jan11,s_z written
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file includes the definitions of USB RNDIS function driver.
|
||||
|
||||
This RNDIS function driver follows the [MS-RNDIS]:Remote Network Driver
|
||||
Interface Specification (RNDIS) Protocol Specification 1.0, which is one of the
|
||||
Open Specifications Documentation.
|
||||
|
||||
Following is the Intellectual Property Rights Notice for Open Specifications
|
||||
Documentation:
|
||||
|
||||
\h Intellectual Property Rights Notice for Open Specifications Documentation
|
||||
|
||||
\h Technical Documentation.
|
||||
|
||||
Microsoft publishes Open Specifications documentation for protocols,
|
||||
file formats, languages, standards as well as overviews of the interaction
|
||||
among each of these technologies.
|
||||
|
||||
\h Copyrights.
|
||||
|
||||
This documentation is covered by Microsoft copyrights. Regardless of any other
|
||||
terms that are contained in the terms of use for the Microsoft website that
|
||||
hosts this documentation, you may make copies of it in order to develop
|
||||
implementations of the technologies described in the Open Specifications
|
||||
and may distribute portions of it in your implementations using these
|
||||
technologies or your documentation as necessary to properly document the
|
||||
implementation. You may also distribute in your implementation, with or without
|
||||
modification, any schema, IDL's, or code samples that are included in the
|
||||
documentation. This permission also applies to any documents that are
|
||||
referenced in the Open Specifications.
|
||||
|
||||
\h No Trade Secrets.
|
||||
|
||||
Microsoft does not claim any trade secret rights in this documentation.
|
||||
|
||||
\h Patents.
|
||||
|
||||
Microsoft has patents that may cover your implementations of the technologies
|
||||
described in the Open Specifications. Neither this notice nor Microsoft's
|
||||
delivery of the documentation grants any licenses under those or any other
|
||||
Microsoft patents. However, a given Open Specification may be covered by
|
||||
Microsoft's Open Specification Promise (available here:
|
||||
http://www.microsoft.com/interop/osp) or the Community Promise
|
||||
(available here: http://www.microsoft.com/interop/cp/default.mspx).
|
||||
If you would prefer a written license, or if the technologies described in
|
||||
the Open Specifications are not covered by the Open Specifications Promise
|
||||
or Community Promise, as applicable, patent licenses are available by
|
||||
contacting iplg@microsoft.com.
|
||||
|
||||
\h Trademarks.
|
||||
|
||||
The names of companies and products contained in this
|
||||
documentation may be covered by trademarks or similar intellectual
|
||||
property rights. This notice does not grant any licenses under those rights.
|
||||
|
||||
\h Fictitious Names.
|
||||
|
||||
The example companies, organizations, products,
|
||||
domain names, e-mail addresses, logos, people, places, and events depicted in
|
||||
this documentation are fictitious. No association with any real company,
|
||||
organization, product, domain name, email address, logo, person, place, or
|
||||
event is intended or should be inferred.
|
||||
|
||||
\h Reservation of Rights.
|
||||
|
||||
All other rights are reserved, and this notice does
|
||||
not grant any rights other than specifically described above, whether by
|
||||
implication, estoppel, or otherwise.
|
||||
|
||||
\h Tools.
|
||||
|
||||
The Open Specifications do not require the use of Microsoft
|
||||
programming tools or programming environments in order for you to develop an
|
||||
implementation. If you have access to Microsoft programming tools and
|
||||
environments you are free to take advantage of them. Certain Open
|
||||
Specifications are intended for use in conjunction with publicly available
|
||||
standard specifications and network programming art, and assumes that the
|
||||
reader either is familiar with the aforementioned material or has immediate
|
||||
access to it.
|
||||
|
||||
INCLUDE FILES: usb/usbTgt.h
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTgtRndish
|
||||
#define __INCusbTgtRndish
|
||||
|
||||
#include <usb/usbTgt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define MEDIUM_TYPE_END_EMULATOR 0x01
|
||||
#define MEDIUM_TYPE_END_BRIDGE 0x02
|
||||
|
||||
/* The RNDIS multicast list count */
|
||||
|
||||
#define RNDIS_MAX_MCAST_LIST_SZ 12
|
||||
#define RNDIS_CTRL_MSG_BUF_SIZE 256
|
||||
|
||||
IMPORT int sysClkRateGet();
|
||||
|
||||
|
||||
#define RNDIS_TX_TIMEOUT (5 * sysClkRateGet()) /* in ticks */
|
||||
#define RNDIS_TX_TIMEOUT_NO_WAIT (0)
|
||||
|
||||
/* 2.8 Remote NDIS Version (RNDIS Specification 1.1) */
|
||||
|
||||
#define RNDIS_MAJOR_VERSION 1
|
||||
#define RNDIS_MINOR_VERSION 0
|
||||
|
||||
/* 2.9 Status Value (RNDIS Specification 1.1) */
|
||||
|
||||
#define RNDIS_STATUS_SUCCESS 0x00000000 /* Success */
|
||||
#define RNDIS_STATUS_FAILURE 0xC0000001
|
||||
#define RNDIS_STATUS_INVALID_DATA 0xC0010015
|
||||
#define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BB
|
||||
#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000B
|
||||
#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000C
|
||||
|
||||
/* 3 Message Set for Connectionless (802.3) Device (RNDIS Specification 1.1) */
|
||||
|
||||
#define REMOTE_NDID_PACKET_MSG 0x00000001
|
||||
|
||||
#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002 /* Init the device */
|
||||
#define REMOTE_NDIS_HALT_MSG 0x00000003 /* Halt the device */
|
||||
#define REMOTE_NDIS_QUERY_MSG 0x00000004 /* Send a query OID */
|
||||
#define REMOTE_NDIS_SET_MSG 0x00000005 /* Send a set OID */
|
||||
#define REMOTE_NDIS_RESET_MSG 0x00000006 /* Perform a soft reset on the device */
|
||||
#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007 /* 802.3 link status or undefined msg error */
|
||||
#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008 /* Keep alive */
|
||||
|
||||
#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002 /* Response init msg */
|
||||
#define REMOTE_NDIS_QUERY_CMPLT 0x80000004 /* Response query msg */
|
||||
#define REMOTE_NDIS_SET_CMPLT 0x80000005 /* Response set msg */
|
||||
#define REMOTE_NDIS_RESET_CMPLT 0x80000006 /* Response reset msg */
|
||||
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008 /* Response keepalive msg */
|
||||
|
||||
|
||||
/* 4. Required NDIS OIDs (RNDIS Specification 1.1) */
|
||||
|
||||
/* 4.1 General OIDs (RNDIS Specification 1.1) */
|
||||
|
||||
#define OID_GEN_SUPPORTED_LIST 0x00010101 /* List of supported OIDs */
|
||||
#define OID_GEN_HARDWARE_STATUS 0x00010102 /* Hardware status */
|
||||
#define OID_GEN_MEDIA_SUPPORTED 0x00010103 /* Media types supported */
|
||||
#define OID_GEN_MEDIA_IN_USE 0x00010104 /* Media types in use */
|
||||
|
||||
|
||||
#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 /**/
|
||||
|
||||
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
|
||||
#define OID_GEN_LINK_SPEED 0x00010107
|
||||
|
||||
#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 /**/
|
||||
#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 /**/
|
||||
|
||||
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
|
||||
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
|
||||
#define OID_GEN_VENDOR_ID 0x0001010C
|
||||
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
|
||||
|
||||
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
|
||||
|
||||
#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F /**/
|
||||
#define OID_GEN_DRIVER_VERSION 0x00010110 /**/
|
||||
|
||||
|
||||
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
|
||||
|
||||
#define OID_GEN_PROTOCOL_OPTIONS 0x00010112
|
||||
#define OID_GEN_MAC_OPTIONS 0x00010113
|
||||
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
|
||||
#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
|
||||
#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
|
||||
#define OID_GEN_SUPPORTED_GUIDS 0x00010117
|
||||
#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
|
||||
#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
|
||||
#define OID_GEN_MACHINE_NAME 0x0001021A
|
||||
#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
|
||||
#define OID_GEN_VLAN_ID 0x0001021C
|
||||
|
||||
/* Optional OIDs */
|
||||
|
||||
#define OID_GEN_MEDIA_CAPABILITIES 0x00010201
|
||||
#define OID_GEN_PHYSICAL_MEDIUM 0x00010202
|
||||
|
||||
/* Required statistics OIDs */
|
||||
|
||||
#define OID_GEN_XMIT_OK 0x00020101
|
||||
#define OID_GEN_RCV_OK 0x00020102
|
||||
#define OID_GEN_XMIT_ERROR 0x00020103
|
||||
#define OID_GEN_RCV_ERROR 0x00020104
|
||||
#define OID_GEN_RCV_NO_BUFFER 0x00020105
|
||||
|
||||
/* Optional statistics OIDs */
|
||||
|
||||
#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
|
||||
#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
|
||||
#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
|
||||
#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
|
||||
#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
|
||||
#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
|
||||
#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207
|
||||
#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
|
||||
#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209
|
||||
#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
|
||||
#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
|
||||
#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
|
||||
#define OID_GEN_RCV_CRC_ERROR 0x0002020D
|
||||
#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
|
||||
#define OID_GEN_GET_TIME_CAPS 0x0002020F
|
||||
#define OID_GEN_GET_NETCARD_TIME 0x00020210
|
||||
#define OID_GEN_NETCARD_LOAD 0x00020211
|
||||
#define OID_GEN_DEVICE_PROFILE 0x00020212
|
||||
#define OID_GEN_INIT_TIME_MS 0x00020213
|
||||
#define OID_GEN_RESET_COUNTS 0x00020214
|
||||
#define OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
|
||||
#define OID_GEN_FRIENDLY_NAME 0x00020216
|
||||
#define OID_GEN_MINIPORT_INFO 0x00020217
|
||||
#define OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
|
||||
|
||||
/* IEEE 802.3 (Ethernet) OIDs */
|
||||
|
||||
#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
|
||||
|
||||
#define OID_802_3_PERMANENT_ADDRESS 0x01010101
|
||||
#define OID_802_3_CURRENT_ADDRESS 0x01010102
|
||||
#define OID_802_3_MULTICAST_LIST 0x01010103
|
||||
#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
|
||||
#define OID_802_3_MAC_OPTIONS 0x01010105
|
||||
#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
|
||||
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102
|
||||
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
|
||||
#define OID_802_3_XMIT_DEFERRED 0x01020201
|
||||
#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
|
||||
#define OID_802_3_RCV_OVERRUN 0x01020203
|
||||
#define OID_802_3_XMIT_UNDERRUN 0x01020204
|
||||
#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
|
||||
#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
|
||||
#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
|
||||
|
||||
/* OID_GEN_MINIPORT_INFO constants */
|
||||
|
||||
#define NDIS_MINIPORT_BUS_MASTER 0x00000001
|
||||
#define NDIS_MINIPORT_WDM_DRIVER 0x00000002
|
||||
#define NDIS_MINIPORT_SG_LIST 0x00000004
|
||||
#define NDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008
|
||||
#define NDIS_MINIPORT_INDICATES_PACKETS 0x00000010
|
||||
#define NDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020
|
||||
#define NDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040
|
||||
#define NDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080
|
||||
#define NDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100
|
||||
#define NDIS_MINIPORT_IS_NDIS_5 0x00000200
|
||||
#define NDIS_MINIPORT_IS_CO 0x00000400
|
||||
#define NDIS_MINIPORT_DESERIALIZE 0x00000800
|
||||
#define NDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000
|
||||
#define NDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000
|
||||
#define NDIS_MINIPORT_NETBOOT_CARD 0x00004000
|
||||
#define NDIS_MINIPORT_PM_SUPPORTED 0x00008000
|
||||
#define NDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000
|
||||
#define NDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000
|
||||
#define NDIS_MINIPORT_HIDDEN 0x00040000
|
||||
#define NDIS_MINIPORT_SWENUM 0x00080000
|
||||
#define NDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000
|
||||
#define NDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000
|
||||
#define NDIS_MINIPORT_HARDWARE_DEVICE 0x00400000
|
||||
#define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000
|
||||
#define NDIS_MINIPORT_64BITS_DMA 0x01000000
|
||||
|
||||
|
||||
#define OID_GEN_SUPPORTED_LIST 0x00010101
|
||||
#define OID_GEN_HARDWARE_STATUS 0x00010102
|
||||
#define OID_GEN_MEDIA_SUPPORTED 0x00010103
|
||||
#define OID_GEN_MEDIA_IN_USE 0x00010104
|
||||
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
|
||||
#define OID_GEN_LINK_SPEED 0x00010107
|
||||
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
|
||||
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
|
||||
#define OID_GEN_VENDOR_ID 0x0001010C
|
||||
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
|
||||
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
|
||||
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
|
||||
#define OID_GEN_MAC_OPTIONS 0x00010113
|
||||
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
|
||||
#define OID_GEN_SUPPORTED_GUIDS 0x00010117
|
||||
|
||||
#define RNDIS_DF_CONNECTIONLESS (0x00000001)
|
||||
|
||||
/* Optional Power Management OIDs */
|
||||
|
||||
#define OID_PNP_CAPABILITIES 0xFD010100
|
||||
#define OID_PNP_SET_POWER 0xFD010101
|
||||
#define OID_PNP_QUERY_POWER 0xFD010102
|
||||
|
||||
/* Optional Network Wakeup */
|
||||
|
||||
#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
|
||||
#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
|
||||
#define OID_PNP_ENABLE_WAKE_UP 0xFD010106
|
||||
|
||||
/* The RNDIS MAC options */
|
||||
|
||||
#define RNDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
|
||||
#define RNDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
|
||||
|
||||
/* Bits for OID_PNP_ENABLE_WAKE_UP */
|
||||
|
||||
#define RNDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001
|
||||
#define RNDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002
|
||||
#define RNDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004
|
||||
|
||||
/* wake-up capabilities */
|
||||
|
||||
#define RNDIS_DEVICE_WAKE_UP_ENABLE 0x00000001
|
||||
#define RNDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
|
||||
#define RNDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
|
||||
|
||||
/* The medium type which can be supported by RNDIS */
|
||||
|
||||
#define RNDIS_MEDIUM_802_3 0x00000000 /* Specifies an Ethernet medium. */
|
||||
#define RNDIS_MEDIUM_802_5 0x00000001 /* Specifies a token ring medium. */
|
||||
#define RNDIS_MEDIUM_Fddi 0x00000002 /* FDDI */
|
||||
#define RNDIS_MEDIUM_Wan 0x00000003 /* Specifies a WAN medium. */
|
||||
#define RNDIS_MEDIUM_LocalTalk 0x00000004 /* LocalTalk. */
|
||||
#define RNDIS_MEDIUM_ArcnetRaw 0x00000006 /* ArcnetRaw */
|
||||
#define RNDIS_MEDIUM_Arcnet878_2 0x00000007 /* Arcnet878_2 */
|
||||
#define RNDIS_MEDIUM_Atm 0x00000008 /* Atm */
|
||||
#define RNDIS_MEDIUM_WirelessWan 0x00000009 /* WirelessWan */
|
||||
#define RNDIS_MEDIUM_Irda 0x0000000a /* Specifies an IrDA (infrared) medium. */
|
||||
#define RNDIS_MEDIUM_CoWan 0x0000000b /* CoWan */
|
||||
#define RNDIS_MEDIUM_Max 0x0000000d /* Not a real medium, defined as an upper-bound. */
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RNDIS_UNINITIALIZED,
|
||||
RNDIS_INITIALIZED,
|
||||
RNDIS_DATA_INITIALIZED
|
||||
} RNDIS_STATE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RNDIS_MEDIA_STATE_CONNECTED = 0,
|
||||
RNDIS_MEDIA_STATE_DISCONNECTED
|
||||
} NDIS_MEDIA_STATE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RNDIS_HARDWARE_STATUS_READY,
|
||||
RNDIS_HARDWARE_STATUS_INITIALIZING,
|
||||
RNDIS_HARDWARE_STATUS_RESET,
|
||||
RNDIS_HARDWARE_STATUS_CLOSING,
|
||||
RNDIS_HARDWARE_STATUS_NOTREADY
|
||||
} NDIS_HARDWARE_STATUS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 msgType;
|
||||
UINT32 msgLen;
|
||||
} RNDIS_MSG_HDR,*pRNDIS_MSG_HDR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 requestId;
|
||||
UINT32 majorVersion;
|
||||
UINT32 minorVersion;
|
||||
UINT32 maxXferSize;
|
||||
}RNDIS_INITIALIZE_MSG,*pRNDIS_INITIALIZE_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 requestId;
|
||||
UINT32 status;
|
||||
UINT32 majorVersion;
|
||||
UINT32 minorVersion;
|
||||
UINT32 deviceFlags;
|
||||
UINT32 medium;
|
||||
UINT32 maxPktsPerMsg;
|
||||
UINT32 maxXferSize;
|
||||
UINT32 pktAlignmentFactor;
|
||||
UINT32 AFListOffset;
|
||||
UINT32 AFListSize;
|
||||
}RNDIS_INITIALIZE_CMPLT,*pRNDIS_INITIALIZE_CMPLT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 requestId;
|
||||
}RNDIS_HALT_MSG,*pRNDIS_HALT_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 requestId;
|
||||
}RNDIS_KEEPALIVE_MSG,*pRNDIS_KEEPALIVE_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 requestId;
|
||||
UINT32 oid;
|
||||
UINT32 infoBufLen;
|
||||
UINT32 infoBufOffset;
|
||||
UINT32 devVcHandle;
|
||||
}RNDIS_QUERY_MSG,*pRNDIS_QUERY_MSG;
|
||||
|
||||
typedef RNDIS_QUERY_MSG RNDIS_SET_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 requestId;
|
||||
UINT32 status;
|
||||
UINT32 infoBufLen;
|
||||
UINT32 infoBufOffset;
|
||||
}RNDIS_QUERY_CMPLT,*pRNDIS_QUERY_CMPLT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 requestId;
|
||||
UINT32 status;
|
||||
}RNDIS_SET_CMPLT,*pRNDIS_SET_CMPLT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 requestId;
|
||||
UINT32 status;
|
||||
}RNDIS_KEEPALIVE_CMPLT,*pRNDIS_KEEPALIVE_CMPLT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 reserved;
|
||||
}RNDIS_RESET_MSG,*pRNDIS_RESET_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 status;
|
||||
UINT32 addressingReset;
|
||||
}RNDIS_RESET_CMPLT,*pRNDIS_RESET_CMPLT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_MSG_HDR hdr;
|
||||
UINT32 status;
|
||||
UINT32 statusBufLen;
|
||||
UINT32 statusBufOffset;
|
||||
}RNDIS_INDICATE_STATUS_MSG,*pRNDIS_INDICATE_STATUS_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 msgType;
|
||||
UINT32 reserved;
|
||||
}RESPONSE_AVAILABLE_MSG,*pRESPONSE_AVAILABLE_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 msgType;
|
||||
UINT32 msgLen;
|
||||
UINT32 dataOffset;
|
||||
UINT32 dataLen;
|
||||
UINT32 oobDataOffset;
|
||||
UINT32 oobDataLen;
|
||||
UINT32 oobNumDataElem;
|
||||
UINT32 perPktInfoOffset;
|
||||
UINT32 perPktInfoLength;
|
||||
UINT32 vcHandle;
|
||||
UINT32 reserved;
|
||||
}RNDIS_PACKET_MSG,*pRNDIS_PACKET_MSG;
|
||||
|
||||
/* power states */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RNDIS_DEVICE_STATE_UNSPECIFIED,
|
||||
RNDIS_DEVICE_STATE_D0,
|
||||
RNDIS_DEVICE_STATE_D1,
|
||||
RNDIS_DEVICE_STATE_D2,
|
||||
RNDIS_DEVICE_STATE_D3,
|
||||
RNDIS_DEVICE_STATE_MAXIMUM
|
||||
}RNDIS_DEVICE_POWER_STATE;
|
||||
|
||||
/* wake-up capabilities */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_DEVICE_POWER_STATE minMagicPacketWakeUp;
|
||||
RNDIS_DEVICE_POWER_STATE minPatternWakeUp;
|
||||
RNDIS_DEVICE_POWER_STATE minLinkChangeWakeUp;
|
||||
}RNDIS_PM_WAKE_UP_CAPABILITIES, *pRNDIS_PM_WAKE_UP_CAPABILITIES;
|
||||
|
||||
/* PnP capabilities */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 flags;
|
||||
RNDIS_PM_WAKE_UP_CAPABILITIES wakeUpCapabilities;
|
||||
}RNDIS_PNP_CAPABILITIES,*pRNDIS_PNP_CAPABILITIES;
|
||||
|
||||
/* Packet pattern */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 priority;
|
||||
UINT32 reserved;
|
||||
UINT32 maskSize;
|
||||
UINT32 patternOffset;
|
||||
UINT32 patternSize;
|
||||
UINT32 patternFlags;
|
||||
}RNDIS_PM_PACKET_PATTERN,*pRNDIS_PM_PACKET_PATTERN;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
NODE node;
|
||||
UINT32 length;
|
||||
}RNDIS_PM_PATTERN_LIST_HEADER,* pRNDIS_PM_PATTERN_LIST_HEADER;
|
||||
|
||||
/* The power management pattern list entry */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RNDIS_PM_PATTERN_LIST_HEADER header;
|
||||
RNDIS_PM_PACKET_PATTERN pattern;
|
||||
}RNDIS_PM_PATTERN_LIST_ENTRY,* pRNDIS_PM_PATTERN_LIST_ENTRY;
|
||||
|
||||
/* The configuration parameter */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 parameterNameOffset;
|
||||
UINT32 parameterNameLength;
|
||||
UINT32 parameterType;
|
||||
UINT32 parameterValueOffset;
|
||||
UINT32 parameterValueLength;
|
||||
}RNDIS_CONFIG_PARAMETER,*pRNDIS_CONFIG_PARAMETER;
|
||||
|
||||
/* Add macro to mask the RNDIS task mode */
|
||||
|
||||
#undef USBTGT_NET_TASK_MODE
|
||||
|
||||
/* The RNDIS data structure */
|
||||
|
||||
typedef struct usbtgt_rndis
|
||||
{
|
||||
NODE rndisNode; /* Node used to link on the dev list */
|
||||
USB_TARG_CHANNEL targChannel; /* TargChannel */
|
||||
SEM_ID rndisMutex; /* Used to protect the resource */
|
||||
char * pMediumName; /* Medium name attached on RNDIS */
|
||||
UINT8 uMediumUnit; /* Medium unit attached on RNDIS */
|
||||
UINT8 uMediumType; /* Medium type attached on RNDIS */
|
||||
struct usbtgt_binder * pBinder; /* Pointer of the medium binder */
|
||||
#if defined (USBTGT_NET_TASK_MODE)
|
||||
MSG_Q_ID RndisTaskMsgQID; /* Task msgQ id */
|
||||
OS_THREAD_ID RndisTaskID; /* Tasl ID */
|
||||
#endif /* USBTGT_NET_TASK_MODE */
|
||||
UINT8 requestMsgBuf[RNDIS_CTRL_MSG_BUF_SIZE];
|
||||
UINT8 replyMsgBuf[RNDIS_CTRL_MSG_BUF_SIZE];
|
||||
UINT16 uRequestMsgLen; /* Length of the request message */
|
||||
UINT16 uReplyMsgLen; /* Length of the reply message */
|
||||
USB_TARG_PIPE intInPipeHandle; /* Interrup In pipe handle */
|
||||
USB_ERP intInErp; /* Interrup In ERP */
|
||||
UINT8 intInBuf[8]; /* Buffer used by Interrupt In transaction */
|
||||
SEM_ID intInErpMutex; /* Interrupt In transfer mutex */
|
||||
UINT8 uIntInPipeStatus; /* Interrupt In pipe stall or not */
|
||||
BOOL bIntInErpUsed; /* Interrupt In ERP is used or not */
|
||||
USB_TARG_PIPE bulkOutPipeHandle; /* Bulk pipe handle */
|
||||
USB_ERP bulkOutErp; /* Bulk ERP */
|
||||
UINT8 * pBulkOutBuf; /* Buffer used by Bulk Out transaction */
|
||||
SEM_ID bulkOutErpMutex; /* Bulk Out transfer mutex */
|
||||
UINT8 uBulkOutPipeStatus; /* Bulk Out pipe stall or not */
|
||||
BOOL bBulkOutErpUsed; /* Bulk Out ERP is used or not */
|
||||
USB_TARG_PIPE bulkInPipeHandle; /* Bulk pipe handle */
|
||||
USB_ERP bulkInErp; /* Bulk ERP */
|
||||
UINT8 * pBulkInBuf; /* Buffer used by Bulk In transaction */
|
||||
SEM_ID bulkInErpMutex; /* Bulk In transfer mutex */
|
||||
UINT8 uBulkInPipeStatus; /* Bulk In pipe stall or not */
|
||||
BOOL bBulkInErpUsed; /* Bulk In ERP is used or not */
|
||||
RNDIS_STATE rndisState; /* Rndis state */
|
||||
UINT32 rndisFilterValue; /* Filter value used by the NIC */
|
||||
UINT8 uConfigurationValue; /* Configuration value */
|
||||
UINT8 uInterfaceNubmer; /* Number of interface which holds this endpoint */
|
||||
UINT8 uAltSetting; /* Alternate Setting */
|
||||
UINT32 uSpeed; /* USB Speed */
|
||||
RNDIS_DEVICE_POWER_STATE powerState; /* Power state */
|
||||
BOOL wakeUpnMagicPacketEnable;
|
||||
BOOL wakeUpPatternMatchEnable;
|
||||
BOOL wakeUpLinkChangeEnable;
|
||||
LIST wakeUpPatternList;
|
||||
}USBTGT_RNDIS,*pUSBTGT_RNDIS;
|
||||
|
||||
/* The notify command */
|
||||
|
||||
typedef enum usbtgt_rndis_notify_code
|
||||
{
|
||||
USBTGT_RNDIS_NOTIFY_UNKNOWN = (0),
|
||||
USBTGT_RNDIS_NOTIFY_RESET_EVENT = (1),
|
||||
USBTGT_RNDIS_NOTIFY_DISCONNECT_EVENT = (2),
|
||||
USBTGT_RNDIS_NOTIFY_SUSPEND_EVENT = (3),
|
||||
USBTGT_RNDIS_NOTIFY_RESUME_EVENT = (4),
|
||||
USBTGT_RNDIS_NOTIFY_DATA_CHANNEL_RESET = (5),
|
||||
USBTGT_RNDIS_NOTIFY_REQUIRE_DATA_OUT = (6),
|
||||
USBTGT_RNDIS_NOTIFY_XMIT_DATA_TO_MEDIUM = (7),
|
||||
USBTGT_RNDIS_NOTIFY_RCV_DATA_FROM_MEDIUM = (8)
|
||||
}USBTGT_RNDIS_NOTIFY_CODE;
|
||||
|
||||
/* Notify info data structure */
|
||||
|
||||
typedef struct usbtgt_rndis_notify_info
|
||||
{
|
||||
struct usbtgt_rndis * pUsbTgtRndis; /* RNDIS device pointer */
|
||||
USBTGT_RNDIS_NOTIFY_CODE NotifyCode; /* The code of the notification */
|
||||
void * pContext; /* The context used by the notification */
|
||||
} USBTGT_RNDIS_NOTIFY_INFO,*pUSBTGT_RNDIS_NOTIFY_INFO;
|
||||
|
||||
/* externs */
|
||||
|
||||
IMPORT STATUS usbTgtRndisUnInit
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
IMPORT STATUS usbTgtRndisInit
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
IMPORT void usbTgtRndisManagementNotify
|
||||
(
|
||||
pUSBTGT_RNDIS pUsbTgtRndis,
|
||||
USBTGT_RNDIS_NOTIFY_CODE NotifyCode,
|
||||
void * pContext
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTgtRndish */
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/* usbTgtSer.h - usb target serial emulator common header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01f,18may12,s_z Add support for USB 3.0 target (WIND00326012)
|
||||
01e,08apr11,ghs Fix code coverity issue(WIND00264893)
|
||||
01d,22mar11,ghs Fix structure declare error
|
||||
01c,09mar11,ghs Adapt code format
|
||||
01b,07mar11,ghs Fix code review issues
|
||||
01a,26jan11,ghs written
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTgtSerh
|
||||
#define __INCusbTgtSerh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <usb/usbTgt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
#define MAX_TCD_NAME_LEN 50
|
||||
|
||||
#define USBTGT_SER_MAX_BUFF_LEN 512
|
||||
#define USBTGT_SER_MAX_ERP_BUFF_SIZE 2048
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/* structure of target serial device */
|
||||
|
||||
typedef struct usbtgt_ser_dev
|
||||
{
|
||||
USB_TARG_CHANNEL targChannel; /* Target channel */
|
||||
UINT8 uConfiguration;
|
||||
UINT8 uControlIfAltSetting;
|
||||
UINT8 uDataIfAltSetting;
|
||||
|
||||
USB_TARG_PIPE bulkOutPipe;
|
||||
USB_ERP bulkOutErp;
|
||||
BOOL bulkOutInUse;
|
||||
BOOL bulkOutBfrValid;
|
||||
BOOL bulkOutStallStatus;
|
||||
|
||||
USB_TARG_PIPE bulkInPipe;
|
||||
USB_ERP bulkInErp;
|
||||
BOOL bulkInInUse;
|
||||
BOOL bulkInBfrValid;
|
||||
BOOL bulkInStallStatus;
|
||||
|
||||
USB_ERP intInErp;
|
||||
BOOL intInInUse;
|
||||
pVOID intInPipe;
|
||||
|
||||
UINT8 * bulkOutData;
|
||||
BOOL bulkOutDataInUse;
|
||||
UINT8 * bulkInData;
|
||||
BOOL bulkInDataInUse;
|
||||
|
||||
struct usbtgt_acm_sio_chan * pChan;
|
||||
} USBTGT_SER_DEV, *pUSBTGT_SER_DEV;
|
||||
|
||||
/* state of emulator port */
|
||||
|
||||
typedef enum usbTgtDevPortState
|
||||
{
|
||||
USBTGT_SER_PORT_CLOSE = 0,
|
||||
USBTGT_SER_PORT_CONNECT = 1,
|
||||
USBTGT_SER_PORT_OPEN = 2
|
||||
} USB_TGT_SER_PORT_STATE;
|
||||
|
||||
/* sioChan structure for device and SIO libs */
|
||||
|
||||
typedef struct usbtgt_acm_sio_chan
|
||||
{
|
||||
/* SIO_DRV_FUNCS *MUST* be first */
|
||||
|
||||
SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */
|
||||
|
||||
/* callbacks */
|
||||
|
||||
STATUS (* getTxChar) (void *, char *);
|
||||
STATUS (* putRcvChar) (void *, char);
|
||||
void * getTxArg;
|
||||
void * putRcvArg;
|
||||
|
||||
/* misc */
|
||||
|
||||
VXB_DEVICE_ID pDev; /* bus subsystem: device ID */
|
||||
int channelNo; /* channel number */
|
||||
int baudFreq; /* current baud rate */
|
||||
int mode; /* current mode (interrupt or poll) */
|
||||
uint_t options; /* Hardware options */
|
||||
THREAD_HANDLE txThread;
|
||||
int devId;
|
||||
|
||||
USB_CDC_LINE_CODING lineCoding;
|
||||
UINT16 controlLineStae;
|
||||
BOOL onClosing;
|
||||
int ttyNum;
|
||||
|
||||
USB_TGT_SER_PORT_STATE portState;
|
||||
|
||||
char * dummyBfr;
|
||||
size_t dummyBfrSize;
|
||||
size_t dummyBfrDataSize;
|
||||
|
||||
UINT32 reqTxLen;
|
||||
UINT32 actTxLen;
|
||||
UINT32 actRxLen;
|
||||
struct usbtgt_ser_dev * pUsbTgtSerDev;
|
||||
} USBTGT_ACM_SIO_CHAN;
|
||||
|
||||
/* globals */
|
||||
|
||||
void usbTgtSerTtyRemove(int);
|
||||
|
||||
void usbTgtSerInstInit(VXB_DEVICE_ID);
|
||||
|
||||
void usbTgtSerInstInit2(VXB_DEVICE_ID);
|
||||
|
||||
void usbTgtSerInstConnect(VXB_DEVICE_ID);
|
||||
|
||||
void usbTgtSerBulkInErpCallback(pVOID);
|
||||
|
||||
void usbTgtSerBulkOutErpCallback(pVOID);
|
||||
|
||||
void usbTgtSerSioIntRcv(USBTGT_ACM_SIO_CHAN *);
|
||||
|
||||
void usbTgtSerSioFlushBuffer(USBTGT_ACM_SIO_CHAN *);
|
||||
|
||||
void usbTgtSerTest(char *);
|
||||
|
||||
BOOL usbTgtSerPortStateCheck(USBTGT_ACM_SIO_CHAN *);
|
||||
|
||||
STATUS usbTgtSerInit(int);
|
||||
|
||||
STATUS usbTgtSerUnInit(int);
|
||||
|
||||
STATUS usbTgtSerBulkInErpInit(pUSBTGT_SER_DEV, UINT8 *, UINT32,
|
||||
ERP_CALLBACK, pVOID);
|
||||
|
||||
STATUS usbTgtSerBulkOutErpInit(pUSBTGT_SER_DEV, UINT8 *, UINT32,
|
||||
ERP_CALLBACK, pVOID);
|
||||
|
||||
STATUS usbTgtSerBulkInTransfer(pUSBTGT_SER_DEV, char *, size_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTgtSerh */
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
/* usbTransUnit.h - Translation Unit definitions */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005-2008, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01j,15jul10,ghs Add magic number for USBTU_PIPE_INFO(WIND00216670)
|
||||
01i,28jun10,w_x Avoid dynamical alloc/free for IRP context (WIND00216670)
|
||||
01h,29apr10,pad Moved extern C statement after include statements.
|
||||
01g,15mar10,j_x Changed for USB debug (WIND00184542)
|
||||
01f,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01e,11jul08,w_x WIND00113466 and WIND00121282 merge changes
|
||||
01d,04jun08,w_x Removed msgQ mechanism for device dynamic event handling;
|
||||
added pDriver for USBTU_DEVICE structure. (WIND00121282 fix)
|
||||
01c,02feb07,ami Path of usbHst.h changed
|
||||
01b,03jan06,ami New structure created (SPR #116302 Fix)
|
||||
01a,06jan05,ami added irpMutext in USBTU_PIPE_INFO structure. (SPR #102674)
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This file defines constants and structures related to the Translation
|
||||
Unit.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbTransUnith
|
||||
#define __INCusbTransUnith
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <usb/usbPlatform.h>
|
||||
#include <usb/usb.h> /* general USB definitions */
|
||||
#include <usb/usbLib.h> /* USB utility functions */
|
||||
#include <usb/usbdLib.h> /* USBD interface */
|
||||
#include <usb/ossLib.h> /* os specific services */
|
||||
#include <usb/usbQueueLib.h>
|
||||
#include <usb/usbListLib.h>
|
||||
|
||||
#include <msgQLib.h>
|
||||
#include <taskLib.h>
|
||||
#include <semLib.h>
|
||||
#include <fioLib.h>
|
||||
#include <string.h>
|
||||
#include <wvLib.h>
|
||||
|
||||
#include <usb/usbHst.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/* String length definition */
|
||||
|
||||
#define USBTU_NAME_LEN 32 /* Maximum length for name */
|
||||
|
||||
/* Wind View Event ID's */
|
||||
|
||||
#define USBTU_WV_CLIENT_INIT 23000 /* Client Initialization event ID */
|
||||
#define USBTU_WV_CLIENT_TRANSFER 23001 /* Client Data Transfer event ID */
|
||||
#define USBTU_WV_CLIENT_STD 23002 /* Client Standard Requests event ID */
|
||||
#define USBTU_WV_USBD_INIT 23003 /* USBD Initialization/Shutdown event ID */
|
||||
|
||||
/* Wind View Event Filter */
|
||||
|
||||
#define USBTU_WV_FILTER 0x00000001
|
||||
|
||||
/* Wind View Event Log Message Size */
|
||||
|
||||
#define USBTU_WV_LOGSIZE 80
|
||||
|
||||
/* Usbtu pipe info magic number */
|
||||
|
||||
#define USBTU_PIPE_INFO_MAGIC_NUM 0x12345678
|
||||
|
||||
/* Typedefs */
|
||||
|
||||
/*
|
||||
* USBTU_EVENTCODE
|
||||
*/
|
||||
|
||||
typedef enum usbtu_eventcode
|
||||
{
|
||||
ADDDEVICE, /* device attachment event code */
|
||||
REMOVEDEVICE, /* device removal event code */
|
||||
SUSPENDDEVICE, /* device suspend event code */
|
||||
RESUMEDEVICE, /* device resume event code */
|
||||
IRPCOMPLETE /* IRP completion event code */
|
||||
} USBTU_EVENTCODE;
|
||||
|
||||
/*
|
||||
* USBTU_DEVICE_DRIVER
|
||||
*/
|
||||
|
||||
typedef struct usbtu_device_driver
|
||||
{
|
||||
UINT16 class; /* device class code */
|
||||
UINT16 subclass; /* device subclass code */
|
||||
UINT16 protocol; /* device protocol code */
|
||||
INT8 clientName[USBTU_NAME_LEN]; /* client name */
|
||||
USBD_ATTACH_CALLBACK attachCallback; /* attach/detach callback */
|
||||
USBD_MNGMT_CALLBACK mngmtCallback; /* managemnt callback */
|
||||
pVOID mngmtCallbackParam; /* management callback param */
|
||||
MSG_Q_ID msgQid; /* message queue id for client */
|
||||
MSG_Q_ID msgQidIrpComplete; /* message queue id for IrpComplete */
|
||||
THREAD_HANDLE threadHandle; /* thread handle */
|
||||
THREAD_HANDLE irpThreadHandle; /* thread handle */
|
||||
pUSBHST_DEVICE_DRIVER pDriverData; /* pointer to driver data */
|
||||
LINK tuDriverLink; /* pointer to next in list */
|
||||
} USBTU_DEVICE_DRIVER, *pUSBTU_DEVICE_DRIVER;
|
||||
|
||||
/*
|
||||
* USBTU_NODE_INFO
|
||||
*/
|
||||
|
||||
typedef struct usbtu_node_info
|
||||
{
|
||||
UINT32 hDevice; /* handle to the device */
|
||||
UINT16 configuration; /* device configuration */
|
||||
UINT16 interface; /* device interface */
|
||||
MSG_Q_ID msgQid; /* message queue id of client */
|
||||
LINK devLink; /* link */
|
||||
pUSBTU_DEVICE_DRIVER pDriver; /* dirver for this device */
|
||||
} USBTU_NODE_INFO, *pUSBTU_NODE_INFO;
|
||||
|
||||
/*
|
||||
* USBTU_PIPE_INFO
|
||||
*/
|
||||
|
||||
typedef struct usbtu_pipe_info
|
||||
{
|
||||
UINT32 hDevice; /* handle to the device */
|
||||
UINT8 endpointAddress; /* endpointaddress of pipe */
|
||||
UINT16 transferType; /* transfer type on pipe */
|
||||
LIST_HEAD irpList; /* list of irp pending on pipe */
|
||||
UINT8 markedForDeletion; /* indicates if pipe is marked for deletion */
|
||||
UINT32 uMaxPacketSize; /* Maximum packet size for the endpoint */
|
||||
UINT32 bandwidth;
|
||||
MUTEX_HANDLE irpMutex; /* for synchronisation */
|
||||
pUSB_IRP pPipeDeletionIrp; /* terminating IRP to delete the pipe safely */
|
||||
UINT32 uMagic; /* magic number */
|
||||
} USBTU_PIPE_INFO, *pUSBTU_PIPE_INFO;
|
||||
|
||||
/*
|
||||
* USBTU_CLIENTMSG
|
||||
*/
|
||||
|
||||
typedef struct usbtu_clientmsg
|
||||
{
|
||||
USBTU_EVENTCODE eventCode; /* event code */
|
||||
pUSB_IRP pIrp; /* pointer to IRP structure */
|
||||
UINT32 hDevice; /* handle to device */
|
||||
UINT16 interface; /* device interface */
|
||||
UINT16 class; /* device class code */
|
||||
UINT16 subclass; /* device subclass code */
|
||||
UINT16 protocol; /* device protocol code */
|
||||
}USBTU_CLIENTMSG, *pUSBTU_CLIENTMSG;
|
||||
|
||||
/*
|
||||
* USBTU_TUMSG
|
||||
*/
|
||||
|
||||
typedef struct usbtu_tumsg
|
||||
{
|
||||
USBTU_EVENTCODE eventCode; /* event code */
|
||||
UINT32 hDevice; /* handle to device */
|
||||
UINT16 interface; /* device interface */
|
||||
pVOID* ppDriverData; /* pointer to driver data */
|
||||
} USBTU_TUMSG, *pUSBTU_TUMSG;
|
||||
|
||||
/*
|
||||
* USBTU_DEVICE
|
||||
*/
|
||||
|
||||
typedef struct usbtu_device
|
||||
{
|
||||
MSG_Q_ID msgId; /* message queue id of the client - not used now */
|
||||
pUSBTU_DEVICE_DRIVER pDriver; /* dirver for this device */
|
||||
UINT16 class; /* device class code */
|
||||
UINT16 subclass; /* device subclass code */
|
||||
UINT16 protocol; /* device protocol code */
|
||||
} USBTU_DEVICE, *pUSBTU_DEVICE;
|
||||
|
||||
/* global variable declarations */
|
||||
|
||||
extern UINT32 usbtuInitWvFilter;
|
||||
extern LIST_HEAD usbtuClientList; /* list of clients registered with USBD */
|
||||
extern LIST_HEAD usbtuDevList; /* list of devices attached to USB */
|
||||
extern MUTEX_HANDLE usbtuMutex; /* mutex of Translation Unit */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbTransUnith */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
|
||||
@@ -0,0 +1,329 @@
|
||||
/* usbUas.h - USB Attached SCSI (UAS) Public Header */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01a,11jun11,w_x written
|
||||
*/
|
||||
|
||||
#ifndef __INCusbUash
|
||||
#define __INCusbUash
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <version.h>
|
||||
#include <usb/usb.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define USB_MSC_UAS_VERSION1 1
|
||||
#define USB_MSC_UAS_VERSION2 2
|
||||
#define USB_MSC_UAS_VERSION3 3
|
||||
#define USB_MSC_UAS_VERSION4 4
|
||||
#define USB_MSC_UAS_VERSION_SUPPORTED 4
|
||||
|
||||
/*
|
||||
* USB Interface Descriptor bInterfaceProtocol filed
|
||||
* for USB Attached SCSI (UAS) Transport Protocol.
|
||||
*/
|
||||
|
||||
#define USB_MSC_PROTOCOL_UAS 0x62
|
||||
|
||||
/*
|
||||
* 5.3.3.5 Pipe Usage class specific descriptor
|
||||
*
|
||||
* A Pipe Usage class specific descriptor shall be the first descriptor
|
||||
* following each endpoint descriptor referenced by the Interface
|
||||
* descriptor (see 5.2.3.3).
|
||||
*/
|
||||
|
||||
typedef struct usbUasPipeUsageDescr
|
||||
{
|
||||
UINT8 bLength; /* Size of this descriptor in bytes (0x04) */
|
||||
UINT8 bDescriptorType;/* Pipe Usage class specific descriptor (0x24) */
|
||||
UINT8 bPipeId; /* Identifies pipe associated with the EP Descr */
|
||||
UINT8 bRzv; /* Reserved */
|
||||
}USB_UAS_PIPE_USAGE_DESCR, *pUSB_UAS_PIPE_USAGE_DESCR;
|
||||
|
||||
/*
|
||||
* Table 9 - Pipe ID
|
||||
*
|
||||
* The bPipeId field identifies the pipe associated with the
|
||||
* endpoint descriptor. values 0, 05h-DFh, F0h-FFh are Reserved,
|
||||
* and E0h-EFh Vendor specific. The UAS spec defines the following
|
||||
* Pipe IDs.
|
||||
*/
|
||||
|
||||
#define USB_UAS_PIPE_ID_CMD 1 /* Command pipe */
|
||||
#define USB_UAS_PIPE_ID_STS 2 /* Status pipe */
|
||||
#define USB_UAS_PIPE_ID_DATA_IN 3 /* Data-in pipe */
|
||||
#define USB_UAS_PIPE_ID_DATA_OUT 4 /* Data-out pipe */
|
||||
|
||||
/*
|
||||
* Table 10 - IU ID field summary
|
||||
*
|
||||
* Summary of the Information Units (IUs) and the assoicated IU ID field.
|
||||
*
|
||||
* If a UAS target port processes an IU with an IU ID field conaining a
|
||||
* reserved value, then the UAS target port shall return a RESPONSE IU
|
||||
* with the RESPONSE CODE field set to INVALID INFORMATION UNIT.
|
||||
*
|
||||
* Values 0, 2, and 08h..FFh are Reserved. The UAS spec defines the
|
||||
* following IU IDs.
|
||||
*/
|
||||
|
||||
#define USB_UAS_IU_ID_CMD 1 /* COMMAND IU */
|
||||
#define USB_UAS_IU_ID_SENSE 3 /* SENSE IU */
|
||||
#define USB_UAS_IU_ID_RESPONSE 4 /* RESPONSE IU */
|
||||
#define USB_UAS_IU_ID_TASK_MGMT 5 /* TASK MANAGEMENT IU */
|
||||
#define USB_UAS_IU_ID_READ_READY 6 /* READ READY IU */
|
||||
#define USB_UAS_IU_ID_WRITE_READY 7 /* WRITE READY IU */
|
||||
|
||||
/*
|
||||
* Table 11 - IU Header
|
||||
*
|
||||
* All IUs include the header defined in table 11 as the first bytes
|
||||
* of the IU.
|
||||
*/
|
||||
|
||||
typedef struct usbUasIUHdr
|
||||
{
|
||||
UINT8 uID; /* IU ID, identifies the type of IU (see table 10) */
|
||||
UINT8 uRzv0; /* Reserved */
|
||||
UINT16 uTAG; /* The TAG field is in BIG ENDIAN */
|
||||
}USB_UAS_IU_HDR, *pUSB_UAS_IU_HDR;
|
||||
|
||||
/*
|
||||
* 6.2.2 COMMAND IU
|
||||
*
|
||||
* The COMMAND IU shall be contained in a single USB packet and shall
|
||||
* not share a USB packet with any other IU. Table 12 defines the
|
||||
* COMMAND IU.
|
||||
*/
|
||||
|
||||
typedef struct usbUasCmdIU
|
||||
{
|
||||
UINT8 uID; /* IU ID, identifies the type of IU (see table 10) */
|
||||
UINT8 uRzv0; /* Reserved */
|
||||
UINT16 uTAG; /* The TAG field is in BIG ENDIAN */
|
||||
#if (USB_MSC_UAS_VERSION_SUPPORTED < 4)
|
||||
UINT16 uLength; /* Number of bytes that follow in the COMMAND IU */
|
||||
#endif /* (USB_MSC_UAS_VERSION_SUPPORTED < 4) */
|
||||
UINT8 uPrioAttr; /* COMMAND PRIORITY and TASK ATTRIBUTE */
|
||||
UINT8 uRzv1; /* Reserved */
|
||||
#if (USB_MSC_UAS_VERSION_SUPPORTED >= 4)
|
||||
UINT8 uAddCDBLen; /* ADDITIONAL CDB LENGTH (n dwords) */
|
||||
UINT8 uRzv2; /* Reserved */
|
||||
#endif /* (USB_MSC_UAS_VERSION_SUPPORTED >= 4) */
|
||||
UINT64 uLUN; /* LOGICAL UNIT NUMBER in BIG ENDIAN */
|
||||
UINT8 pCDB[16]; /* CDB (may be followed by ADDITIONAL CDB BYTES) */
|
||||
}USB_UAS_CMD_IU, *pUSB_UAS_CMD_IU;
|
||||
|
||||
/*
|
||||
* Access macros for COMMAND PRIORITY field in <uPrioAttr>.
|
||||
*
|
||||
* The COMMAND PRIORITY field specifies the relative scheduling of
|
||||
* this command as defined in SAM-4.
|
||||
*/
|
||||
|
||||
#define USB_UAS_CMD_IU_PRIO_OFFSET 3
|
||||
#define USB_UAS_CMD_IU_PRIO_MASK ((0xF << 3))
|
||||
#define USB_UAS_CMD_IU_PRIO_GET(uPrioAttr) \
|
||||
(((uPrioAttr) >> 3) & 0xF)
|
||||
#define USB_UAS_CMD_IU_PRIO(uPrio) \
|
||||
(((uPrio) & 0xF) << 3)
|
||||
|
||||
/* Access macros for TASK ATTRIBUTE field in <uPrioAttr> */
|
||||
|
||||
#define USB_UAS_CMD_IU_ATTR_OFFSET 0
|
||||
#define USB_UAS_CMD_IU_ATTR_MASK (0x07)
|
||||
#define USB_UAS_CMD_IU_ATTR_GET(uPrioAttr) \
|
||||
((uPrioAttr) & 0x07)
|
||||
#define USB_UAS_CMD_IU_ATTR(uAttr) \
|
||||
((uAttr) & 0x07)
|
||||
|
||||
/*
|
||||
* Table 13 - TASK ATTRIBUTE field
|
||||
*
|
||||
* Specifies that the command be managed according to the rules for a
|
||||
* simple, head of queue, ordered, and automatic contingent allegiance
|
||||
* task attribute (see SAM-4).
|
||||
*
|
||||
* Values 3, 5, 6, 7 are Reserved.
|
||||
*/
|
||||
|
||||
#define USB_UAS_TASK_ATTR_SIMPLE 0 /* simple task attribute */
|
||||
#define USB_UAS_TASK_ATTR_Q_HEAD 1 /* head of queue task attribute */
|
||||
#define USB_UAS_TASK_ATTR_ORDERED 2 /* ordered task attribute */
|
||||
#define USB_UAS_TASK_ATTR_ACA 4 /* automatic contingent allegiance
|
||||
* task attribute */
|
||||
|
||||
/*
|
||||
* 6.2.3 READ READY IU
|
||||
*
|
||||
* The READ READY IU is sent by a UAS target port to inform the UAS
|
||||
* initiator port that the UAS target port is ready to send data for
|
||||
* a data-in command (see 6.3.5) or a bi-directional command (see 6.3.7).
|
||||
* UAS target devices that connect via SuperSpeed (see USB-3) shall
|
||||
* return an ERDY transaction packet (see USB-3) on the Data-in pipe
|
||||
* using the tag as the stream ID instead of the READ READY IU on the
|
||||
* Status pipe. The READ READY IU shall be contained in a single USB
|
||||
* packet and shall not share a USB packet with any other Information
|
||||
* Unit. Table 14 describes the READ READY IU.
|
||||
*/
|
||||
|
||||
typedef struct usbUasReadReadyIU
|
||||
{
|
||||
UINT8 uID; /* IU ID, identifies the type of IU (see table 10) */
|
||||
UINT8 uRzv0; /* Reserved */
|
||||
UINT16 uTAG; /* The TAG field is in BIG ENDIAN */
|
||||
}USB_UAS_READ_READY_IU, *pUSB_UAS_READ_READY_IU;
|
||||
|
||||
/*
|
||||
* 6.2.4 WRITE READY IU
|
||||
*
|
||||
* The WRITE READY IU is sent by a UAS target port to request write
|
||||
* data from the UAS initiator port during a data-out command (see 6.3.4)
|
||||
* or a bi-directional command (see 6.3.7). UAS target devices that
|
||||
* connect via SuperSpeed (see USB-3) shall return an ERDY transaction
|
||||
* packet (see USB-3) on the Data-out pipe using the tag as the stream
|
||||
* ID instead of the WRITE READY IU on the Status pipe. The WRITE READY
|
||||
* IU shall be contained in a single USB packet and shall not share a
|
||||
* USB packet with any other Information Unit. Table 15 defines the
|
||||
* WRITE READY IU.
|
||||
*/
|
||||
|
||||
typedef struct usbUasWriteReadyIU
|
||||
{
|
||||
UINT8 uID; /* IU ID, identifies the type of IU (see table 10) */
|
||||
UINT8 uRzv0; /* Reserved */
|
||||
UINT16 uTAG; /* The TAG field is in BIG ENDIAN */
|
||||
}USB_UAS_WRITE_READY_IU, *pUSB_UAS_WRITE_READY_IU;
|
||||
|
||||
/*
|
||||
* 6.2.5 SENSE IU
|
||||
*
|
||||
* The SENSE IU is sent by the UAS target port to deliver SCSI status.
|
||||
* The SENSE IU shall be contained in a single USB packet and shall
|
||||
* not share a USB packet with any other Information Unit. Table 16
|
||||
* defines the SENSE IU.
|
||||
*/
|
||||
|
||||
#define USB_SCSI_MAX_SENSE_LENGTH 96
|
||||
|
||||
typedef struct usbUasSenseIU
|
||||
{
|
||||
UINT8 uID; /* IU ID, identifies the type of IU (see table 10) */
|
||||
UINT8 uRzv0; /* Reserved */
|
||||
UINT16 uTAG; /* The TAG field is in BIG ENDIAN */
|
||||
#if (USB_MSC_UAS_VERSION_SUPPORTED >= 4)
|
||||
UINT16 uQulifier; /* STATUS QUALIFIER */
|
||||
#endif /* (USB_MSC_UAS_VERSION_SUPPORTED >= 4) */
|
||||
UINT8 uStatus; /* STATUS */
|
||||
#if (USB_MSC_UAS_VERSION_SUPPORTED >= 4)
|
||||
UINT8 uRzv1[7]; /* Reserved */
|
||||
#else /* (USB_MSC_UAS_VERSION_SUPPORTED >= 4) */
|
||||
UINT8 uRzv1[1]; /* Reserved */
|
||||
#endif /* (USB_MSC_UAS_VERSION_SUPPORTED >= 4) */
|
||||
UINT16 uLength; /* LENGTH field contains the number of bytes that
|
||||
* follow in the SENSE IU. If no sense data is
|
||||
* available, then the LENGTH field shall be set
|
||||
* to 0000h.*/
|
||||
UINT8 pSenseData[USB_SCSI_MAX_SENSE_LENGTH];
|
||||
/* The SENSE DATA field shall be set to the sense
|
||||
* data, if any, for the command associated with
|
||||
* the tag (see SAM-4).*/
|
||||
}USB_UAS_SENSE_IU, *pUSB_UAS_SENSE_IU;
|
||||
|
||||
/*
|
||||
* 6.2.6 RESPONSE IU
|
||||
*
|
||||
* The RESPONSE IU is used to pass task management status information
|
||||
* from the UAS target port to the UAS initiator port. The RESPONSE IU
|
||||
* may be returned in response to a COMMAND IU as a means to report an
|
||||
* error condition detected by the transport. Each RESPONSE IU shall be
|
||||
* sent in a single USB packet. The RESPONSE IU shall be contained in
|
||||
* a single USB packet and shall not share a USB packet with any other
|
||||
* Information Unit. Table 17 defines the RESPONSE IU.
|
||||
*/
|
||||
|
||||
typedef struct usbUasResponseIU
|
||||
{
|
||||
UINT8 uID; /* IU ID, identifies the type of IU (see table 10) */
|
||||
UINT8 uRzv0; /* Reserved */
|
||||
UINT16 uTAG; /* The TAG field is in BIG ENDIAN */
|
||||
UINT16 uAddInfo; /* ADDITIONAL RESPONSE INFORMATION for certain task
|
||||
* management functions (e.g., QUERY ASYNCHRONOUS
|
||||
* EVENT). Shall be set to zero if the task management
|
||||
* function does not define, or the logical unit does
|
||||
* not support response information. */
|
||||
UINT8 uResponse; /* RESPONSE CODE */
|
||||
}USB_UAS_RESPONSE_IU, *pUSB_UAS_RESPONSE_IU;
|
||||
|
||||
/*
|
||||
* Table 18 - RESPONSE CODE field
|
||||
*
|
||||
* The RESPONSE CODE field indicates the status of a task management function.
|
||||
*
|
||||
* Values 01h, 03h, 06h..07h, 0Bh-FFh are Reserved
|
||||
*/
|
||||
|
||||
#define USB_UAS_RESP_TASK_MGMT_COMPLETE 0x00 /* TASK MANAGEMENT FUNCTION COMPLETE */
|
||||
#define USB_UAS_RESP_INVALID_INFO_UNIT 0x02 /* INVALID INFORMATION UNIT */
|
||||
#define USB_UAS_RESP_TASK_MGMT_UNSUPPORTED 0x04 /* TASK MANAGEMENT FUNCTION NOT SUPPORTED */
|
||||
#define USB_UAS_RESP_TASK_MGMT_FAILED 0x05 /* TASK MANAGEMENT FUNCTION FAILED */
|
||||
#define USB_UAS_RESP_TASK_MGMT_SUCCEEDED 0x08 /* TASK MANAGEMENT FUNCTION SUCCEEDED */
|
||||
#define USB_UAS_RESP_INCORRECT_LUN 0x09 /* INCORRECT LOGICAL UNIT NUMBER */
|
||||
#define USB_UAS_RESP_OVERLAPPED_TAG 0x0A /* OVERLAPPED TAG ATTEMPTED */
|
||||
|
||||
/*
|
||||
* 6.2.7 TASK MANAGEMENT IU
|
||||
*
|
||||
* The TASK MANAGEMENT IU is sent by a UAS initiator port to request that
|
||||
* a task management function be processed by the task manager in a logical
|
||||
* unit. The TASK MANAGEMENT IU shall be contained in a single USB packet
|
||||
* and shall not share a USB packet with any other Information Unit. Table
|
||||
* 19 defines the TASK MANAGEMENT IU format.
|
||||
*
|
||||
* If the TASK MANAGEMENT FUNCTION field is set to 01h (i.e., ABORT TASK)
|
||||
* or 80h (i.e., QUERY TASK) , then the TAG OF TASK TO BE MANAGED field
|
||||
* specifies the tag from the COMMAND IU that contained the command to be
|
||||
* aborted or queried. For all other task management functions, the TAG
|
||||
* OF TASK TO BE MANAGED field is reserved.
|
||||
*
|
||||
* If the TASK MANAGEMENT FUNCTION field contains a reserved or unsupported
|
||||
* value, then the task manager shall return a RESPONSE IU with the RESPONSE
|
||||
* CODE field set to TASK MANAGEMENT FUNCTION NOT SUPPORTED.
|
||||
*
|
||||
* The LOGICAL UNIT NUMBER field contains the address of the logical unit.
|
||||
* The structure of the LOGICAL UNIT NUMBER field shall be as defined in
|
||||
* SAM-4. If the addressed logical unit does not exist, the task manager
|
||||
* shall return a RESPONSE IU with the RESPONSE CODE field set to INCORRECT
|
||||
* LOGICAL UNIT NUMBER.
|
||||
*/
|
||||
|
||||
typedef struct usbUasTaskMgmtIU
|
||||
{
|
||||
UINT8 uID; /* IU ID, identifies the type of IU (see table 10) */
|
||||
UINT8 uRzv0; /* Reserved */
|
||||
UINT16 uTAG; /* The TAG field is in BIG ENDIAN */
|
||||
UINT8 uTaskMgmt; /* TASK MANAGEMENT FUNCTION */
|
||||
UINT8 uRzv1; /* Reserved */
|
||||
UINT16 uMgmtTAG; /* TAG OF TASK TO BE MANAGED */
|
||||
UINT16 uLUN; /* LOGICAL UNIT NUMBER */
|
||||
}USB_UAS_TASK_MGMT_IU, *pUSB_UAS_TASK_MGMT_IU;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __INCusbUash */
|
||||
|
||||
@@ -0,0 +1,507 @@
|
||||
/* usbd.h - USBD functional interface definition */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2006, 2008-2015 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/* Copyright 2003, 2006, 2008-2014 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
03c,10dec15,whu Protecte Usb control pipe against concurrent access triggers
|
||||
data abort. (VXW6-84955)
|
||||
02a,03Dec14,wyy Remove compiler warning
|
||||
01z,05Dec13,wyy Add deviceInfoMutex to protect class driver from multi-removing
|
||||
(WIND00446805)
|
||||
01y,04jul13,ljg Change VOID parameter to void for compiler issue (WIND00423631)
|
||||
01x,28apr13,ghs Add support of USB message (WIND00411952)
|
||||
01w,07nov12,s_z Remove compiler CHECKED_RETURN warning (WIND00378821)
|
||||
01v,17oct12,w_x Fix compiler warnings (WIND00370525)
|
||||
01u,19jul12,w_x Add support for USB 3.0 host (WIND00188662)
|
||||
01t,06jul11,ghs Add new match function for device ID matching (WIND00183500)
|
||||
01s,13jan11,w_x Initial USB OTG support changes (WIND00211541)
|
||||
01r,08sep10,ghs Add MHCD and SYNOPSYSHCD count to the max hcd count.
|
||||
01q,21jul10,m_y Add macro USBD_CLEANUP_ENDPOINT_INFO to do the clean action of
|
||||
the structure usbd_endpoint_info
|
||||
01p,04mar10,m_y Add urbList into structure usbd_endpoint_info to record the URBs
|
||||
submitted to this endpoint.(WIND00200272)
|
||||
01o,11may10,m_y Modify macro USBD_DECREMENT_FUNCTIONAL_DEVICE_COUNT,
|
||||
change OSS_ASSERT to "if" judgement (WIND00196406)
|
||||
01d,29apr10,pad Moved extern C statement after include statements.
|
||||
01n,27apr10,j_x Hard code replacement (WIND00183874)
|
||||
01m,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01l,11sep09,ghs Redefine max bus and hcd counts(WIND00152418)
|
||||
01k,24apr09,w_x Moved USBD_NOTIFY_ALL from usbd.c to usbd.h(WIND00163712)
|
||||
01j,12mar09,w_x Moved LOCAL prototype from usbd.h to usbd.c to remove warning
|
||||
(WIND00160883)
|
||||
01i,14feb09,w_x Added root hub handle in USBD_BUS_INFO (WIND00152849)
|
||||
01h,13jan09,w_x Added uParentPortIndex/uParentTier in device info (WIND00151472)
|
||||
01g,23dec08,w_x Added uBCDUSB in device info structure (WIND00149529)
|
||||
01f,17dec08,w_x Added "bAnnounced" flag in device/interface info (WIND00148490)
|
||||
01e,20oct08,w_x Increase USBD_MAX_HCD_NUM and USBD_MAX_BUS_NUM
|
||||
01d,14aug08,w_x Add mutex to sync up pipe delete/re-create (WIND00130877)
|
||||
01c,11jul08,w_x USB Composite device support under vxBus (WIND00127515)
|
||||
01b,07oct06,ami Changes for USB-vxBus porting
|
||||
01a,30may03,nrv Changing the code to WRS standards
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file contains the data structures for usbd module.
|
||||
*/
|
||||
|
||||
/*
|
||||
INTERNAL
|
||||
*******************************************************************************
|
||||
* Filename : Usbd.h
|
||||
*
|
||||
* Copyright :
|
||||
*
|
||||
* THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO
|
||||
* LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING
|
||||
* ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE
|
||||
* 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY
|
||||
* ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY
|
||||
* PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE
|
||||
* ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL.
|
||||
* THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF
|
||||
* THIS COPYRIGHT AS PER APPLICABLE LAWS.
|
||||
*
|
||||
* Description : This file contains the data structures for usbd module.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __USBD_H__
|
||||
#define __USBD_H__
|
||||
|
||||
/* Include Files */
|
||||
#include "usbOsal.h"
|
||||
#include "usbHst.h"
|
||||
#include "objLib.h"
|
||||
#include "usbHcdInstr.h"
|
||||
#include "hwif/vxbus/vxBus.h"
|
||||
#include "vxBusLib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
#define USBD_MAX_HCD_NUM ((USB_MAX_UHCI_COUNT) + (USB_MAX_OHCI_COUNT) \
|
||||
+ (USB_MAX_EHCI_COUNT) + (USB_MAX_MHCI_COUNT) \
|
||||
+ (USB_MAX_SYNOPSYSHCI_COUNT)) /* the max
|
||||
* host controllers
|
||||
*/
|
||||
#define USBD_MAX_BUS_NUM ((USBD_MAX_HCD_NUM) * 2) /* the max bus in all HCDs */
|
||||
|
||||
#define USBD_ADDRESS_MAP_SIZE (128/(8*sizeof(UINT8))) /* max # of devices */
|
||||
#define USBD_INVALID_CRC_VALUE 0 /* invalid CRC value for configuration */
|
||||
#define USBD_PARSE_AND_CREATE 0x01 /* used as flag to parse and create pipe */
|
||||
#define USBD_PARSE_ONLY 0x02 /* used as flag to parse only */
|
||||
#define CRC16_MASK 0xFFFF /* CRC16 info */
|
||||
#define CRC16_INITIAL_HOLD 0xFFFF /* CRC16 info */
|
||||
#define CRC16_GENERATOR_POLY 0x8005 /* 1000 0000 0000 0101b */
|
||||
|
||||
#define USBD_NOTIFY_ALL 0xFFFF /* Device/Class match flag wildcard */
|
||||
|
||||
/* Defines the maximum device address */
|
||||
#define USBD_MAX_DEVICE_ADDRESS 127
|
||||
|
||||
/* Defines the offset of bux index in device or hub handle */
|
||||
#define USBD_OFFSET_BUS_INDEX 8
|
||||
|
||||
/* Defines the offset of invalid byte in device handle */
|
||||
#define USBD_OFFSET_INVALID 16
|
||||
|
||||
/* Defines the bit position within a byte */
|
||||
#define USBD_BIT_POSITION 1
|
||||
|
||||
/* Defines the byte and bit position in the device address map */
|
||||
#define USBD_POSITION_ADDRESS_MAP 8
|
||||
|
||||
/* Defines the transfer type bit map in the bmAttributes */
|
||||
#define USBD_TRANSFER_TYPE 0x03
|
||||
|
||||
/* Defines the max packet size is 8 */
|
||||
#define USBD_MAX_PACKET_SIZE_8 8
|
||||
|
||||
/* Defines the max packet size is 16 */
|
||||
#define USBD_MAX_PACKET_SIZE_16 16
|
||||
|
||||
/* Defines the max packet size is 32 */
|
||||
#define USBD_MAX_PACKET_SIZE_32 32
|
||||
|
||||
/* Defines the max packet size is 64 */
|
||||
#define USBD_MAX_PACKET_SIZE_64 64
|
||||
|
||||
/* Defines the max packet size is 512 */
|
||||
#define USBD_MAX_PACKET_SIZE_512 512
|
||||
|
||||
/* Defines the max packet size is 1023 */
|
||||
#define USBD_MAX_PACKET_SIZE_1023 1023
|
||||
|
||||
/* Defines the max packet size is 1024 */
|
||||
#define USBD_MAX_PACKET_SIZE_1024 1024
|
||||
|
||||
/* Defines the range of bInterval */
|
||||
|
||||
/* For full-/high-speed isochronous endpoints,
|
||||
* this value must be in the range from 1 to 16
|
||||
*/
|
||||
|
||||
#define USBD_MIN_BINTERVAL 1
|
||||
#define USBD_MAX_BINTERVAL 16
|
||||
|
||||
/* Defines the length of endpoint descriptor */
|
||||
#define USBD_LENGTH_END_DESC 7
|
||||
|
||||
/* Defines the length of device descriptor */
|
||||
#define USBD_LENGTH_DEV_DESC 18
|
||||
|
||||
/* Defines the length of config descriptor */
|
||||
#define USBD_LENGTH_CONFIG_DESC 9
|
||||
|
||||
/* Defines the USB2.0 SPEC version */
|
||||
#define USBD_USB_SPEC_20 0x0200
|
||||
|
||||
/* Defines the 16-bit reversed value for the hold value */
|
||||
#define USBD_HOLD_VALUE_16 16
|
||||
|
||||
/* Defines the byte reversed value for the hold value */
|
||||
#define USBD_HOLD_VALUE_8 8
|
||||
|
||||
/* Defines transfer direction of bmRequestType */
|
||||
#define USBD_DEVICE_TO_HOST 0x80
|
||||
#define USBD_HOST_TO_DEVICE 0x00
|
||||
|
||||
/* Defines the offset of descriptor type in wValue */
|
||||
#define USBD_OFFSET_DES_TYPE 8
|
||||
|
||||
/* Defines the request status size is 2 */
|
||||
#define USBD_STATUS_SIZE_2 2
|
||||
|
||||
/* Defines the request status size is 1 */
|
||||
#define USBD_STATUS_SIZE_1 1
|
||||
|
||||
/* Defines the request status size is 0 */
|
||||
#define USBD_STATUS_SIZE_0 0
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* USBD_INCREMENT_FUNCTIONAL_DEVICE_COUNT - Increment the functional
|
||||
* device count
|
||||
*
|
||||
* This Macro is used to increment a functional device count on the
|
||||
* specified bus <uBusIndex>.
|
||||
*
|
||||
* RETURNS: N/A
|
||||
*/
|
||||
#define USBD_INCREMENT_FUNCTIONAL_DEVICE_COUNT(uBusIndex) \
|
||||
{ \
|
||||
/* Lock the bus before modifying functional count */ \
|
||||
(void)OS_WAIT_FOR_EVENT((gUSBBusInfoList[(uBusIndex)].busOperationLock),\
|
||||
OS_WAIT_INFINITE); \
|
||||
\
|
||||
/* Increment the functional count of the bus */ \
|
||||
gUSBBusInfoList[(uBusIndex)].uFunctionalCount++; \
|
||||
\
|
||||
/* Release the lock */ \
|
||||
OS_RELEASE_EVENT(gUSBBusInfoList[(uBusIndex)].busOperationLock); \
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* USBD_DECREMENT_FUNCTIONAL_DEVICE_COUNT - decrement a functional device
|
||||
* count
|
||||
*
|
||||
* This Macro is used to decrement a functional device count on the
|
||||
* specified bus <uBusIndex>.
|
||||
*
|
||||
* RETURNS: N/A
|
||||
*/
|
||||
#define USBD_DECREMENT_FUNCTIONAL_DEVICE_COUNT(uBusIndex) \
|
||||
{ \
|
||||
/* Lock the bus before modifying functional count */ \
|
||||
(void)OS_WAIT_FOR_EVENT((gUSBBusInfoList[(uBusIndex)].busOperationLock),\
|
||||
OS_WAIT_INFINITE); \
|
||||
/* Just to check the count is not zero */ \
|
||||
if (gUSBBusInfoList[(uBusIndex)].uFunctionalCount != 0) \
|
||||
/* Decrement the functional count of the bus */ \
|
||||
gUSBBusInfoList[(uBusIndex)].uFunctionalCount--; \
|
||||
\
|
||||
/* Release the lock */ \
|
||||
OS_RELEASE_EVENT((gUSBBusInfoList[(uBusIndex)].busOperationLock)); \
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* USBD_CLEANUP_ENDPOINT_INFO - do clean action of the USBD_ENDPOINT_INFO
|
||||
*
|
||||
* This Macro is used to do clean action of the USBD_ENDPOINT_INFO.
|
||||
*
|
||||
* RETURNS: N/A
|
||||
*/
|
||||
|
||||
#define USBD_CLEANUP_ENDPOINT_INFO(pEndpointInfo) \
|
||||
{ \
|
||||
NODE *pNode = NULL; \
|
||||
NODE *pNextNode = NULL; \
|
||||
(void)semTake(&(pEndpointInfo->urbListSem),WAIT_FOREVER); \
|
||||
pNode = lstFirst(&(pEndpointInfo->urbList)); \
|
||||
while(pNode != NULL) \
|
||||
{ \
|
||||
pNextNode = lstNext(pNode); \
|
||||
lstDelete(&(pEndpointInfo->urbList), pNode); \
|
||||
pNode = pNextNode; \
|
||||
} \
|
||||
(void)semTerminate(&(pEndpointInfo->urbListSem)); \
|
||||
}
|
||||
|
||||
/* Macro definition of USB message code */
|
||||
#define USBMSG_CODE(SysOrUser, ModuleType, Module, Msg) \
|
||||
(((((UINT32)SysOrUser) & 0xFF) << 24) | ((((UINT32)ModuleType) & 0xF) << 20) \
|
||||
| ((((UINT32)Module) & 0xF) << 16) | ((((UINT32)Msg) & 0xFFFF) << 0))
|
||||
|
||||
/*
|
||||
* Bit Table of Message Code
|
||||
*
|
||||
* All 0 or All 1 is reserved for any sub values
|
||||
*
|
||||
* [31-24] USB System Message or User Message
|
||||
* [0x00]~[0x20] - Unused, Reserved
|
||||
* [0x21] - USB Message
|
||||
* [0x22]~[0x80] - Reserved
|
||||
* [0x81] - User Message
|
||||
* [0x82]~[0xFF] - Reserved
|
||||
*
|
||||
* [23-20] Module Type (for USB only)
|
||||
* [0x0] - Unused, Reserved
|
||||
* [0x1] - HCD Message
|
||||
* [0x2] - TCD Message
|
||||
* [0x3] - OTG Message
|
||||
* [0x4] - USBD Message
|
||||
* [0x5] - Host Class Driver Message
|
||||
* [0x6] - Target Function Driver Message
|
||||
* [0x7] - Tools and Other Type Message
|
||||
* [0x8~0xF] - Unused, Reserved
|
||||
*
|
||||
* [19-16] Modules
|
||||
* Defined by every modules, value [0x0] is reserved.
|
||||
* For GEN2 Host Class Driver Define:
|
||||
* 1 - legacy (GEN1 Reserved) 2 - Hub, 3 - Helper, 4- Keyboard,
|
||||
* 5 - Mouse, 6 - Storage, 7 - Network, 8 - Printer, 9 - Serial,
|
||||
* 10 - PHDC
|
||||
*
|
||||
* [15-0] Message Values
|
||||
* Defined by every modules, value [0x0] is reserved.
|
||||
* For GEN2 Host Class Driver Define:
|
||||
* 1 - New Device Ready, 2 - Device Removed.
|
||||
*
|
||||
*/
|
||||
|
||||
/* USB_MSG_CODE - SysOrUser */
|
||||
|
||||
#define USBMSG_USBSYS 0x21
|
||||
#define USBMSG_USBUSER 0x81
|
||||
|
||||
/* USB_MSG_CODE - ModuleType */
|
||||
|
||||
#define USBMSG_HCD 0x1
|
||||
#define USBMSG_TCD 0x2
|
||||
#define USBMSG_OCD 0x3
|
||||
#define USBMSG_USBD 0x4
|
||||
#define USBMSG_CLASS 0x5
|
||||
#define USBMSG_FUNC 0x6
|
||||
#define USBMSG_TOOL 0x7
|
||||
|
||||
/* flags value to add callback */
|
||||
#define USBMSG_FLAG_CALLBACK_ASYN (1 << 0)
|
||||
|
||||
/********************** STRUCTURES DEFINITION *********************************/
|
||||
|
||||
/*
|
||||
* This structure is used to maintain the list of Class Drivers registered
|
||||
* with USBD
|
||||
*/
|
||||
typedef struct usbd_device_driver_list
|
||||
{
|
||||
pUSBHST_DEVICE_DRIVER pDriver; /* pointer to driver */
|
||||
struct usbd_device_driver_list * pNextDriver; /* pointer to next driver */
|
||||
} USBD_DEVICE_DRIVER_LIST, *pUSBD_DEVICE_DRIVER_LIST;
|
||||
|
||||
/* Structure to hold the endpoint information */
|
||||
typedef struct usbd_endpoint_info
|
||||
{
|
||||
UINT8 uEndpointAddress; /* Address of the end Point */
|
||||
ULONG hPipe; /* Ptr to pipe corresponding to the endpoint */
|
||||
LIST urbList; /* List of the urb submited to this endpoint */
|
||||
SEMAPHORE urbListSem; /* semphore of the urb list */
|
||||
} USBD_ENDPOINT_INFO, *pUSBD_ENDPOINT_INFO;
|
||||
|
||||
/*
|
||||
* This structure is used to store the information about an interface required
|
||||
* by a USB device.
|
||||
*/
|
||||
typedef struct usbd_interface_info
|
||||
{
|
||||
UINT8 uInterfaceNum; /* Interface number */
|
||||
UINT8 uAlternateSetting; /* Alt settting value for this interface */
|
||||
UINT8 uNumEndpoints; /* # of end points in the interface */
|
||||
UINT8 uInterfaceClass; /* Class code for the interface */
|
||||
UINT8 uInterfaceSubClass; /* Sub class ocde for the interface */
|
||||
UINT8 uInterfaceProtocol; /* protocol code for the interface */
|
||||
pUSBHST_DEVICE_DRIVER pDriver; /* Ptr to the DEVICE_DRIVER struct */
|
||||
void * pDriverData; /* Driver data specific to interface */
|
||||
pUSBD_ENDPOINT_INFO pEndpointInformation; /* Ptr to end point info */
|
||||
VXB_DEVICE_ID pInterfaceDev; /* Pointer to struct pDev */
|
||||
BOOLEAN bAnnounced;/* Is the VXB_DEVICE_ID bAnnounced */
|
||||
OS_EVENT_ID pipeLock; /* Lock to protect pipe modification */
|
||||
} USBD_INTERFACE_INFO, *pUSBD_INTERFACE_INFO;
|
||||
|
||||
/* This structure is used to store the information about a USB device */
|
||||
typedef struct usbd_device_info
|
||||
{
|
||||
UINT32 hDevice; /* Handle to the device */
|
||||
UINT8 uDeviceSpeed; /* Speed of the device */
|
||||
UINT8 uDeviceAddress; /* Device addr on particular USB bus */
|
||||
UINT8 uBusIndex; /* Index of the bus in global bus list */
|
||||
UINT16 uHighSpeedHubInfo; /* Nearest high speed hub and port number
|
||||
* info; used for split transfer to full/low
|
||||
* speed devices. high byte holds high speed
|
||||
* address, low byte is port number
|
||||
*/
|
||||
UINT8 uParentPortIndex; /* The port index where this device is attached */
|
||||
UINT8 uParentTier; /* The tier of the parent hub of this device */
|
||||
ULONG hDefaultPipe; /* Ptr to pipe for end point 0 */
|
||||
UINT16 uBCDUSB; /* bcdUSB, USB version device conforms to */
|
||||
UINT8 uDeviceClass; /* Class code of the device */
|
||||
UINT8 uDeviceSubClass; /* Sub class code of the device */
|
||||
UINT8 uDeviceProtocol; /* Protocol code of the device */
|
||||
UINT16 uVendorID; /* Vendor Id of the device */
|
||||
UINT16 uDeviceID; /* Device Id for device */
|
||||
UINT16 uBCDDevice; /* USB device release version binary coded decimal */
|
||||
UINT8 uMaxPacketSize0; /* Max Packet Size for default control endpoint */
|
||||
pUSBHST_DEVICE_DRIVER pDriver; /* Store the driver data */
|
||||
void * pDriverData; /* Driver data specific to interface */
|
||||
UINT8 uInterfaceNumber; /* Interface # */
|
||||
UINT8 uInterfaceCount; /* # of interfaces supported */
|
||||
UCHAR * pBOS; /* Ptr to Binary Device Object Store */
|
||||
UCHAR * pCurrentConfiguration; /* Ptr to hold config of the device */
|
||||
UINT8 uNumConfigurations; /* # of possible configurations */
|
||||
UINT16 uConfigCRCValue; /* CRC Value */
|
||||
pUSBD_INTERFACE_INFO pInterfacesInfo; /* Info about interfaces */
|
||||
struct usbd_device_info *pNextUSBDeviceInfo; /* Ptr to next USB devinfo */
|
||||
VXB_DEVICE_ID pDev; /* Pointer to struct pDev */
|
||||
BOOLEAN bAnnounced; /* Is the VXB_DEVICE_ID bAnnounced */
|
||||
BOOLEAN bIsComposite; /* Is this a composite device */
|
||||
UCHAR * pOtgDescr; /* Ptr to OTG descriptor buffer */
|
||||
UINT16 uOtgDescrOffset; /* Offset of OTG descr in config descr */
|
||||
MUTEX_HANDLE deviceInfoMutex; /* protect deviceInfo from concurrent modification */
|
||||
MUTEX_HANDLE ctrlPipeMutex; /* protect control pipe*/
|
||||
} USBD_DEVICE_INFO, *pUSBD_DEVICE_INFO;
|
||||
|
||||
/* Since the root hub is a virtual device, we can use any non-zero addresses */
|
||||
|
||||
#define USB_ROOT_HUB_ADDRESS USBD_MAX_DEVICE_ADDRESS
|
||||
|
||||
/*
|
||||
* To store the information about a bus and also to maintain a list of USB
|
||||
* devices connected on the specific bus.
|
||||
*/
|
||||
typedef struct usbd_bus_info
|
||||
{
|
||||
UINT8 uDeviceAddressMap[USBD_ADDRESS_MAP_SIZE]; /*
|
||||
* Device address map
|
||||
* of devs on bus.
|
||||
*/
|
||||
UINT8 uRelativeBusIndex; /* rellative bus index in the host controller */
|
||||
UINT8 hcdIndex; /* Host controller driver index */
|
||||
ULONG hDefaultPipe; /* Handle to the default pipe */
|
||||
UINT32 uFunctionalCount; /* Count of functional interfaces/devices */
|
||||
OS_EVENT_ID busOperationLock; /* Lock used while accessing list */
|
||||
pUSBD_DEVICE_INFO pUSBDeviceInfoList; /* info about devices connected */
|
||||
UINT32 hRootHub; /* Root hub device handle */
|
||||
UINT8 uRootHubAddress; /* Root hub device address */
|
||||
UINT8 uBusSpeed; /* Root hub bus speed */
|
||||
VXB_DEVICE_ID pDev; /* Host Controller VxBus Instance */
|
||||
} USBD_BUS_INFO, *pUSBD_BUS_INFO;
|
||||
|
||||
typedef void *(* usbmsg_callback)(UINT32 msgCode, void * pModule,
|
||||
void * param, void * userData);
|
||||
|
||||
typedef usbmsg_callback USBMSG_CALLBACK;
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : USBD_TRANSLATE_DEVICE_HANDLE
|
||||
* Description : This function is used to translate device handle
|
||||
* to USB device information. .
|
||||
* Parameters : uHandle IN Device handle to be translated.
|
||||
* pDeviceInfo OUT Pointer to hold the translated device
|
||||
* information.
|
||||
* Return Type : None
|
||||
******************************************************************************/
|
||||
|
||||
void usbdTranslateDeviceHandle
|
||||
(
|
||||
UINT32 uHandle,
|
||||
pUSBD_DEVICE_INFO *pDeviceInfo
|
||||
);
|
||||
|
||||
|
||||
pUSBHST_DEVICE_ID usbdMatchDriverId
|
||||
(
|
||||
pUSBHST_DEVICE_ID pDevId,
|
||||
pUSBHST_DEVICE_ID pDrvDevId
|
||||
);
|
||||
|
||||
void * usbMsgCallbackAdd
|
||||
(
|
||||
UINT32 msgCode,
|
||||
USBMSG_CALLBACK callback,
|
||||
void * userData,
|
||||
UINT32 flags
|
||||
);
|
||||
|
||||
STATUS usbMsgCallbackDel
|
||||
(
|
||||
void * handle
|
||||
);
|
||||
|
||||
void * usbMsgPost
|
||||
(
|
||||
UINT32 msgCode,
|
||||
void * pModule,
|
||||
void * param
|
||||
);
|
||||
|
||||
STATUS usbMsgLibInit
|
||||
(
|
||||
int maxCallback,
|
||||
int maxPendingMsg
|
||||
);
|
||||
|
||||
STATUS usbMsgAsynLibInit
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* End of __USBD_H__ */
|
||||
/**************************** End of file Usbd.h ******************************/
|
||||
|
||||
@@ -0,0 +1,521 @@
|
||||
/* usbdCoreLib.h - Defines internal between usbdLib and usbdCoreLib */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2000, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01e,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01d,26jan00,rcb Redefine "bandwidth" field in URB_PIPE_CREATE as UINT32.
|
||||
01c,29nov99,rcb Increase frame number fields to 32 bits in
|
||||
URB_CURRENT_FRAME_GET.
|
||||
01b,07sep99,rcb Add support for management callbacks and set-bus-state API.
|
||||
01a,20aug99,rcb First.
|
||||
*/
|
||||
|
||||
#ifndef __INCusbdCoreLibh
|
||||
#define __INCusbdCoreLibh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* we do not use these codes any more in USB 2.x */
|
||||
#if 0
|
||||
/* includes */
|
||||
|
||||
#include "usb/usbdLib.h"
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/* USBD Function Request Codes - URB_HEADER.Function */
|
||||
|
||||
#define USBD_FNC_ASYNC_MASK 0x8000 /* Set if USBD function */
|
||||
/* execute asynchronously */
|
||||
|
||||
/*
|
||||
* Synchronous USBD functions always execute synchronously.
|
||||
*
|
||||
* Asynchronous USBD functions may or may not execute asynchronously,
|
||||
* depending on the USBD implementation. However, clients must expect that
|
||||
* such functions may execute asynchronously.
|
||||
*/
|
||||
|
||||
#define USBD_FNC_INITIALIZE 0x0000 /* initialize USBD */
|
||||
#define USBD_FNC_SHUTDOWN 0x0001 /* shut down USBD */
|
||||
|
||||
#define USBD_FNC_CLIENT_REG 0x0100 /* Client register */
|
||||
#define USBD_FNC_CLIENT_UNREG 0x0101 /* Client unregister */
|
||||
#define USBD_FNC_MNGMT_CALLBACK_SET 0x0102 /* set client's mngmt callback */
|
||||
|
||||
#define USBD_FNC_VERSION_GET 0x0200 /* Get USBD version */
|
||||
#define USBD_FNC_HCD_ATTACH 0x0201 /* Attach HCD to USBD */
|
||||
#define USBD_FNC_HCD_DETACH 0x0202 /* Detach HCD from USBD */
|
||||
#define USBD_FNC_STATISTICS_GET 0x0203 /* Get USBD statistics */
|
||||
|
||||
#define USBD_FNC_BUS_COUNT_GET 0x0300 /* Get bus count */
|
||||
#define USBD_FNC_ROOT_ID_GET 0x0301 /* Get root id */
|
||||
#define USBD_FNC_HUB_PORT_COUNT_GET 0x0302 /* Get count of hub ports */
|
||||
#define USBD_FNC_NODE_ID_GET 0x0303 /* Get node id */
|
||||
#define USBD_FNC_NODE_INFO_GET 0x0304 /* Get node information */
|
||||
|
||||
#define USBD_FNC_DYNA_ATTACH_REG 0x0400 /* Dynamic attach register */
|
||||
#define USBD_FNC_DYNA_ATTACH_UNREG 0x0401 /* Dynamic attach unregister */
|
||||
|
||||
#define USBD_FNC_FEATURE_CLEAR 0x8500 /* Clear feature */
|
||||
#define USBD_FNC_FEATURE_SET 0x8501 /* Set feature */
|
||||
#define USBD_FNC_CONFIG_GET 0x8502 /* Get configuration */
|
||||
#define USBD_FNC_CONFIG_SET 0x8503 /* Set configuration */
|
||||
#define USBD_FNC_DESCRIPTOR_GET 0x8504 /* Get descriptor */
|
||||
#define USBD_FNC_DESCRIPTOR_SET 0x8505 /* Set descriptor */
|
||||
#define USBD_FNC_INTERFACE_GET 0x8506 /* Get interface */
|
||||
#define USBD_FNC_INTERFACE_SET 0x8507 /* Set interface */
|
||||
#define USBD_FNC_STATUS_GET 0x8508 /* Get status */
|
||||
#define USBD_FNC_ADDRESS_GET 0x0509 /* Get device address */
|
||||
#define USBD_FNC_ADDRESS_SET 0x850a /* Set device address */
|
||||
#define USBD_FNC_VENDOR_SPECIFIC 0x850b /* Vendor specific */
|
||||
|
||||
#define USBD_FNC_PIPE_CREATE 0x0600 /* Create pipe */
|
||||
#define USBD_FNC_PIPE_DESTROY 0x0601 /* Destroy pipe */
|
||||
#define USBD_FNC_TRANSFER 0x0602 /* Initiate transfer */
|
||||
#define USBD_FNC_TRANSFER_ABORT 0x0603 /* Abort transfers */
|
||||
#define USBD_FNC_SYNCH_FRAME_GET 0x8604 /* Get synch frame */
|
||||
#define USBD_FNC_CURRENT_FRAME_GET 0x8605 /* Get current frame */
|
||||
#define USBD_FNC_SOF_MASTER_TAKE 0x0606 /* Become SOF master */
|
||||
#define USBD_FNC_SOF_MASTER_RELEASE 0x0607 /* release SOF master */
|
||||
#define USBD_FNC_SOF_INTERVAL_GET 0x0608 /* retrieve SOF */
|
||||
#define USBD_FNC_SOF_INTERVAL_SET 0x0609 /* set SOF (master only) */
|
||||
#define USBD_FNC_BUS_STATE_SET 0x060a /* set bus state */
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/*
|
||||
* URB_HEADER
|
||||
*
|
||||
* The URB_HEADER must be the first field in each URB data structure. It
|
||||
* identifies the USBD function to be executed, the size of the URB, etc.
|
||||
*/
|
||||
|
||||
typedef struct urb_header
|
||||
{
|
||||
pVOID link; /* n/a USBD private link ptr */
|
||||
USBD_CLIENT_HANDLE handle; /* I/O Client's handle with USBD */
|
||||
UINT16 function; /* IN USBD function code */
|
||||
int result; /* OUT Final URB result: S_usbdLib_xxxx */
|
||||
UINT16 urbLength; /* IN Length of the total URB */
|
||||
URB_CALLBACK callback; /* IN Completion callback */
|
||||
pVOID userPtr; /* IN Generic pointer for client use */
|
||||
} URB_HEADER, *pURB_HEADER;
|
||||
|
||||
|
||||
/* URBs */
|
||||
|
||||
/*
|
||||
* URB_CLIENT_REG
|
||||
*
|
||||
* Note: For this function and only this function, the client does *not* pass
|
||||
* its USBD_CLIENT_HANDLE in the URB_HEADER.Handle field. Instead, upon
|
||||
* completion of this function, the USBD will have stored a newly assigned
|
||||
* USBD_CLIENT_HANDLE in the URB_HEADER.Handle field, from which it should
|
||||
* be retrieved by the client.
|
||||
*/
|
||||
|
||||
typedef struct urb_client_reg
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
char clientName [USBD_NAME_LEN+1]; /* IN Client name */
|
||||
} URB_CLIENT_REG, *pURB_CLIENT_REG;
|
||||
|
||||
|
||||
/*
|
||||
* URB_CLIENT_UNREG
|
||||
*/
|
||||
|
||||
typedef struct urb_client_unreg
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
} URB_CLIENT_UNREG, *pURB_CLIENT_UNREG;
|
||||
|
||||
|
||||
/*
|
||||
* URB_MNGMT_CALLBACK_SET
|
||||
*/
|
||||
|
||||
typedef struct urb_mngmt_callback_set
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_MNGMT_CALLBACK mngmtCallback; /* IN management callback or NULL */
|
||||
pVOID mngmtCallbackParam; /* IN client-defined mngmt callback */
|
||||
} URB_MNGMT_CALLBACK_SET, *pURB_MNGMT_CALLBACK_SET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_BUS_STATE_SET
|
||||
*/
|
||||
|
||||
typedef struct urb_bus_state_set
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN node ID */
|
||||
UINT16 busState; /* IN desired bus state */
|
||||
} URB_BUS_STATE_SET, *pURB_BUS_STATE_SET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_BUS_COUNT_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_bus_count_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
UINT16 busCount; /* OUT bus count */
|
||||
} URB_BUS_COUNT_GET, *pURB_BUS_COUNT_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_ROOT_ID_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_root_id_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
UINT16 busIndex; /* IN bus index */
|
||||
USBD_NODE_ID rootId; /* OUT Node Id for root hub */
|
||||
} URB_ROOT_ID_GET, *pURB_ROOT_ID_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_HUB_PORT_COUNT_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_hub_port_count_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID hubId; /* IN Node Id for desired hub */
|
||||
UINT16 portCount; /* OUT port count for specified hub */
|
||||
} URB_HUB_PORT_COUNT_GET, *pURB_HUB_PORT_COUNT_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_NODE_ID_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_node_id_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID hubId; /* IN Node Id for desired hub */
|
||||
UINT16 portIndex; /* IN Index of desired port */
|
||||
UINT16 nodeType; /* OUT Type of node attached to port */
|
||||
USBD_NODE_ID nodeId; /* OUT Node Id for device attached to port */
|
||||
} URB_NODE_ID_GET, *pURB_NODE_ID_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_NODE_INFO_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_node_info_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node id of device/hub */
|
||||
pUSBD_NODE_INFO pNodeInfo; /* IN Ptr to struct to receive info */
|
||||
UINT16 infoLen; /* IN Length of struct allocated by client */
|
||||
} URB_NODE_INFO_GET, *pURB_NODE_INFO_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_DYNAMIC_ATTACH_REG_UNREG
|
||||
*/
|
||||
|
||||
typedef struct urb_dynamic_attach_reg_unreg
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
UINT16 deviceClass; /* IN USB Device class to register */
|
||||
UINT16 deviceSubClass; /* IN USB Device sub-class to register */
|
||||
UINT16 deviceProtocol; /* IN USB Device protocol */
|
||||
USBD_ATTACH_CALLBACK attachCallback;
|
||||
/* IN Caller-supplied notification callback */
|
||||
} URB_DYNA_ATTACH_REG_UNREG, *pURB_DYNA_ATTACH_REG_UNREG;
|
||||
|
||||
|
||||
/*
|
||||
* URB_FEATURE_CLEAR_SET
|
||||
*
|
||||
* NOTE: Same URB is used for USBD_FNC_FEATURE_CLEAR and USBD_FNC_FEATURE_SET.
|
||||
*/
|
||||
|
||||
typedef struct urb_feature_clear_set
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node ID of device/hub */
|
||||
UINT16 requestType; /* IN Selects request type */
|
||||
UINT16 feature; /* IN Feature selector */
|
||||
UINT16 index; /* IN Interface/endpoint index */
|
||||
} URB_FEATURE_CLEAR_SET, *pURB_FEATURE_CLEAR_SET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_CONFIG_GET_SET
|
||||
*
|
||||
* NOTE: Same URB is used for USBD_FNC_CONFIG_GET and USBD_FNC_CONFIG_SET.
|
||||
*/
|
||||
|
||||
typedef struct urb_config_get_set
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of device/hub */
|
||||
UINT16 maxPower; /* IN Max power to be consumed (set only) */
|
||||
UINT16 configuration; /* I/O Configuration value */
|
||||
} URB_CONFIG_GET_SET, *pURB_CONFIG_GET_SET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_DECSRIPTOR_GET_SET
|
||||
*
|
||||
* NOTE: Same URB is used for USBD_FNC_DESCRIPTOR_GET and
|
||||
* USBD_FNC_DESCRIPTOR_SET.
|
||||
*/
|
||||
|
||||
typedef struct urb_descriptor_get_set
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of device/hub */
|
||||
UINT8 requestType; /* IN selects request type */
|
||||
UINT8 descriptorType; /* IN Type of descriptor */
|
||||
UINT8 descriptorIndex; /* IN Index of descriptor */
|
||||
UINT16 languageId; /* IN Language ID */
|
||||
UINT16 bfrLen; /* IN Max length of data to be returned */
|
||||
pUINT8 pBfr; /* IN Pointer to bfr to receive data */
|
||||
UINT16 actLen; /* OUT Actual length of data transferred */
|
||||
} URB_DESCRIPTOR_GET_SET, *pURB_DESCRIPTOR_GET_SET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_INTERFACE_GET_SET
|
||||
*
|
||||
* NOTE: Same URB is used for USBD_FNC_INTERFACE_GET and USBD_FNC_INTERFACE_SET.
|
||||
*/
|
||||
|
||||
typedef struct urb_interface_get_set
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of device/hub */
|
||||
UINT16 interfaceIndex; /* IN Index of interface */
|
||||
UINT16 alternateSetting; /* I/O Current alternate setting */
|
||||
} URB_INTERFACE_GET_SET, *pURB_INTERFACE_GET_SET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_STATUS_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_status_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of device/hub */
|
||||
UINT8 requestType; /* IN selects request type */
|
||||
UINT16 index; /* IN Interface/endpoint index */
|
||||
UINT16 bfrLen; /* IN max len of status to receive */
|
||||
pUINT8 pBfr; /* OUT bfr to receive status from device */
|
||||
UINT16 actLen; /* OUT actual length of status received */
|
||||
} URB_STATUS_GET, *pURB_STATUS_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_ADDRESS_GET_SET
|
||||
*
|
||||
* NOTE: Same URB is used for USBD_FNC_ADDRESS_GET and USBD_FNC_ADDRESS_SET.
|
||||
*/
|
||||
|
||||
typedef struct urb_address_get_set
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of device/hub */
|
||||
UINT16 deviceAddress; /* I/O device address */
|
||||
} URB_ADDRESS_GET_SET, *pURB_ADDRESS_GET_SET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_VENDOR_SPECIFIC
|
||||
*/
|
||||
|
||||
typedef struct urb_vendor_specific
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of device/hub */
|
||||
UINT8 requestType; /* IN bmRequestType in USB spec. */
|
||||
UINT8 request; /* IN bRequest in USB spec. */
|
||||
UINT16 value; /* IN wValue in USB spec. */
|
||||
UINT16 index; /* IN wIndex in USB spec. */
|
||||
UINT16 length; /* IN wLength in USB spec. */
|
||||
pUINT8 pBfr; /* IN ptr to data buffer */
|
||||
UINT16 actLen; /* OUT actual length transferred */
|
||||
} URB_VENDOR_SPECIFIC, *pURB_VENDOR_SPECIFIC;
|
||||
|
||||
|
||||
/*
|
||||
* URB_PIPE_CREATE
|
||||
*/
|
||||
|
||||
typedef struct urb_pipe_create
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of device/hub */
|
||||
UINT16 endpoint; /* IN Endpoint number */
|
||||
UINT16 configuration; /* IN config w/which pipe associated */
|
||||
UINT16 interface; /* IN interface w/which pipe associated */
|
||||
UINT16 transferType; /* IN Type of transfer: control, bulk, etc. */
|
||||
UINT16 direction; /* IN Specifies IN or OUT endpoint */
|
||||
UINT16 maxPayload; /* IN Maximum data payload per packet */
|
||||
UINT32 bandwidth; /* IN Bandwidth required for pipe */
|
||||
UINT16 serviceInterval; /* IN Required service interval */
|
||||
USBD_PIPE_HANDLE pipeHandle;/* OUT pipe handle returned by USBD */
|
||||
} URB_PIPE_CREATE, *pURB_PIPE_CREATE;
|
||||
|
||||
|
||||
/*
|
||||
* URB_PIPE_DESTROY
|
||||
*/
|
||||
|
||||
typedef struct urb_pipe_destroy
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_PIPE_HANDLE pipeHandle;/* IN handle returned by usbdPipeCreate */
|
||||
} URB_PIPE_DESTROY, *pURB_PIPE_DESTROY;
|
||||
|
||||
|
||||
/*
|
||||
* URB_TRANSFER
|
||||
*/
|
||||
|
||||
typedef struct urb_transfer
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_PIPE_HANDLE pipeHandle;/* IN Pipe handle */
|
||||
pUSB_IRP pIrp; /* IN ptr to I/O request packet */
|
||||
} URB_TRANSFER, *pURB_TRANSFER;
|
||||
|
||||
|
||||
/*
|
||||
* URB_SYNCH_FRAME_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_synch_frame_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of device/hub */
|
||||
UINT16 endpoint; /* IN Endpoint to be queried */
|
||||
UINT16 frameNo; /* OUT Frame number returned by device */
|
||||
} URB_SYNCH_FRAME_GET, *pURB_SYNCH_FRAME_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_CURRENT_FRAME_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_current_frame_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of a device on desired USB */
|
||||
UINT32 frameNo; /* OUT Current frame number for USB */
|
||||
UINT32 frameWindow; /* OUT Frame scheduling window */
|
||||
} URB_CURRENT_FRAME_GET, *pURB_CURRENT_FRAME_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_SOF_MASTER
|
||||
*/
|
||||
|
||||
typedef struct urb_sof_master
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN node ID of a device on desired USB */
|
||||
} URB_SOF_MASTER, *pURB_SOF_MASTER;
|
||||
|
||||
|
||||
/*
|
||||
* URB_SOF_INTERVAL_GET_SET
|
||||
*/
|
||||
|
||||
typedef struct urb_sof_interval_get_set
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN node ID of a device on desired USB */
|
||||
UINT16 sofInterval; /* I/O SOF interval in bit times */
|
||||
} URB_SOF_INTERVAL_GET_SET, *pURB_SOF_INTERVAL_GET_SET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_VERSION_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_version_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
UINT16 version; /* OUT USBD version in BCD */
|
||||
UINT8 mfg [USBD_NAME_LEN+1];/* OUT USBD manufacturer name */
|
||||
} URB_VERSION_GET, *pURB_VERSION_GET;
|
||||
|
||||
|
||||
/*
|
||||
* URB_HCD_ATTACH
|
||||
*/
|
||||
|
||||
typedef struct urb_hcd_attach
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
HCD_EXEC_FUNC hcdExecFunc; /* IN HCD primary entry point */
|
||||
pVOID param; /* IN HCD-specific parameter */
|
||||
GENERIC_HANDLE attachToken; /* OUT attach token */
|
||||
} URB_HCD_ATTACH, *pURB_HCD_ATTACH;
|
||||
|
||||
|
||||
/*
|
||||
* URB_HCD_DETACH
|
||||
*/
|
||||
|
||||
typedef struct urb_hcd_detach
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
GENERIC_HANDLE attachToken; /* IN attach token */
|
||||
} URB_HCD_DETACH, *pURB_HCD_DETACH;
|
||||
|
||||
|
||||
/*
|
||||
* URB_STATISTICS_GET
|
||||
*/
|
||||
|
||||
typedef struct urb_statistics_get
|
||||
{
|
||||
URB_HEADER header; /* URB header */
|
||||
USBD_NODE_ID nodeId; /* IN Node Id of a node on desired USB */
|
||||
pUSBD_STATS pStatistics; /* IN Ptr to structure to receive stats */
|
||||
UINT16 statLen; /* IN Len of stats bfr provided by caller */
|
||||
} URB_STATISTICS_GET, *pURB_STATISTICS_GET;
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
STATUS usbdCoreEntry
|
||||
(
|
||||
pURB_HEADER pUrb /* URB to be executed */
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbdCoreLibh */
|
||||
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,485 @@
|
||||
/* usbdLib.h - USBD functional interface definition */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2001, 2006, 2009-2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify, or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01l,18may10,w_x USB transition to vxbDmaBufLib supporting 64 bit (WIND00193267)
|
||||
01l,29apr10,pad Moved extern C statement after include statements.
|
||||
01k,13jan10,ghs vxWorks 6.9 LP64 adapting
|
||||
01j,11sep09,ghs Remove warning message
|
||||
01i,10jan06,ami Support for vendor specific class drivers added (SPR #113619)
|
||||
01h,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce
|
||||
01g,07may01,wef changed module number to be (module sub num << 8) |
|
||||
M_usbHostLib
|
||||
01f,02may01,wef changed module number to be M_<module> + M_usbHostLib
|
||||
01e,05dec00,wef moved Module number defs to vwModNum.h - add this
|
||||
to #includes
|
||||
01d,26jan00,rcb Redefine <bandwidth> parameter to usbdPipeCreate() as UINT32.
|
||||
01c,29nov99,rcb Increase frame number fields to 32-bits in
|
||||
usbdCurrentFrameGet().
|
||||
01b,07sep99,rcb Add management callbacks and set-bus-state API.
|
||||
01a,07may99,rcb First.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
Defines the USBD functional interface. Functions are provided to invoke
|
||||
each of the underlying USBD URBs (request blocks).
|
||||
*/
|
||||
|
||||
#ifndef __INCusbdLibh
|
||||
#define __INCusbdLibh
|
||||
|
||||
|
||||
/* includes */
|
||||
|
||||
#include "usb/usbHandleLib.h" /* handle utility funcs */
|
||||
#include "usb/usb.h" /* Basic USB definitions */
|
||||
#include "usb/usbHst.h" /* Basic USB definitions */
|
||||
#include "drv/usb/usbHcd.h" /* USB HCD interface definitions */
|
||||
#include "vwModNum.h" /* USB Module number def's */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/* USBD Results - URB_HEADER.Result */
|
||||
|
||||
/*
|
||||
* USB errnos are defined as being part of the USB host Module, as are all
|
||||
* vxWorks module numbers, but the USB Module number is further divided into
|
||||
* sub-modules. Each sub-module has upto 255 values for its own error codes
|
||||
*/
|
||||
|
||||
#define USB_USBD_SUB_MODULE 5
|
||||
|
||||
#define M_usbdLib ( (USB_USBD_SUB_MODULE << 8) | M_usbHostLib )
|
||||
|
||||
#define usbdErr(x) (M_usbdLib | (x))
|
||||
|
||||
#define S_usbdLib_BAD_CLIENT usbdErr(1)
|
||||
#define S_usbdLib_BAD_PARAM usbdErr(2)
|
||||
#define S_usbdLib_BAD_HANDLE usbdErr(3)
|
||||
#define S_usbdLib_OUT_OF_MEMORY usbdErr(4)
|
||||
#define S_usbdLib_OUT_OF_RESOURCES usbdErr(5)
|
||||
#define S_usbdLib_NOT_IMPLEMENTED usbdErr(6)
|
||||
#define S_usbdLib_GENERAL_FAULT usbdErr(7)
|
||||
#define S_usbdLib_NOT_INITIALIZED usbdErr(8)
|
||||
#define S_usbdLib_INTERNAL_FAULT usbdErr(9)
|
||||
#define S_usbdLib_TIMEOUT usbdErr(10)
|
||||
#define S_usbdLib_HCD_FAULT usbdErr(11)
|
||||
#define S_usbdLib_IO_FAULT usbdErr(12)
|
||||
#define S_usbdLib_NOT_HUB usbdErr(13)
|
||||
#define S_usbdLib_CANNOT_CANCEL usbdErr(14)
|
||||
#define S_usbdLib_BANDWIDTH_FAULT usbdErr(15)
|
||||
#define S_usbdLib_POWER_FAULT usbdErr(16)
|
||||
#define S_usbdLib_SOF_MASTER_FAULT usbdErr(17)
|
||||
|
||||
/* String length definitions */
|
||||
|
||||
#define USBD_NAME_LEN 32 /* Maximum length for name */
|
||||
|
||||
/* management events */
|
||||
|
||||
#define USBD_MNGMT_RESUME 1 /* remote wakeup/resume */
|
||||
|
||||
/* bus states - see usbdBusStateSet() */
|
||||
|
||||
#define USBD_BUS_SUSPEND 0x0001 /* suspend bus */
|
||||
#define USBD_BUS_RESUME 0x0002 /* resume bus */
|
||||
|
||||
/* USBD_NOTIFY_ALL pertains to dynamic attach/removal notification */
|
||||
|
||||
#ifndef USBD_NOTIFY_ALL
|
||||
#define USBD_NOTIFY_ALL 0xFFFF
|
||||
#endif
|
||||
|
||||
#define USBD_DYNA_ATTACH 0
|
||||
#define USBD_DYNA_REMOVE 1
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/* Handles and callbacks. */
|
||||
|
||||
typedef GENERIC_HANDLE USBD_CLIENT_HANDLE, *pUSBD_CLIENT_HANDLE;
|
||||
typedef UINT32 USBD_NODE_ID, *pUSBD_NODE_ID;
|
||||
typedef GENERIC_HANDLE USBD_PIPE_HANDLE, *pUSBD_PIPE_HANDLE;
|
||||
|
||||
typedef VOID (*URB_CALLBACK) (pVOID pUrb);
|
||||
|
||||
typedef VOID (*USBD_ATTACH_CALLBACK)
|
||||
(
|
||||
USBD_NODE_ID nodeId,
|
||||
UINT16 attachAction,
|
||||
UINT16 configuration,
|
||||
UINT16 interface,
|
||||
UINT16 deviceClass,
|
||||
UINT16 deviceSubClass,
|
||||
UINT16 deviceProtocol
|
||||
);
|
||||
|
||||
typedef VOID (*USBD_MNGMT_CALLBACK)
|
||||
(
|
||||
pVOID callbackParam,
|
||||
USBD_NODE_ID nodeId,
|
||||
UINT16 mngmtCode
|
||||
);
|
||||
|
||||
/*
|
||||
* USBD_NODE_INFO
|
||||
*/
|
||||
|
||||
typedef struct usbd_node_info
|
||||
{
|
||||
UINT16 nodeType; /* Type of node */
|
||||
UINT16 nodeSpeed; /* Speed of node, e.g., 12MBit, 1.5MBit */
|
||||
USBD_NODE_ID parentHubId; /* Node Id of hub to which node is connected */
|
||||
UINT16 parentHubPort; /* Port on parent hub to which connected */
|
||||
USBD_NODE_ID rootId; /* Node Id of root for USB to which connected */
|
||||
} USBD_NODE_INFO, *pUSBD_NODE_INFO;
|
||||
|
||||
/*
|
||||
* USBD_STATS
|
||||
*/
|
||||
|
||||
typedef struct usbd_stats
|
||||
{
|
||||
UINT16 totalTransfersIn; /* Total # of inbound transfers */
|
||||
UINT16 totalTransfersOut; /* Total # of outbound transfers */
|
||||
UINT16 totalReceiveErrors; /* Errors on inbound traffic */
|
||||
UINT16 totalTransmitErrors; /* Errors on transmit */
|
||||
} USBD_STATS, *pUSBD_STATS;
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
STATUS usbdInitialize (void);
|
||||
|
||||
STATUS usbdShutdown (void);
|
||||
|
||||
STATUS usbdClientRegister
|
||||
(
|
||||
pCHAR pClientName, /* Client name */
|
||||
pUSBD_CLIENT_HANDLE pClientHandle /* Client hdl returned by USBD */
|
||||
);
|
||||
|
||||
STATUS usbdClientUnregister
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle /* Client handle */
|
||||
);
|
||||
|
||||
STATUS usbdMngmtCallbackSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_MNGMT_CALLBACK mngmtCallback, /* management callback */
|
||||
pVOID mngmtCallbackParam /* client-defined parameter */
|
||||
);
|
||||
|
||||
STATUS usbdBusStateSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* node ID */
|
||||
UINT16 busState /* new bus state: USBD_BUS_xxxx */
|
||||
);
|
||||
|
||||
STATUS usbdBusCountGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
pUINT16 pBusCount /* Word bfr to receive bus count */
|
||||
);
|
||||
|
||||
STATUS usbdRootNodeIdGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
UINT16 busIndex, /* Bus index */
|
||||
pUSBD_NODE_ID pRootId /* bfr to receive Root Id */
|
||||
);
|
||||
|
||||
STATUS usbdHubPortCountGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID hubId, /* Node Id for desired hub */
|
||||
pUINT16 pPortCount /* UINT16 bfr to receive port count */
|
||||
);
|
||||
|
||||
STATUS usbdNodeIdGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID hubId, /* Node Id for desired hub */
|
||||
UINT16 portIndex, /* Port index */
|
||||
pUINT16 pNodeType, /* bfr to receive node type */
|
||||
pUSBD_NODE_ID pNodeId /* bfr to receive Node Id */
|
||||
);
|
||||
|
||||
STATUS usbdNodeInfoGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
pUSBD_NODE_INFO pNodeInfo, /* Structure to receive node info */
|
||||
UINT16 infoLen /* Len of bfr allocated by client */
|
||||
);
|
||||
|
||||
STATUS usbdDynamicAttachRegister
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
UINT16 deviceClass, /* USB class code */
|
||||
UINT16 deviceSubClass, /* USB sub-class code */
|
||||
UINT16 deviceProtocol, /* USB device protocol */
|
||||
BOOL vendorSpecific, /* class/vendor specific device */
|
||||
USBD_ATTACH_CALLBACK attachCallback /* User-supplied callback routine */
|
||||
);
|
||||
|
||||
STATUS usbdDynamicAttachUnRegister
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
UINT16 deviceClass, /* USB class code */
|
||||
UINT16 deviceSubClass, /* USB sub-class code */
|
||||
UINT16 deviceProtocol, /* USB device protocol */
|
||||
USBD_ATTACH_CALLBACK attachCallback /* User-supplied callback routine */
|
||||
);
|
||||
|
||||
STATUS usbdFeatureClear
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 requestType, /* Selects request type */
|
||||
UINT16 feature, /* Feature selector */
|
||||
UINT16 index /* Interface/endpoint index */
|
||||
);
|
||||
|
||||
STATUS usbdFeatureSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 requestType, /* Selects request type */
|
||||
UINT16 feature, /* Feature selector */
|
||||
UINT16 index /* Interface/endpoint index */
|
||||
);
|
||||
|
||||
STATUS usbdConfigurationGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
pUINT16 pConfiguration /* bfr to receive config value */
|
||||
);
|
||||
|
||||
STATUS usbdConfigurationSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 configuration, /* New configuration to be set */
|
||||
UINT16 maxPower /* max power this config will draw */
|
||||
);
|
||||
|
||||
STATUS usbdDescriptorGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT8 requestType, /* specifies type of request */
|
||||
UINT8 descriptorType, /* Type of descriptor */
|
||||
UINT8 descriptorIndex, /* Index of descriptor */
|
||||
UINT16 languageId, /* Language ID */
|
||||
UINT16 bfrLen, /* Max length of data to be returned */
|
||||
pUINT8 pBfr, /* Pointer to bfr to receive data */
|
||||
pUINT16 pActLen /* bfr to receive actual length */
|
||||
);
|
||||
|
||||
STATUS usbdDescriptorSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT8 requestType, /* selects request type */
|
||||
UINT8 descriptorType, /* Type of descriptor */
|
||||
UINT8 descriptorIndex, /* Index of descriptor */
|
||||
UINT16 languageId, /* Language ID */
|
||||
UINT16 bfrLen, /* Max length of data to be returned */
|
||||
pUINT8 pBfr /* Pointer to bfr to receive data */
|
||||
);
|
||||
|
||||
STATUS usbdInterfaceGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 interfaceIndex, /* Index of interface */
|
||||
pUINT16 pAlternateSetting /* Current alternate setting */
|
||||
);
|
||||
|
||||
STATUS usbdInterfaceSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 interfaceIndex, /* Index of interface */
|
||||
UINT16 alternateSetting /* Alternate setting */
|
||||
);
|
||||
|
||||
STATUS usbdStatusGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 requestType, /* Selects device/interface/endpoint */
|
||||
UINT16 index, /* Interface/endpoint index */
|
||||
UINT16 bfrLen, /* length of bfr */
|
||||
pUINT8 pBfr, /* bfr to receive status */
|
||||
pUINT16 pActLen /* bfr to receive act len xfr'd */
|
||||
);
|
||||
|
||||
STATUS usbdAddressGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
pUINT16 pDeviceAddress /* Currently assigned device address */
|
||||
);
|
||||
|
||||
STATUS usbdAddressSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 deviceAddress /* New device address */
|
||||
);
|
||||
|
||||
STATUS usbdVendorSpecific
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT8 requestType, /* bmRequestType in USB spec. */
|
||||
UINT8 request, /* bRequest in USB spec. */
|
||||
UINT16 value, /* wValue in USB spec. */
|
||||
UINT16 index, /* wIndex in USB spec. */
|
||||
UINT16 length, /* wLength in USB spec. */
|
||||
pUINT8 pBfr, /* ptr to data buffer */
|
||||
pUINT16 pActLen /* actual length of IN */
|
||||
);
|
||||
|
||||
STATUS usbdPipeCreate
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 endpoint, /* Endpoint number */
|
||||
UINT16 configuration, /* config w/which pipe associated */
|
||||
UINT16 interface, /* interface w/which pipe associated */
|
||||
UINT16 transferType, /* Type of transfer: control, bulk... */
|
||||
UINT16 direction, /* Specifies IN or OUT endpoint */
|
||||
UINT16 maxPayload, /* Maximum data payload per packet */
|
||||
UINT32 bandwidth, /* Bandwidth required for pipe */
|
||||
UINT16 serviceInterval, /* Required service interval */
|
||||
pUSBD_PIPE_HANDLE pPipeHandle /* pipe handle returned by USBD */
|
||||
);
|
||||
|
||||
STATUS usbdPipeDestroy
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_PIPE_HANDLE pipeHandle /* pipe handle */
|
||||
);
|
||||
|
||||
STATUS usbdPipeSetup
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_PIPE_HANDLE pipeHandle, /* Pipe handle */
|
||||
pUSB_TRANSFER_SETUP_INFO pSetup /* Transfer setup info */
|
||||
);
|
||||
STATUS usbdTransfer
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_PIPE_HANDLE pipeHandle, /* Pipe handle */
|
||||
pUSB_IRP pIrp /* ptr to I/O request packet */
|
||||
);
|
||||
|
||||
STATUS usbdTransferAbort
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_PIPE_HANDLE pipeHandle, /* Pipe handle */
|
||||
pUSB_IRP pIrp /* ptr to I/O to abort */
|
||||
);
|
||||
|
||||
STATUS usbdSynchFrameGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client Handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of device/hub */
|
||||
UINT16 endpoint, /* Endpoint to be queried */
|
||||
pUINT16 pFrameNo /* Frame number returned by device */
|
||||
);
|
||||
|
||||
STATUS usbdCurrentFrameGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of root for desired USB */
|
||||
pUINT32 pFrameNo, /* bfr to receive current frame no. */
|
||||
pUINT32 pFrameWindow /* bfr to receive frame window */
|
||||
);
|
||||
|
||||
/* we do not use it any more in USB 2.x */
|
||||
#if 0
|
||||
STATUS usbdSofMasterTake
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId /* Node Id of node on desired USB */
|
||||
);
|
||||
|
||||
STATUS usbdSofMasterRelease
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId /* Node Id of node on desired USB */
|
||||
);
|
||||
|
||||
STATUS usbdSofIntervalGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of node on desired USB */
|
||||
pUINT16 pSofInterval /* bfr to receive SOF interval */
|
||||
);
|
||||
|
||||
STATUS usbdSofIntervalSet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of node on desired USB */
|
||||
UINT16 sofInterval /* new SOF interval */
|
||||
);
|
||||
#endif
|
||||
|
||||
STATUS usbdVersionGet
|
||||
(
|
||||
pUINT16 pVersion, /* UINT16 bfr to receive version */
|
||||
pCHAR pMfg /* bfr to receive USBD mfg string */
|
||||
);
|
||||
|
||||
/* we do not use it any more in USB 2.x */
|
||||
#if 0
|
||||
STATUS usbdHcdAttach
|
||||
(
|
||||
HCD_EXEC_FUNC hcdExecFunc, /* Ptr to HCDs primary entry point */
|
||||
pVOID param, /* HCD-specific parameter */
|
||||
pGENERIC_HANDLE pAttachToken /* Token to identify HCD in future */
|
||||
);
|
||||
|
||||
STATUS usbdHcdDetach
|
||||
(
|
||||
GENERIC_HANDLE attachToken /* AttachToken returned */
|
||||
);
|
||||
#endif
|
||||
|
||||
STATUS usbdStatisticsGet
|
||||
(
|
||||
USBD_CLIENT_HANDLE clientHandle, /* Client handle */
|
||||
USBD_NODE_ID nodeId, /* Node Id of a node on desired USB */
|
||||
pUSBD_STATS pStatistics, /* Ptr to structure to receive stats */
|
||||
UINT16 statLen /* Len of bfr provided by caller */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCusbdLibh */
|
||||
|
||||
/* End of file. */
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/* usbdMisc.h - USBD Miscellaneous Definitions */
|
||||
|
||||
/* Copyright 2004 Wind River Systems, Inc.
|
||||
|
||||
This software includes software licensed to Wind River Systems, Inc.
|
||||
by Wipro, Ltd. Wind River licensees may use this software according
|
||||
to the terms of their Wind River license agreement(s) applicable to
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modification history
|
||||
--------------------
|
||||
01a,17mar03,ssh written
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
This file contains the function prototypes, macros and structures
|
||||
required for interfaces that provide user specific information
|
||||
from USBD
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
INTERNAL
|
||||
*******************************************************************************
|
||||
* Filename : usbdMisc.h
|
||||
*
|
||||
* Copyright :
|
||||
*
|
||||
* THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO
|
||||
* LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING
|
||||
* ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE
|
||||
* 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY
|
||||
* ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY
|
||||
* PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE
|
||||
* ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL.
|
||||
* THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF
|
||||
* THIS COPYRIGHT AS PER APPLICABLE LAWS.
|
||||
*
|
||||
*
|
||||
* Description : This file contains the function prototypes, macros and
|
||||
* structures required for interfaces that provide user
|
||||
* specific information from USBD
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __INCusbdMisch
|
||||
#define __INCusbdMisch
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************** GLOBAL FUNCTIONS ***************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : usbdBusCntGet
|
||||
* Description : This function is called by the Integration testing tool to
|
||||
* obtain the number of USB's attached to the host.
|
||||
* Parameters : Total number of buses(host controllers)on the system
|
||||
* Return Type : UINT16 (bus count)
|
||||
* Global Variables : gHCDriverList
|
||||
* Calls : None
|
||||
* Called by : Translation Unit
|
||||
* To Do : None
|
||||
******************************************************************************/
|
||||
UINT16 usbdBusCntGet(void);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : usbdRootNodeIDGet
|
||||
* Description : This function is called by the Integration testing tool to
|
||||
* obtain the node id of the root hub on a Host Controller.
|
||||
* Parameters : uBusIndex - Bus Index
|
||||
* phRootHub - Pointer to the root hub handle
|
||||
* Return Type : USBHST_SUCCESS - If successful
|
||||
* USBHST_FAILURE - If unsuccessful
|
||||
* USBHST_INVALID_PARAMETER - If invalid parameter was passed
|
||||
* Global Variables : None
|
||||
* Calls : None
|
||||
* Called by : Translation Unit
|
||||
* To Do : None
|
||||
******************************************************************************/
|
||||
USBHST_STATUS usbdRootNodeIDGet(UINT16 uBusIndex,
|
||||
PUINT32 phRootHub);
|
||||
|
||||
#if 0
|
||||
/***************************************************************************
|
||||
*
|
||||
* usbdHubPortCntGet - Returns number of ports connected to a hub
|
||||
*
|
||||
* usbdHubPortCountGet() provides clients with a convenient mechanism to
|
||||
* retrieve the number of downstream ports provided by the specified hub.
|
||||
* Clients can also retrieve this information by retrieving configuration
|
||||
* descriptors from the hub using the Configuration Functions describe in
|
||||
* a following section.
|
||||
*
|
||||
* <hubId> must be the Node Id for the desired USB hub. An error will be
|
||||
* returned if <hubId> does not refer to a hub. <pPortCount> must point to
|
||||
* a UINT16 variable in which the total number of ports on the specified
|
||||
* hub will be stored.
|
||||
* Return Type : USBHST_SUCCESS - If successful
|
||||
* USBHST_FAILURE - If unsuccessful
|
||||
* USBHST_INVALID_PARAMETER - If invalid parameter was passed
|
||||
*
|
||||
*/
|
||||
|
||||
USBHST_STATUS usbdHubPortCntGet
|
||||
(
|
||||
UINT32 hubId, /* Node Id for desired hub */
|
||||
PUINT16 pPortCount /* bfr to receive port count */
|
||||
);
|
||||
/***************************************************************************
|
||||
*
|
||||
* usbdNodeIDGet - Gets the id of the node connected to a hub port
|
||||
*
|
||||
* Clients use this function to retrieve the Node Id for devices attached to
|
||||
* each of a hub’s ports. <hubId> and <portIndex> identify the hub and port
|
||||
* to which a device may be attached. <pNodeType> must point to a UINT16
|
||||
* variable to receive a type code as follows:
|
||||
*
|
||||
* .IP "USB_NODETYPE_NONE"
|
||||
* No device is attached to the specified port.
|
||||
* .IP "USB_NODETYPE_HUB"
|
||||
* A hub is attached to the specified port.
|
||||
* .IP "USB_NODETYPE_DEVICE"
|
||||
* A device (non-hub) is attached to the specified port.
|
||||
*
|
||||
* If the node type is returned as USBD_NODE_TYPE_NONE, then a Node Id is
|
||||
* not returned and the value returned in <pNodeId> is undefined. If the
|
||||
* node type indicates a hub or device is attached to the port, then
|
||||
* <pNodeId> will contain that hub or device’s nodeId upon return.
|
||||
*
|
||||
* RETURNS: OK, or ERROR if unable to get node ID.
|
||||
*/
|
||||
|
||||
USBHST_STATUS usbdNodeIDGet
|
||||
(
|
||||
UINT32 hubId, /* Node Id for desired hub */
|
||||
UINT16 portIndex, /* Port index */
|
||||
PUINT16 pNodeType, /* bfr to receive node type */
|
||||
PUINT32 pNodeId /* bfr to receive Node Id */
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : usbdFrameWindowGet
|
||||
* Description : This function is called by the Integration testing tool to
|
||||
* obtain the Frame Window and current frame number from HCD.
|
||||
* Parameters : nodeId - Node ID of the device
|
||||
* pFrameWindow - Pointer to frame information i.e,Max frame
|
||||
* scheduling window and current frame number
|
||||
* Return Type : USBHST_SUCCESS - If successful
|
||||
* USBHST_FAILURE - If unsuccessful
|
||||
* USBHST_INVALID_PARAMETER - If invalid parameter was passed
|
||||
* Global Variables : g_pHCDriverList
|
||||
* Calls : None
|
||||
* Called by : None
|
||||
* To Do : None
|
||||
******************************************************************************/
|
||||
|
||||
#endif
|
||||
|
||||
USBHST_STATUS usbdFrameWindowGet(UINT32 nodeId,
|
||||
PUINT16 pFrameWindow);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* End of #ifndef __INCusbdMisch */
|
||||
/**************************** End of usbdMisc.h ****************************/
|
||||
@@ -0,0 +1,200 @@
|
||||
; Wind River USB CDC Serial Emualtor INF file for Windows
|
||||
;
|
||||
; /*
|
||||
; * Copyright (c) 2009, 2011 Wind River Systems, Inc.
|
||||
; *
|
||||
; * The right to copy, distribute, modify or otherwise make use
|
||||
; * of this software may be licensed only pursuant to the terms
|
||||
; * of an applicable Wind River license agreement.
|
||||
; */
|
||||
; /*
|
||||
; Modification history
|
||||
; --------------------
|
||||
; 01e,17aug11,s_z Add composite device support with PID as 0xFF02
|
||||
; 01d,11arp11,s_z Add MLPL description
|
||||
; 01c,30mar11,s_z Add composite device support
|
||||
; 01b,21mar11,ghs Add 64-bit support(WIND00261623)
|
||||
; 01a,09mar09,w_x created
|
||||
; */
|
||||
;
|
||||
;/*
|
||||
;DESCRIPTION
|
||||
;
|
||||
; This INF file is under (MICROSOFT LIMITED PUBLIC LICENSE)MLPL,
|
||||
; which can be found at:
|
||||
; <http://msdn.microsoft.com/en-us/cc300389.aspx#MLPL>.
|
||||
; For use only on Windows operating systems.
|
||||
;
|
||||
; MICROSOFT LIMITED PUBLIC LICENSE(MLPL)
|
||||
;
|
||||
; This license governs use of code marked as "sample" or "example" available
|
||||
; on this web site without a license agreement, as provided under the section
|
||||
; above titled "NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE". If
|
||||
; you use such code (the "software"), you accept this license.
|
||||
; If you do not accept the license, do not use the software.
|
||||
;
|
||||
; 1. Definitions
|
||||
;
|
||||
; The terms "reproduce," "reproduction," "derivative works," and
|
||||
; "distribution" have the same meaning here as under U.S. copyright law.
|
||||
;
|
||||
; A "contribution" is the original software, or any additions or changes to
|
||||
; the software.
|
||||
;
|
||||
; A "contributor" is any person that distributes its contribution under
|
||||
; this license.
|
||||
;
|
||||
; "Licensed patents" are a contributor's patent claims that read directly
|
||||
; on its contribution.
|
||||
;
|
||||
; 2. Grant of Rights
|
||||
;
|
||||
; (A) Copyright Grant - Subject to the terms of this license, including
|
||||
; the license conditions and limitations in section 3, each contributor
|
||||
; grants you a non-exclusive, worldwide, royalty-free copyright license to
|
||||
; reproduce its contribution, prepare derivative works of its contribution,
|
||||
; and distribute its contribution or any derivative works that you create.
|
||||
;
|
||||
; (B) Patent Grant - Subject to the terms of this license, including the
|
||||
; license conditions and limitations in section 3, each contributor grants
|
||||
; you a non-exclusive, worldwide, royalty-free license under its licensed
|
||||
; patents to make, have made, use, sell, offer for sale, import, and/or
|
||||
; otherwise dispose of its contribution in the software or derivative works of
|
||||
; the contribution in the software.
|
||||
;
|
||||
; 3. Conditions and Limitations
|
||||
;
|
||||
; (A) No Trademark License- This license does not grant you rights to use any
|
||||
; contributors' name, logo, or trademarks.
|
||||
;
|
||||
; (B) If you bring a patent claim against any contributor over patents that
|
||||
; you claim are infringed by the software, your patent license from such
|
||||
; contributor to the software ends automatically.
|
||||
;
|
||||
; (C) If you distribute any portion of the software, you must retain all
|
||||
; copyright, patent, trademark, and attribution notices that are present
|
||||
; in the software.
|
||||
;
|
||||
; (D) If you distribute any portion of the software in source code form,
|
||||
; you may do so only under this license by including a complete copy of
|
||||
; this license with your distribution. If you distribute any portion of the
|
||||
; software in compiled or object code form, you may only do so under a license
|
||||
; that complies with this license.
|
||||
;
|
||||
; (E) The software is licensed "as-is." You bear the risk of using it.
|
||||
; The contributors give no express warranties, guarantees or conditions.
|
||||
; You may have additional consumer rights under your local laws which this
|
||||
; license cannot change. To the extent permitted under your local laws,
|
||||
; the contributors exclude the implied warranties of merchantability,
|
||||
; fitness for a particular purpose and non-infringement.
|
||||
;
|
||||
; (F) Platform Limitation - The licenses granted in sections 2(A) and 2(B)
|
||||
; extend only to the software or derivative works that you create that run
|
||||
; on a Microsoft Windows operating system product.
|
||||
;
|
||||
; This INF has been tested on for Windows XP SP3, and Windows 7.
|
||||
;
|
||||
; NOTE: The user need reset the VID/PID/MI data for new products who
|
||||
; has the different VID/PID numbers.
|
||||
;*/
|
||||
|
||||
[Version] ; Version
|
||||
Signature="$Windows NT$" ; Windows NT and later
|
||||
Class=Ports ; Serial port driver
|
||||
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} ; GUID
|
||||
Provider=%WindRiver% ; Provided by WindRiver
|
||||
DriverVer=21/03/2011,1.0.1.0 ; Version
|
||||
|
||||
[DestinationDirs] ; DestinationDirs
|
||||
DefaultDestDir=12 ; Default to \drivers or \IOSubSys
|
||||
|
||||
[Manufacturer] ; Manufacturer
|
||||
%WindRiver%=WRSUSBtoSerIns,NTx86,NTamd64,NTia64 ; WindRiver
|
||||
|
||||
[WRSUSBtoSerIns.NTx86] ; Entry for x86
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install,USB\VID_1439&PID_FF02
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install,USB\VID_1439&PID_FF02&MI_00
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install,USB\VID_1439&PID_FF03&MI_02
|
||||
|
||||
[WRSUSBtoSerIns.NTia64] ; Entry for ia64
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install.NTia64,USB\VID_1439&PID_FF02
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install.NTia64,USB\VID_1439&PID_FF03&MI_00
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install.NTia64,USB\VID_1439&PID_FF03&MI_02
|
||||
|
||||
[WRSUSBtoSerIns.NTamd64] ; Entry for amd64
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install.NTamd64,USB\VID_1439&PID_FF02
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install.NTamd64,USB\VID_1439&PID_FF02&MI_00
|
||||
%WindRiverUsbCdcSerialEmulator%=WRSUSBtoSerIns.Install.NTamd64,USB\VID_1439&PID_FF03&MI_02
|
||||
|
||||
[WRSUSBtoSerIns.Install] ; x86 install
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=FakeModemCopyFileSection
|
||||
AddReg=WRSUSBtoSerIns.AddReg ; Registry keys are in WRSUSBtoSerIns.AddReg
|
||||
|
||||
[WRSUSBtoSerIns.AddReg] ; AddReg
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,usbser.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[WRSUSBtoSerIns.Install.Services] ; Services
|
||||
AddService=usbser,0x00000002,WRSUSBtoSerIns.AddService ; usbser act as PnP driver of the device
|
||||
|
||||
[WRSUSBtoSerIns.AddService] ; Service install
|
||||
DisplayName=%USBSer% ; Name of the driver
|
||||
ServiceType=1 ; Service kernel driver
|
||||
StartType=3 ; Driver started by the PnP manager
|
||||
ErrorControl=1 ; Warn about errors
|
||||
ServiceBinary=%12%\usbser.sys ; Driver file
|
||||
|
||||
|
||||
[WRSUSBtoSerIns.Install.NTamd64] ; amd64 install
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=WRSUSBtoSerIns.InstallCopyFiles.NTamd64
|
||||
AddReg=WRSUSBtoSerIns.Install.NTamd64.AddReg
|
||||
|
||||
[WRSUSBtoSerIns.InstallCopyFiles.NTamd64] ; amd64 copy files
|
||||
usbser.sys,,,0x20
|
||||
|
||||
[WRSUSBtoSerIns.Install.NTamd64.AddReg] ; amd64 AddReg
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,usbser.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[WRSUSBtoSerIns.Install.NTamd64.Services] ; amd64 Services
|
||||
AddService=usbser, 0x00000002, WRSUSBtoSerIns.InstallAddService.NTamd64
|
||||
|
||||
[WRSUSBtoSerIns.InstallAddService.NTamd64] ; amd64 Service install
|
||||
DisplayName=%USBSer%
|
||||
ServiceType=1
|
||||
StartType=3
|
||||
ErrorControl=1
|
||||
ServiceBinary=%12%\usbser.sys
|
||||
|
||||
|
||||
[WRSUSBtoSerIns.Install.NTia64] ; ia64 install
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=WRSUSBtoSerIns.InstallCopyFiles.NTia64
|
||||
AddReg=WRSUSBtoSerIns.Install.NTia64.AddReg
|
||||
|
||||
[WRSUSBtoSerIns.InstallCopyFiles.NTia64] ; ia64 copy files
|
||||
usbser.sys,,,0x20
|
||||
|
||||
[WRSUSBtoSerIns.Install.NTia64.AddReg] ; ia64 AddReg
|
||||
HKR,,DevLoader,,*ntkern
|
||||
HKR,,NTMPDriver,,usbser.sys
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[WRSUSBtoSerIns.Install.NTia64.Services] ; ia64 Services
|
||||
AddService=usbser, 0x00000002, WRSUSBtoSerIns.InstallAddService.NTia64
|
||||
|
||||
[WRSUSBtoSerIns.InstallAddService.NTia64] ; ia64 Service install
|
||||
DisplayName=%USBSer%
|
||||
ServiceType=1
|
||||
StartType=3
|
||||
ErrorControl=1
|
||||
ServiceBinary=%12%\usbser.sys
|
||||
|
||||
[Strings] ; Global strings
|
||||
WindRiver="Wind River Systems"
|
||||
WindRiverUsbCdcSerialEmulator="Wind River USB CDC Serial Emulator"
|
||||
USBSer="USB Serial Driver"
|
||||
@@ -0,0 +1,164 @@
|
||||
; Wind River USB RNDIS Function INF file for Windows
|
||||
;
|
||||
; /*
|
||||
; * Copyright (c) 2011 Wind River Systems, Inc.
|
||||
; *
|
||||
; * The right to copy, distribute, modify or otherwise make use
|
||||
; * of this software may be licensed only pursuant to the terms
|
||||
; * of an applicable Wind River license agreement.
|
||||
; */
|
||||
; /*
|
||||
; Modification history
|
||||
; --------------------
|
||||
; 01d,17aug11,s_z Add composite device support with PID as 0xFF01
|
||||
; 01c,11arp11,s_z Add MLPL description
|
||||
; 01b,30mar11,s_z Add composite device support
|
||||
; 01a,14feb11,s_z created
|
||||
; */
|
||||
;
|
||||
;/*
|
||||
;DESCRIPTION
|
||||
;
|
||||
; This INF file is under (MICROSOFT LIMITED PUBLIC LICENSE)MLPL,
|
||||
; which can be found at:
|
||||
; <http://msdn.microsoft.com/en-us/cc300389.aspx#MLPL>.
|
||||
; For use only on Windows operating systems.
|
||||
;
|
||||
; MICROSOFT LIMITED PUBLIC LICENSE(MLPL)
|
||||
;
|
||||
; This license governs use of code marked as "sample" or "example" available
|
||||
; on this web site without a license agreement, as provided under the section
|
||||
; above titled "NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE". If
|
||||
; you use such code (the "software"), you accept this license.
|
||||
; If you do not accept the license, do not use the software.
|
||||
;
|
||||
; 1. Definitions
|
||||
;
|
||||
; The terms "reproduce," "reproduction," "derivative works," and
|
||||
; "distribution" have the same meaning here as under U.S. copyright law.
|
||||
;
|
||||
; A "contribution" is the original software, or any additions or changes to
|
||||
; the software.
|
||||
;
|
||||
; A "contributor" is any person that distributes its contribution under
|
||||
; this license.
|
||||
;
|
||||
; "Licensed patents" are a contributor's patent claims that read directly
|
||||
; on its contribution.
|
||||
;
|
||||
; 2. Grant of Rights
|
||||
;
|
||||
; (A) Copyright Grant - Subject to the terms of this license, including
|
||||
; the license conditions and limitations in section 3, each contributor
|
||||
; grants you a non-exclusive, worldwide, royalty-free copyright license to
|
||||
; reproduce its contribution, prepare derivative works of its contribution,
|
||||
; and distribute its contribution or any derivative works that you create.
|
||||
;
|
||||
; (B) Patent Grant - Subject to the terms of this license, including the
|
||||
; license conditions and limitations in section 3, each contributor grants
|
||||
; you a non-exclusive, worldwide, royalty-free license under its licensed
|
||||
; patents to make, have made, use, sell, offer for sale, import, and/or
|
||||
; otherwise dispose of its contribution in the software or derivative works of
|
||||
; the contribution in the software.
|
||||
;
|
||||
; 3. Conditions and Limitations
|
||||
;
|
||||
; (A) No Trademark License- This license does not grant you rights to use any
|
||||
; contributors' name, logo, or trademarks.
|
||||
;
|
||||
; (B) If you bring a patent claim against any contributor over patents that
|
||||
; you claim are infringed by the software, your patent license from such
|
||||
; contributor to the software ends automatically.
|
||||
;
|
||||
; (C) If you distribute any portion of the software, you must retain all
|
||||
; copyright, patent, trademark, and attribution notices that are present
|
||||
; in the software.
|
||||
;
|
||||
; (D) If you distribute any portion of the software in source code form,
|
||||
; you may do so only under this license by including a complete copy of
|
||||
; this license with your distribution. If you distribute any portion of the
|
||||
; software in compiled or object code form, you may only do so under a license
|
||||
; that complies with this license.
|
||||
;
|
||||
; (E) The software is licensed "as-is." You bear the risk of using it.
|
||||
; The contributors give no express warranties, guarantees or conditions.
|
||||
; You may have additional consumer rights under your local laws which this
|
||||
; license cannot change. To the extent permitted under your local laws,
|
||||
; the contributors exclude the implied warranties of merchantability,
|
||||
; fitness for a particular purpose and non-infringement.
|
||||
;
|
||||
; (F) Platform Limitation - The licenses granted in sections 2(A) and 2(B)
|
||||
; extend only to the software or derivative works that you create that run
|
||||
; on a Microsoft Windows operating system product.
|
||||
;
|
||||
; This INF has been tested on for Windows XP SP3, and Windows 7.
|
||||
;
|
||||
; NOTE: The user need reset the VID/PID/MI data for new products who
|
||||
; has the different VID/PID numbers.
|
||||
;*/
|
||||
|
||||
[Version] ;Version
|
||||
Signature = "$Windows NT$" ;
|
||||
Class = Net ;Class
|
||||
ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} ;GUID
|
||||
Provider = %WindRiver% ;WindRiver
|
||||
DriverVer = 02/12/2011,1.0.0.0 ;Version
|
||||
;CatalogFile = device.cat
|
||||
|
||||
[Manufacturer]
|
||||
%WindRiver% = RndisDevices,NTx86,NTamd64,NTia64
|
||||
|
||||
; Decoration for x86 architecture
|
||||
[RndisDevices.NTx86]
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF01
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF01&MI_00
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF03&MI_00
|
||||
|
||||
; Decoration for x64 architecture
|
||||
[RndisDevices.NTamd64]
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF01
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF01&MI_00
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF03&MI_00
|
||||
|
||||
; Decoration for ia64 architecture
|
||||
[RndisDevices.NTia64]
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF01
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF01&MI_00
|
||||
%RndisDevice% = RNDIS.NT.5.1, USB\VID_1439&PID_FF03&MI_00
|
||||
|
||||
;@@@ This is the common setting for setup
|
||||
[ControlFlags]
|
||||
ExcludeFromSelect=*
|
||||
|
||||
; DDInstall section
|
||||
; References the in-build Netrndis.inf
|
||||
[RNDIS.NT.5.1]
|
||||
Characteristics = 0x84 ; NCF_PHYSICAL + NCF_HAS_UI
|
||||
BusType = 15
|
||||
; NEVER REMOVE THE FOLLOWING REFERENCE FOR NETRNDIS.INF
|
||||
include = netrndis.inf
|
||||
needs = Usb_Rndis.ndi
|
||||
AddReg = Rndis_AddReg_Vista
|
||||
|
||||
; DDInstal.Services section
|
||||
[RNDIS.NT.5.1.Services]
|
||||
include = netrndis.inf
|
||||
needs = Usb_Rndis.ndi.Services
|
||||
|
||||
; Optional registry settings. You can modify as needed.
|
||||
[RNDIS_AddReg_Vista]
|
||||
HKR, NDI\params\VistaProperty, ParamDesc, 0, %Vista_Property%
|
||||
HKR, NDI\params\VistaProperty, type, 0, "edit"
|
||||
HKR, NDI\params\VistaProperty, LimitText, 0, "12"
|
||||
HKR, NDI\params\VistaProperty, UpperCase, 0, "1"
|
||||
HKR, NDI\params\VistaProperty, default, 0, " "
|
||||
HKR, NDI\params\VistaProperty, optional, 0, "1"
|
||||
|
||||
; No sys copyfiles - the sys files are already in-build
|
||||
; (part of the operating system).
|
||||
|
||||
; Modify these strings for your device as needed.
|
||||
[Strings]
|
||||
WindRiver = "Wind River Systems"
|
||||
RndisDevice = "USB Remote NDIS Device"
|
||||
Vista_Property = "Optional Vista Property"
|
||||
Reference in New Issue
Block a user