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

📄 xllp_udc_os_depend.c

📁 PXA270硬件测试源代码
💻 C
字号:
/******************************************************************************
**
**  COPYRIGHT (C) 2000, 2001 Intel Corporation.
**
**  This software as well as the software described in it is furnished under 
**  license and may only be used or copied in accordance with the terms of the 
**  license. The information in this file is furnished for informational use 
**  only, is subject to change without notice, and should not be construed as 
**  a commitment by Intel Corporation. Intel Corporation assumes no 
**  responsibility or liability for any errors or inaccuracies that may appear 
**  in this document or any software that may be provided in association with 
**  this document. 
**  Except as permitted by such license, no part of this document may be 
**  reproduced, stored in a retrieval system, or transmitted in any form or by 
**  any means without the express written consent of Intel Corporation. 
**
**  FILENAME:       xllp_udc_os_depend.c
**
**  PURPOSE:   		This files contains the OS specific stuff for USB Device controller 
**                  (UDC) driver implementation.
**
**  LAST MODIFIED: $Modtime: 4/19/04 8:24a $
**
******************************************************************************/

/*
*******************************************************************************
*   HEADER FILES
*******************************************************************************
*/                                                                      

#include "xllp_defs.h"
#include "xllp_udc.h"
#include "xllp_udc_os_depend.h"

// UDC Endpoint Configuration table
const XLLP_UDC_EP_CONFIG_TABLE_T defaultUdcEndpointConfigTable[XLLP_UDC_MAX_EP_NUM] =
{
//  UDC     CN   Int   Alt. USB         EP      EP    Max.          Double  EP      Config.
//  EP      Num. Num.  Set. EP          Type    Dir   packet        Buff.   Enbl.   Register
//                                                    size          Enbl.           Value
ENDPOINT_0, 0,   0,    0,   0,          CNTRL,  0,    MPS_CNTRL_16, DB_EN,  EP_EN,  0,
ENDPOINT_A, 1,   0,    0,   USB_EP_1,   BULK,   IN,   MPS_BULK_64,  DB_EN,  EP_EN,  0,
ENDPOINT_B, 1,   0,    0,   USB_EP_2,   BULK,   OUT,  MPS_BULK_64,  DB_EN,  EP_EN,  0,
ENDPOINT_C, 2,   0,    0,   USB_EP_3,   ISO,    IN,   MPS_ISO_256,  DB_EN,  EP_EN,  0,
ENDPOINT_D, 2,   0,    0,   USB_EP_4,   ISO,    OUT,  MPS_ISO_256,  DB_EN,  EP_EN,  0,
ENDPOINT_E, 3,   0,    0,   USB_EP_5,   INTERPT,IN,   MPS_INT_8,    DB_EN,  EP_EN,  0,
ENDPOINT_F, 3,   0,    0,   USB_EP_6,   INTERPT,OUT,  MPS_INT_8,    DB_EN,  EP_EN,  0,
ENDPOINT_G, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_H, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_I, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_J, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_K, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_L, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_M, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_N, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_P, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_Q, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_R, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_S, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_T, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_U, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_V, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_W, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0,
ENDPOINT_X, 0,   0,    0,   0,          0,      0,    0,            0,      0,      0
};


// The USB Function Device Descriptor
const XLLP_INT8_T UsbDeviceDesc[] = {
  18,										// Descriptor length
  DEVICE_DESCRIPTOR,	                    // Device descriptor
  0x10,		            	                // USB 1.1 (LSB)
  1,			                            // USB 1.1 (MSB)
  0xff,			                            // No class
  0xff,			                            // No sub class
  0xff,			                            // No protoocol
  MPS_CNTRL_16,                             // Max packet size EP0
  0x86,			                            // Vendor ID (LSB) (Intel VID 32902)
  0x80,			                            // Vendor ID (MSB)
  0x01,			                            // Product ID
  0xf0,			                            // Product ID
  0,			                            // Device BCD (LSB)
  0,			                            // Device BCD (MSB)
  0,			                            // Index of Manufacturer string
  0,			                            // Index of Product string
  0,			                            // Index of Serial number string
  1,		                                // Number of configurations
};

// Note: 
//  UDC supports four device configurations.
//  Configurations 1,2, and 3 each support seven interfaces.
//  This configuration descriptor has three configurations:
//      Configuration 1: BULK IN (EP1), BULK OUT (EP2)
//      Configuration 2: ISO IN (EP3), ISO OUT (EP4)
//      Configuration 3: Interrupt IN (EP5), Interrupt OUT (EP6)
//  Each of the configuration has one interface.  

const XLLP_INT8_T UsbConfigDesc[] = {
// Configuration 1: Bulk IN, Bulk OUT
  9,			            // Descriptor length
  CONFIG_DESCRIPTOR,        // Configuration descriptor
  XLLP_UDC_CONFIG1_LENGTH,  // Total len (LSB)
  0,			            // Total len (MSB)
  1,			            // Number interfaces
  1,			            // Configuration value
  0,			            // Configuration string index
  0xC0,			            // Attributes
  25,			            // Max Power

  9,			            // Descriptor length 
  INTERFACE_DESCRIPTOR,     // Interface descriptor
  0,			            // Number of interface
  0,			            // Alternate setting
  2,			            // Number endpoints
  0xff,			            // Interface class 
  0xff,			            // Interface sub class
  0xff,			            // Interface protocol
  0,			            // Interface string descriptor

  7,			            // Descriptor length
  ENDPOINT_DESCRIPTOR,      // Endpoint descriptor
  0x81,			            // Endpoint address 1 (IN)
  BULK,		                // Bulk transfer 
  MPS_BULK_64,              // Max packet size LSB
  0,			            // Max packet size MSB
  0,			            // Polling interval

  7,			            // Descriptor length
  ENDPOINT_DESCRIPTOR,      // Endpoint descriptor
  0x02,			            // Endpoint address 2 (OUT)
  BULK,		                // Bulk transfer
  MPS_BULK_64,       	    // Max packet size LSB
  0,			            // Max packet size MSB
  0,			            // Polling interval
#ifdef block_config_2_3
// Configuration 2: ISO IN, ISO OUT, 
  9,			            // Descriptor length
  CONFIG_DESCRIPTOR,        // Configuration descriptor
  XLLP_UDC_CONFIG2_LENGTH,	// Total len (LSB)
  0,			            // Total len (MSB)
  1,			            // Number interfaces
  2,			            // Configuration value
  0,			            // Configuration string index
  0xC0,			            // Attributes
  125,			            // Max Power

  9,			            // Descriptor length 
  INTERFACE_DESCRIPTOR,     // Interface descriptor
  0,			            // Number of interface
  0,			            // Alternate setting
  2,			            // Number endpoints
  0xff,			            // Interface class 
  0xff,			            // Interface sub class
  0xff,			            // Interface protocol
  0,			            // Interface string descriptor

  7,			            // Descriptor length
  ENDPOINT_DESCRIPTOR,      // Endpoint descriptor
  0x83,			            // Endpoint address 3 (IN)
  ISO,          		    // ISO transfer 
  MPS_ISO_LSB_256,          // Max packet size LSB
  MPS_ISO_MSB_256,          // Max packet size MSB
  0,			            // Polling interval

  7,			            // Descriptor length
  ENDPOINT_DESCRIPTOR,      // Endpoint descriptor
  0x04,			            // Endpoint address 4 (OUT)
  ISO,          		    // ISO transfer
  MPS_ISO_LSB_256,          // Max packet size LSB
  MPS_ISO_MSB_256,          // Max packet size MSB
  0,			            // Polling interval

// Configuration 3: Interrupt IN, Interrupt OUT
  9,			            // Descriptor length
  CONFIG_DESCRIPTOR,        // Configuration descriptor
  XLLP_UDC_CONFIG3_LENGTH,  // Total len (LSB)
  0,			            // Total len (MSB)
  1,			            // Number interfaces
  3,			            // Configuration value
  0,			            // Configuration string index
  0xC0,			            // Attributes
  125,			            // Max Power

  9,			            // Descriptor length 
  INTERFACE_DESCRIPTOR,     // Interface descriptor
  0,			            // Number of interface
  0,			            // Alternate setting
  2,			            // Number endpoints
  0xff,			            // Interface class 
  0xff,			            // Interface sub class
  0xff,			            // Interface protocol
  0,			            // Interface string descriptor

  7,			            // Descriptor length
  ENDPOINT_DESCRIPTOR,      // Endpoint descriptor
  0x85,			            // Endpoint address 5 (IN)
  INTERPT,    		        // Interrupt transfer
  MPS_INT_8,                // Max packet size LSB
  0,			            // Max packet size MSB
  0,			            // Polling interval

  7,			            // Descriptor length
  ENDPOINT_DESCRIPTOR,      // Endpoint descriptor
  0x06,			            // Endpoint address 6 (OUT)
  INTERPT,    		        // Interrupt transfer
  MPS_INT_8,                // Max packet size LSB
  0,			            // Max packet size MSB
  0,			            // Polling interval
#endif
};

#ifdef temp
// Stubs for OS dependent functions
// This stubs would have to be filled by the user of the XLLP UDC driver
XLLP_STATUS_T XllpUdcRegisterFirstLevelInterrupt (P_XLLP_UDC_T pUdcHandle)
{
    return 0;
}

XLLP_STATUS_T XllpUdcEnableFirstLevelInterrupt (void)
{
    return 0;
}

XLLP_STATUS_T XllpUdcUnRegisterFirstLevelInterrupt(void)
{
    return 0;
}

XLLP_STATUS_T XllpUdcDisableFirstLevelInterrupt(void)
{
    return 0;
}

XLLP_STATUS_T XllpUdcProcessVendorRequest (P_XLLP_UDC_T pUdcHandle)
{
    return 0;
}

#endif
XLLP_BOOL_T XllpUdcGetStringDescriptor(XLLP_UINT16_T wValue, P_XLLP_UINT8_T *txDatP, P_XLLP_UINT32_T txDatLen)
{
    return XLLP_TRUE;
}

⌨️ 快捷键说明

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