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

📄 usbmain.pp

📁 在CCS开发环境下的DSP 5509A的固件程序
💻 PP
📖 第 1 页 / 共 5 页
字号:
/*  03/05/01 $MH$ added XferBytCnt to keep track of actual number of data     */
/*  bytes moved in (out) to (from) the data buffer.  The size of the          */
/*  data buffer has to be (N+1) words.  Where N = (#bytes of data)/2, the     */
/*  the extra word at the beginning of the data buffer is used to store the   */
/*  actual number of bytes moved in (out).                                    */
/*                                                                            */
/******************************************************************************/

typedef struct 
{
   USB_EpNum        EpNum;        /* USB endpoint number                      */
   USB_XferType     XferType;     /* USB xfer type supported by the EP        */
   Uint16           MaxPktSiz;    /* Max pkt size supported by the EP         */
   Uint16           EventMask;    /* ORed value of USB_EVENTS, the USB        */
                                  /* event dispatcher will call the event     */
                                  /* ISR if event matches with EventMask      */
   USB_EVENT_ISR    Fxn;          /* Pointer to USB event ISR                 */
   Uint16           DataFlags;    /* ORed combination of USB_DATA_INOUT_FLAGS */
   Uint16           Status;       /* Reserved for future use                  */
   Uint16           EDReg_SAddr;  /* Endpoint desc reg block start addr       */
                                  /* 2 regs for EP0, 6 regs for the rest      */
   Uint16           DMA_SAddr;    /* DMA reg block start addr                 */
                                  /* used only for EP1 - EP7                  */
   Uint16           TotBytCnt;    /* Total number of bytes to xfer            */
   Uint16           BytInThisSeg; /* # of bytes in the active node of         */
                                  /* the linked list                          */
   Uint16           *XferBytCnt;  /* Pointer to store the number of bytes     */
                                  /* moved in (out) - stored in the first of  */
                                  /* the buffer                               */
   Uint16           *pBuffer;     /* Active data buffer pointer               */
   USB_DataStruct   *pNextBuffer; /* Pointer to the next node of the          */
                                  /* linked list                              */ 
   Uint16           EventFlag;    /* Flag to indicate the event cuased        */
                                  /* USB interrupt                            */
}  USB_EpObj,*USB_EpHandle;

/******************************************************************************/
/*                                                                            */
/*                         USB_NULL_EpHandle                                  */
/*                                                                            */
/*  NULL pointer for USB Enpoint Handle. During the endpoint initialization   */
/*  NULL endpoint handles are assigned to unused endpoints                    */
/*                                                                            */
/******************************************************************************/




/******************************************************************************/
/*                                                                            */
/*                           USB API Prototypes                               */
/*                                                                            */
/******************************************************************************/

/******************************************************************************/
/* Name     : USB_setAPIVectorAddress                                         */
/*                                                                            */
/* Catagory : Software Initialization                                         */
/*                                                                            */
/* Purpose  : Initialize API vector pointer                                   */
/*                                                                            */
/* Author   : MH                                                              */
/*                                                                            */
/* Based on :                                                                 */
/*                                                                            */
/*============================================================================*/
/* Arguments:      None                                                       */
/*                                                                            */
/*============================================================================*/
/* Return Value:   None                                                       */
/*                                                                            */
/*                                                                            */
/*============================================================================*/
/* Comments:                                                                  */
/*                                                                            */
/* The user application access to the USB API via a relocate-able call        */
/* table.                                                                     */
/*                                                                            */
/* This relocateable table allows user applications to call the API           */
/* routines out of ROM or out of RAM by relocating the API Vector             */
/* Table to RAM and replacing any desired functions with new ones             */
/* while still being able to use ROM functions.  The initial API              */
/* Vector Table contained in this file is the ROM version which will          */
/* be used as the default table until or if a user application moves          */
/* the table to another location in ROM or more likely RAM.                   */
/*                                                                            */
/* This scheme is specially implemented to replace the USB API in the         */
/* ROM with the updated ones.                                                 */
/*                                                                            */
/* USB buffer RAM locations 0x667E and 0x667F are reserved to point to        */
/* the API Vector Table.  These are 8 bit locations and hold the              */
/* two bytes of a 24 bit address, the lower byte is assumed to be 0           */
/* thus forcing the table to be allocated on 256 byte boundaries.             */
/*                                                                            */
/*============================================================================*/
/* History:                                                                   */
/*                                                                            */
/* Created:    16 Jan 2001                                                    */
/*                                                                            */
/******************************************************************************/
extern void USB_setAPIVectorAddress();

/******************************************************************************/
/* Name     : USB_initPLL                                                     */
/*                                                                            */
/* Catagory : Device Control                                                  */
/*                                                                            */
/* Purpose  : Initailize USB PLL to generate clock for the USB module         */
/*                                                                            */
/* Author   : MH                                                              */
/*                                                                            */
/* Based on : C55x PLL init routine                                           */
/*                                                                            */
/*============================================================================*/
/* Arguments:                                                                 */
/*                                                                            */
/* inclk      : Input clock (supplied at CLKIN pin) frequency ( in MHz)       */
/*                                                                            */
/* outclk     : Desired clock frequency (in MHz) for the USB moduel, the      */
/*              outclk must be 48 MHz for the proper operation of the USB     */
/*              module.                                                       */
/*                                                                            */
/* plldiv     : Input clock (supplied at CLKIN pin) devide down value, used   */
/*              for USB PLL enable as well as USB PLL bypass mode             */
/*                                                                            */
/*============================================================================*/
/* Return Value:   None                                                       */
/*                                                                            */
/*                                                                            */
/*============================================================================*/
/* Comments:                                                                  */
/*                                                                            */
/* pllmult = (outclk * (plldiv+1)) / inclk                                    */
/*                                                                            */
/* if pllmult > 1                                                             */
/*		outclk = (pllmult / (plldiv + 1)) * inclk                         */
/*                                                                            */
/* if pllmult < 1                                                             */
/*		outclk = (1 / (plldiv + 1)) * inclk                               */
/*                                                                            */
/*============================================================================*/
/* History:                                                                   */
/*                                                                            */
/* Created:    16 Jan 2001                                                    */
/*                                                                            */
/******************************************************************************/

extern void USB_initPLL(Uint16 inclk, Uint16 outclk, Uint16 plldiv);

/******************************************************************************/
/* Name     :  USB_connectDev                                                 */
/*                                                                            */
/* Catagory :  Device Control                                                 */
/*                                                                            */
/* Purpose  :  Connect the USB module to upstream port (D+ pullup enabled)    */
/*                                                                            */
/*                                                                            */
/* Author   :  MH                                                             */
/*                                                                            */
/* Based on :                                                                 */
/*                                                                            */
/*                                                                            */
/*============================================================================*/
/* Arguments:                                                                 */
/*                                                                            */
/* DevNum:    USB device number, enumerated data type of USB_DevNum.          */
/*            Only USB0 is active currently                                   */
/*                                                                            */
/*                                                                            */
/*                                                                            */
/*                                                                            */
/*                                                                            */
/*                                                                            */
/*============================================================================*/
/* Return Value:                                                              */
/*                                                                            */
/* None                                                                       */
/*                                                                            */
/*============================================================================*/
/* Comments:                                                                  */
/*                                                                            */
/*                                                                            */
/*                                                                            */
/*============================================================================*/
/* History:                                                                   */
/*                                                                            */
/* Created:    30 Mar 2001                                                    */
/*                                                                            */
/******************************************************************************/

extern void USB_connectDev(USB_DevNum DevNum);

/******************************************************************************/
/* Name     :  USB_disconnectDev                                              */
/*                                                                            */
/* Catagory :  Device Control                                                 */

⌨️ 快捷键说明

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