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

📄 usbd_otghs.lst

📁 本程序是以前程序的升级
💻 LST
📖 第 1 页 / 共 5 页
字号:
###############################################################################
#                                                                             #
#                                                       28/Apr/2009  11:12:10 #
# IAR ARM ANSI C/C++ Compiler V5.11.0.20622/W32 EVALUATION                    #
# Copyright 1999-2007 IAR Systems. All rights reserved.                       #
#                                                                             #
#    Cpu mode     =  arm                                                      #
#    Endian       =  little                                                   #
#    Source file  =  E:\workplace\bootloaderOK\at91lib\usb\device\core\USBD_O #
#                    TGHS.c                                                   #
#    Command line =  E:\workplace\bootloaderOK\at91lib\usb\device\core\USBD_O #
#                    TGHS.c -D at91sam7se512 -D flash -D TRACE_LEVEL=4 -lC    #
#                    E:\workplace\bootloaderOK\at91sam7se-ek\basic-dataflash- #
#                    project\ewp\at91sam7se512_flash\List\ --remarks          #
#                    --diag_suppress Pe826,Pe1375 -o                          #
#                    E:\workplace\bootloaderOK\at91sam7se-ek\basic-dataflash- #
#                    project\ewp\at91sam7se512_flash\Obj\ --no_cse            #
#                    --no_unroll --no_inline --no_code_motion --no_tbaa       #
#                    --no_clustering --no_scheduling --debug --endian little  #
#                    --cpu ARM7TDMI -e --fpu None --dlib_config "D:\Program   #
#                    Files\arm\ARM\INC\DLib_Config_Full.h" -I                 #
#                    E:\workplace\bootloaderOK\at91sam7se-ek\basic-dataflash- #
#                    project\ewp\..\..\..\at91lib/peripherals\ -I             #
#                    E:\workplace\bootloaderOK\at91sam7se-ek\basic-dataflash- #
#                    project\ewp\..\..\..\at91lib\ -I                         #
#                    E:\workplace\bootloaderOK\at91sam7se-ek\basic-dataflash- #
#                    project\ewp\..\..\..\at91lib/memories\ -I                #
#                    E:\workplace\bootloaderOK\at91sam7se-ek\basic-dataflash- #
#                    project\ewp\..\..\..\at91lib/boards/at91sam7se-ek\ -I    #
#                    "D:\Program Files\arm\ARM\INC\" --interwork --cpu_mode   #
#                    arm -Oh                                                  #
#    List file    =  E:\workplace\bootloaderOK\at91sam7se-ek\basic-dataflash- #
#                    project\ewp\at91sam7se512_flash\List\USBD_OTGHS.lst      #
#    Object file  =  E:\workplace\bootloaderOK\at91sam7se-ek\basic-dataflash- #
#                    project\ewp\at91sam7se512_flash\Obj\USBD_OTGHS.o         #
#                                                                             #
#                                                                             #
###############################################################################

E:\workplace\bootloaderOK\at91lib\usb\device\core\USBD_OTGHS.c
      1          /* ----------------------------------------------------------------------------
      2           *         ATMEL Microcontroller Software Support 
      3           * ----------------------------------------------------------------------------
      4           * Copyright (c) 2008, Atmel Corporation
      5           *
      6           * All rights reserved.
      7           *
      8           * Redistribution and use in source and binary forms, with or without
      9           * modification, are permitted provided that the following conditions are met:
     10           *
     11           * - Redistributions of source code must retain the above copyright notice,
     12           * this list of conditions and the disclaimer below.
     13           *
     14           * Atmel's name may not be used to endorse or promote products derived from
     15           * this software without specific prior written permission.
     16           *
     17           * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
     18           * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     19           * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
     20           * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
     21           * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     22           * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
     23           * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     24           * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     25           * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     26           * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27           * ----------------------------------------------------------------------------
     28           */
     29          
     30          /*!
     31              Functions for OTGHS peripheral usage.
     32          */
     33           
     34          //------------------------------------------------------------------------------
     35          //      Headers
     36          //------------------------------------------------------------------------------
     37          
     38          #include <board.h>
     39          
     40          #ifdef CHIP_OTGHS
     41          
     42          #include "common.h"
     43          #include "trace.h"
     44          #include "usb.h"
     45          
     46          //------------------------------------------------------------------------------
     47          //         Definitions
     48          //------------------------------------------------------------------------------
     49          
     50          #define NUM_IT_MAX       (AT91C_BASE_OTGHS->OTGHS_IPFEATURES & AT91C_OTGHS_EPT_NBR_MAX)
     51          #define NUM_IT_MAX_DMA   ((AT91C_BASE_OTGHS->OTGHS_IPFEATURES & AT91C_OTGHS_DMA_CHANNEL_NBR)>>4)
     52          
     53          #define SHIFT_DMA         24
     54          #define SHIFT_INTERUPT    12
     55          
     56          #define DMA
     57          
     58          //------------------------------------------------------------------------------
     59          //      Structures
     60          //------------------------------------------------------------------------------
     61          
     62          // \brief  Endpoint states
     63          typedef enum {
     64          
     65              endpointStateDisabled,
     66              endpointStateIdle,
     67              endpointStateWrite,
     68              endpointStateRead,
     69              endpointStateHalted
     70          
     71          } EndpointState_t;
     72          
     73          //------------------------------------------------------------------------------
     74          //      Macros
     75          //------------------------------------------------------------------------------
     76          
     77          //------------------------------------------------------------------------------
     78          //      Internal Functions
     79          //------------------------------------------------------------------------------
     80          //------------------------------------------------------------------------------
     81          // \brief  Returns a pointer to the OTGHS controller interface used by an USB
     82          //         driver
     83          //
     84          //         The pointer is cast to the correct type (AT91PS_OTGHS).
     85          // \param  pUsb Pointer to a S_usb instance
     86          // \return Pointer to the USB controller interface
     87          // \see    S_usb
     88          //------------------------------------------------------------------------------
     89          static AT91PS_OTGHS OTGHS_GetDriverInterface(const S_usb *pUsb)
     90          {
     91              return (AT91PS_OTGHS) pUsb->pDriver->pInterface;
     92          }
     93          
     94          //------------------------------------------------------------------------------
     95          // \fn      OTGHS_GetInterfaceEPT
     96          // \brief   Returns OTGHS endpoint FIFO interface from S_usb structure
     97          //------------------------------------------------------------------------------
     98          static AT91PS_OTGHS_EPTFIFO OTGHS_GetInterfaceEPT(const S_usb *pUsb) 
     99          {
    100              return (AT91PS_OTGHS_EPTFIFO) pUsb->pDriver->pEndpointFIFO;
    101          }
    102          
    103          
    104          //------------------------------------------------------------------------------
    105          // \brief  Enables the peripheral clock of the USB controller associated with
    106          //         the specified USB driver
    107          // \param  pUsb Pointer to a S_usb instance
    108          // \see    S_usb
    109          //------------------------------------------------------------------------------
    110          static void OTGHS_EnableMCK(const S_usb *pUsb)
    111          {
    112          
    113          }
    114          
    115          //------------------------------------------------------------------------------
    116          // \brief  Disables the peripheral clock of the USB controller associated with
    117          //         the specified USB driver
    118          // \param  pUsb Pointer to a S_usb instance
    119          // \see    S_usb
    120          //------------------------------------------------------------------------------
    121          static void OTGHS_DisableMCK(const S_usb *pUsb)
    122          {
    123          
    124          }
    125          
    126          //------------------------------------------------------------------------------
    127          // \brief  Enables the 48MHz clock of the USB controller associated with
    128          //         the specified USB driver
    129          // \param  pUsb Pointer to a S_usb instance
    130          // \see    S_usb
    131          //------------------------------------------------------------------------------
    132          static void OTGHS_EnableOTGHSCK(const S_usb *pUsb)
    133          {
    134          
    135          }
    136          
    137          //------------------------------------------------------------------------------
    138          // \brief  Disables the 48MHz clock of the USB controller associated with
    139          //         the specified USB driver
    140          // \param  pUsb Pointer to a S_usb instance
    141          // \see    S_usb
    142          //------------------------------------------------------------------------------
    143          static void OTGHS_DisableOTGHSCK(const S_usb *pUsb)
    144          {
    145          
    146          }
    147          
    148          //------------------------------------------------------------------------------
    149          // \brief  Enables the transceiver of the USB controller associated with
    150          //         the specified USB driver
    151          // \param  pUsb Pointer to a S_usb instance
    152          // \see    S_usb
    153          //------------------------------------------------------------------------------
    154          static void OTGHS_EnableTransceiver(const S_usb *pUsb)
    155          {
    156              SET(OTGHS_GetDriverInterface(pUsb)->OTGHS_CTRL, AT91C_OTGHS_OTGPADE);
    157          }
    158          
    159          //------------------------------------------------------------------------------
    160          // \brief  Disables the transceiver of the USB controller associated with
    161          //         the specified USB driver
    162          // \param  pUsb Pointer to a S_usb instance
    163          // \see    S_usb
    164          //------------------------------------------------------------------------------
    165          static void OTGHS_DisableTransceiver(const S_usb *pUsb)
    166          {
    167              CLEAR(OTGHS_GetDriverInterface(pUsb)->OTGHS_CTRL, AT91C_OTGHS_OTGPADE);
    168          }
    169          
    170          //------------------------------------------------------------------------------
    171          // \brief  Invokes the callback associated with a finished transfer on an
    172          //         endpoint
    173          // \param  pEndpoint Pointer to a S_usb_endpoint instance
    174          // \param  bStatus   Status code returned by the transfer operation
    175          // \see    Status codes
    176          // \see    S_usb_endpoint
    177          //------------------------------------------------------------------------------
    178          static void OTGHS_EndOfTransfer(S_usb_endpoint *pEndpoint,
    179                                                   char bStatus)
    180          {
    181              if ((pEndpoint->dState == endpointStateWrite)
    182                  || (pEndpoint->dState == endpointStateRead)) {
    183          
    184                  TRACE_DEBUG_WP("E");
    185          
    186                  // Endpoint returns in Idle state
    187                  pEndpoint->dState = endpointStateIdle;
    188          
    189                  // Invoke callback is present
    190                  if (pEndpoint->fCallback != 0) {
    191          
    192                      pEndpoint->fCallback((unsigned int) pEndpoint->pArgument,
    193                                           (unsigned int) bStatus,
    194                                           pEndpoint->dBytesTransferred,
    195                                           pEndpoint->dBytesRemaining
    196                                           + pEndpoint->dBytesBuffered);
    197                  }
    198              }

⌨️ 快捷键说明

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