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

📄 usbd_udp.lst

📁 本代bootloader通过usb下载代码首先存放在sdram中
💻 LST
📖 第 1 页 / 共 5 页
字号:
###############################################################################
#                                                                             #
#                                                       24/Apr/2009  16:18:17 #
# 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  =  D:\basic-dataflash-project-at91sam7se-ek\at91lib\usb\dev #
#                    ice\core\USBD_UDP.c                                      #
#    Command line =  D:\basic-dataflash-project-at91sam7se-ek\at91lib\usb\dev #
#                    ice\core\USBD_UDP.c -D at91sam7se512 -D sram -D          #
#                    TRACE_LEVEL=4 -lC D:\basic-dataflash-project-at91sam7se- #
#                    ek\at91sam7se-ek\basic-dataflash-project\ewp\at91sam7se5 #
#                    12_sram\List\ --remarks --diag_suppress Pe826,Pe1375 -o  #
#                    D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
#                    asic-dataflash-project\ewp\at91sam7se512_sram\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 D:\basic-dataflash-project-at91sam7se-ek\at91 #
#                    sam7se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/p #
#                    eripherals\ -I D:\basic-dataflash-project-at91sam7se-ek\ #
#                    at91sam7se-ek\basic-dataflash-project\ewp\..\..\..\at91l #
#                    ib\ -I D:\basic-dataflash-project-at91sam7se-ek\at91sam7 #
#                    se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/memor #
#                    ies\ -I D:\basic-dataflash-project-at91sam7se-ek\at91sam #
#                    7se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/boar #
#                    ds/at91sam7se-ek\ -I "D:\Program Files\arm\ARM\INC\"     #
#                    --interwork --cpu_mode arm -Oh                           #
#    List file    =  D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
#                    asic-dataflash-project\ewp\at91sam7se512_sram\List\USBD_ #
#                    UDP.lst                                                  #
#    Object file  =  D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
#                    asic-dataflash-project\ewp\at91sam7se512_sram\Obj\USBD_U #
#                    DP.o                                                     #
#                                                                             #
#                                                                             #
###############################################################################

D:\basic-dataflash-project-at91sam7se-ek\at91lib\usb\device\core\USBD_UDP.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           \unit
     32          
     33           !!!Purpose
     34          
     35              Implementation of USB device functions on a UDP controller.
     36          
     37              See "USBD API Methods".
     38          */
     39          
     40          //------------------------------------------------------------------------------
     41          //      Headers
     42          //------------------------------------------------------------------------------
     43          
     44          #include "USBD.h"
     45          #include "USBDCallbacks.h"
     46          #include <board.h>
     47          #include <pio/pio.h>
     48          #include <utility/trace.h>
     49          #include <utility/led.h>
     50          #include <usb/common/core/USBEndpointDescriptor.h>
     51          #include <usb/common/core/USBGenericRequest.h>
     52          
     53          #if defined(BOARD_USB_UDP)
     54          
     55          //------------------------------------------------------------------------------
     56          //         Definitions
     57          //------------------------------------------------------------------------------
     58          
     59          //------------------------------------------------------------------------------
     60          /// \page "UDP register field values"
     61          ///
     62          /// This page lists the initialize values of UDP registers.
     63          ///
     64          /// !Values
     65          /// - UDP_RXDATA
     66          
     67          /// Bit mask for both banks of the UDP_CSR register.
     68          #define UDP_RXDATA              (AT91C_UDP_RX_DATA_BK0 | AT91C_UDP_RX_DATA_BK1)
     69          //------------------------------------------------------------------------------
     70          
     71          //------------------------------------------------------------------------------
     72          /// \page "Endpoint states"
     73          ///
     74          /// This page lists the endpoint states.
     75          ///
     76          /// !States
     77          //  - UDP_ENDPOINT_DISABLED
     78          //  - UDP_ENDPOINT_HALTED
     79          //  - UDP_ENDPOINT_IDLE
     80          //  - UDP_ENDPOINT_SENDING
     81          //  - UDP_ENDPOINT_RECEIVING
     82          
     83          /// Endpoint states: Endpoint is disabled
     84          #define UDP_ENDPOINT_DISABLED       0
     85          /// Endpoint states: Endpoint is halted (i.e. STALLs every request)
     86          #define UDP_ENDPOINT_HALTED         1
     87          /// Endpoint states: Endpoint is idle (i.e. ready for transmission)
     88          #define UDP_ENDPOINT_IDLE           2
     89          /// Endpoint states: Endpoint is sending data
     90          #define UDP_ENDPOINT_SENDING        3
     91          /// Endpoint states: Endpoint is receiving data
     92          #define UDP_ENDPOINT_RECEIVING      4
     93          //------------------------------------------------------------------------------
     94          
     95          //------------------------------------------------------------------------------
     96          /// \page "UDP_CSR register access"
     97          ///
     98          /// This page lists the macroes to access UDP CSR register.
     99          ///
    100          /// !Macros
    101          /// - CLEAR_CSR
    102          /// - SET_CSR
    103          
    104          /// Bitmap for all status bits in CSR.
    105          #define REG_NO_EFFECT_1_ALL      AT91C_UDP_RX_DATA_BK0 | AT91C_UDP_RX_DATA_BK1 \
    106                                          |AT91C_UDP_STALLSENT   | AT91C_UDP_RXSETUP \
    107                                          |AT91C_UDP_TXCOMP
    108          
    109          /// Clears the specified bit(s) in the UDP_CSR register.
    110          /// \param endpoint The endpoint number of the CSR to process.
    111          /// \param flags The bitmap to set to 1.
    112          #define SET_CSR(endpoint, flags) \
    113              { \
    114                  volatile unsigned int reg; \
    115                  reg = AT91C_BASE_UDP->UDP_CSR[endpoint] ; \
    116                  reg |= REG_NO_EFFECT_1_ALL; \
    117                  reg |= (flags); \
    118                  AT91C_BASE_UDP->UDP_CSR[endpoint] = reg; \
    119                  while ( (AT91C_BASE_UDP->UDP_CSR[endpoint] & (flags)) != (flags)); \
    120              }
    121          
    122          /// Sets the specified bit(s) in the UDP_CSR register.
    123          /// \param endpoint The endpoint number of the CSR to process.
    124          /// \param flags The bitmap to clear to 0.
    125          #define CLEAR_CSR(endpoint, flags) \
    126              { \
    127                  volatile unsigned int reg; \
    128                  reg = AT91C_BASE_UDP->UDP_CSR[endpoint]; \
    129                  reg |= REG_NO_EFFECT_1_ALL; \
    130                  reg &= ~(flags); \
    131                  AT91C_BASE_UDP->UDP_CSR[endpoint] = reg; \
    132                  while ( (AT91C_BASE_UDP->UDP_CSR[endpoint] & (flags)) == (flags)); \
    133              }
    134          //------------------------------------------------------------------------------
    135          
    136          //------------------------------------------------------------------------------
    137          //      Types
    138          //------------------------------------------------------------------------------
    139          
    140          /// Describes an ongoing transfer on a UDP endpoint.
    141          typedef struct {
    142          
    143              /// Pointer to a data buffer used for emission/reception.
    144              char             *pData;
    145              /// Number of bytes which have been written into the UDP internal FIFO
    146              /// buffers.
    147              volatile int     buffered;
    148              /// Number of bytes which have been sent/received.
    149              volatile int     transferred;
    150              /// Number of bytes which have not been buffered/transferred yet.
    151              volatile int     remaining;
    152              /// Optional callback to invoke when the transfer completes.
    153              volatile TransferCallback fCallback;
    154              /// Optional argument to the callback function.
    155              void             *pArgument;
    156          } Transfer;
    157          
    158          //------------------------------------------------------------------------------
    159          /// Describes the state of an endpoint of the UDP controller.
    160          //------------------------------------------------------------------------------
    161          typedef struct {
    162          
    163              /// Current endpoint state.
    164              volatile unsigned char  state;
    165              /// Current reception bank (0 or 1).
    166              volatile unsigned char  bank;
    167              /// Maximum packet size for the endpoint.
    168              volatile unsigned short size;
    169              /// Describes an ongoing transfer (if current state is either
    170              ///  <UDP_ENDPOINT_SENDING> or <UDP_ENDPOINT_RECEIVING>)
    171              Transfer       transfer;
    172          } Endpoint;
    173          
    174          //------------------------------------------------------------------------------
    175          //         Internal variables
    176          //------------------------------------------------------------------------------
    177          
    178          /// Holds the internal state for each endpoint of the UDP.

   \                                 In section .bss, align 4
    179          static Endpoint endpoints[BOARD_USB_NUMENDPOINTS];
   \                     endpoints:
   \   00000000                      DS8 224
    180          
    181          /// Device current state.

   \                                 In section .bss, align 1
    182          static unsigned char deviceState;
   \                     deviceState:

⌨️ 快捷键说明

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