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

📄 usbd_udp.lst

📁 ATmel的AT91sam7SE芯片 USB固件开发源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
###############################################################################
#                                                                             #
#                                                       29/Jul/2008  16:07:19 #
# 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:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91lib\usb\device\core\USBD_UD #
#                    P.c                                                      #
#    Command line =  D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91lib\usb\device\core\USBD_UD #
#                    P.c -D at91sam7se512 -lC D:\rock\atarm\at91sam7se\softwa #
#                    re\usb-device-core-project-1.3-iar5-at91sam7se-ek\at91sa #
#                    m7se-ek\usb-device-core-project\ewp\at91sam7se512_sdram\ #
#                    List\ --remarks -o D:\rock\atarm\at91sam7se\software\usb #
#                    -device-core-project-1.3-iar5-at91sam7se-ek\at91sam7se-e #
#                    k\usb-device-core-project\ewp\at91sam7se512_sdram\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\IAR Systems\Embedded     #
#                    Workbench 5.0 Evaluation\ARM\INC\DLib_Config_Full.h" -I  #
#                    D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
#                    roject\ewp\..\..\..\at91lib\ -I                          #
#                    D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
#                    roject\ewp\..\..\..\at91lib\boards\at91sam7se-ek\ -I     #
#                    D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
#                    roject\ewp\..\..\..\at91lib\peripherals\ -I              #
#                    D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
#                    roject\ewp\..\..\..\at91lib\components\ -I               #
#                    D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
#                    roject\ewp\..\..\..\at91lib\usb\ -I "D:\Program          #
#                    Files\IAR Systems\Embedded Workbench 5.0                 #
#                    Evaluation\ARM\INC\" --interwork --cpu_mode arm -On      #
#    List file    =  D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
#                    roject\ewp\at91sam7se512_sdram\List\USBD_UDP.lst         #
#    Object file  =  D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
#                    t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
#                    roject\ewp\at91sam7se512_sdram\Obj\USBD_UDP.o            #
#                                                                             #
#                                                                             #
###############################################################################

D:\rock\atarm\at91sam7se\software\usb-device-core-project-1.3-iar5-at91sam7se-ek\at91lib\usb\device\core\USBD_UDP.c
      1          /* ----------------------------------------------------------------------------
      2           *         ATMEL Microcontroller Software Support  -  ROUSSET  -
      3           * ----------------------------------------------------------------------------
      4           * Copyright (c) 2006, 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 disclaiimer below.
     13           *
     14           * - Redistributions in binary form must reproduce the above copyright notice,
     15           * this list of conditions and the disclaimer below in the documentation and/or
     16           * other materials provided with the distribution.
     17           *
     18           * Atmel's name may not be used to endorse or promote products derived from
     19           * this software without specific prior written permission.
     20           *
     21           * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
     22           * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     23           * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
     24           * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
     25           * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     26           * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
     27           * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     28           * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     29           * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     30           * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31           * ----------------------------------------------------------------------------
     32           */
     33          
     34          /*
     35              Title: USBD implementation for a UDP controller
     36          
     37              About: Purpose
     38                  Implementation of USB device functions on a UDP controller.
     39          */
     40          
     41          //------------------------------------------------------------------------------
     42          //      Headers
     43          //------------------------------------------------------------------------------
     44          
     45          
     46          #include "USBD.h"
     47          #include "USBDCallbacks.h"
     48          #include <board.h>
     49          #include <pio/pio.h>
     50          #include <utility/trace.h>
     51          #include <utility/led.h>
     52          #include <usb/common/core/USBEndpointDescriptor.h>
     53          #include <usb/common/core/USBGenericRequest.h>
     54          
     55          #if defined(BOARD_USB_UDP)
     56          
     57          //------------------------------------------------------------------------------
     58          //         Definitions
     59          //------------------------------------------------------------------------------
     60          /*
     61              Constants: UDP register field values
     62                  UDP_RXDATA - Bit mask for both banks of the UDP_CSR register.
     63          */
     64          #define UDP_RXDATA              (AT91C_UDP_RX_DATA_BK0 | AT91C_UDP_RX_DATA_BK1)
     65          
     66          /*
     67              Constants: Endpoint states
     68                  UDP_ENDPOINT_DISABLED - Endpoint is disabled.
     69                  UDP_ENDPOINT_HALTED - Endpoint is halted (i.e. STALLs every request).
     70                  UDP_ENDPOINT_IDLE - Endpoint is idle (i.e. ready for transmission).
     71                  UDP_ENDPOINT_SENDING - Endpoint is sending data.
     72                  UDP_ENDPOINT_RECEIVING - Endpoint is receiving data.
     73          */
     74          #define UDP_ENDPOINT_DISABLED       0
     75          #define UDP_ENDPOINT_HALTED         1
     76          #define UDP_ENDPOINT_IDLE           2
     77          #define UDP_ENDPOINT_SENDING        3
     78          #define UDP_ENDPOINT_RECEIVING      4
     79          
     80          /*
     81              Macros: UDP_CSR register access
     82                  CLEAR_CSR - Clears the specified bit(s) in the UDP_CSR register.
     83                  SET_CSR - Sets the specified bit(s) in the UDP_CSR register.
     84          */
     85          //#define UDP_CLEAREPFLAGS(pUsb, bEndpoint, dFlags) {
     86          //    CLEAR(UDP_GetDriverInterface(pUsb)->UDP_CSR[bEndpoint], dFlags);
     87          //    while (!ISCLEARED(UDP_GetDriverInterface(pUsb)->UDP_CSR[bEndpoint], dFlags));
     88          //}
     89          #define CLEAR_CSR(endpoint, bits)   AT91C_BASE_UDP->UDP_CSR[endpoint] &= ~bits;
     90          //#define UDP_SETEPFLAGS(pUsb, bEndpoint, dFlags) {
     91          //    while (ISCLEARED(UDP_GetDriverInterface(pUsb)->UDP_CSR[bEndpoint], dFlags))
     92          //        SET(UDP_GetDriverInterface(pUsb)->UDP_CSR[bEndpoint], dFlags);
     93          //}
     94          #define SET_CSR(endpoint, bits)     AT91C_BASE_UDP->UDP_CSR[endpoint] |= bits;
     95          
     96          //------------------------------------------------------------------------------
     97          //      Types
     98          //------------------------------------------------------------------------------
     99          
    100          /*
    101              Type: UDP transfer
    102                  Describes an ongoing transfer on a UDP endpoint.
    103          
    104              Variables:
    105                  data - Pointer to a data buffer used for emission/reception.
    106                  buffered - Number of bytes which have been written into the UDP internal
    107                             FIFO buffers.
    108                  transferred - Number of bytes which have been sent/received.
    109                  remaining - Number of bytes which have not been buffered/transferred yet.
    110                  callback - Optional callback to invoke when the transfer completes.
    111                  argument - Optional argument to the callback function.
    112          */
    113          typedef struct {
    114          
    115              char *data;
    116              int buffered;
    117              int transferred;
    118              int remaining;
    119              TransferCallback callback;
    120              void *argument;
    121          
    122          } Transfer;
    123          
    124          /*
    125              Type: UDP endpoint
    126                  Describes the state of an endpoint of the UDP controller.
    127          
    128              Variables:
    129                  state - Current endpoint state.
    130                  bank - Current reception bank (0 or 1).
    131                  size - Maximum packet size for the endpoint.
    132                  transfer - Describes an ongoing transfer (if current state is either
    133                             <UDP_ENDPOINT_SENDING> or <UDP_ENDPOINT_RECEIVING>).
    134          */
    135          typedef struct {
    136          
    137              unsigned char state;
    138              unsigned char bank;
    139              unsigned short size;
    140              Transfer transfer;
    141          
    142          } Endpoint;
    143          
    144          //------------------------------------------------------------------------------
    145          //         Internal variables
    146          //------------------------------------------------------------------------------
    147          
    148          /*
    149              Variables: 
    150                  endpoints - Holds the internal state for each endpoint of the UDP.
    151                  deviceState - Device current state.
    152                  suspended - Indicates if device is currently suspended.
    153          */

   \                                 In section .bss, align 4
    154          static Endpoint endpoints[BOARD_USB_NUMENDPOINTS];
   \                     endpoints:
   \   00000000                      DS8 224

   \                                 In section .bss, align 1
    155          static unsigned char deviceState;
   \                     deviceState:
   \   00000000                      DS8 1

   \                                 In section .bss, align 1
    156          static unsigned char previousDeviceState;
   \                     previousDeviceState:
   \   00000000                      DS8 1
    157          
    158          //------------------------------------------------------------------------------
    159          //      Internal Functions
    160          //------------------------------------------------------------------------------
    161          /*
    162              Functions: Peripheral clock
    163                  EnablePeripheralClock - Enables the clock of the UDP peripheral.
    164                  DisablePeripheralClock - Disables the UDP peripheral clock.
    165          */

   \                                 In section .text, align 4, keep-with-next
    166          static inline void UDP_EnablePeripheralClock()
    167          {
    168              AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_UDP;
   \                     UDP_EnablePeripheralClock:
   \   00000000   EF00E0E3           MVN      R0,#+239

⌨️ 快捷键说明

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