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

📄 com_baud.lst

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 LST
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/EC++ Compiler V3.10A/W32              05/Nov/2001  14:53:15 #
# Copyright 1999-2001 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode     =  arm                                                     #
#    Code model   =  small                                                   #
#    Endian       =  little                                                  #
#    Source file  =  C:\At91\software\projects\bench\Source\com_baud.c       #
#    Command line =  -I C:\Compil\EW23\ARM\INC\ -I ..\..\..\ -lC             #
#                    C:\At91\software\projects\bench\IAR\ARM_external\List\  #
#                    -lA C:\At91\software\projects\bench\IAR\ARM_external\Li #
#                    st\ -o C:\At91\software\projects\bench\IAR\ARM_external #
#                    \Obj\ -e -s9 --debug --cpu_mode arm --code_model small  #
#                    --endian little --cpu=arm7tdmi                          #
#                    C:\At91\software\projects\bench\Source\com_baud.c       #
#    List file    =  C:\At91\software\projects\bench\IAR\ARM_external\List\c #
#                    om_baud.lst                                             #
#    Object file  =  C:\At91\software\projects\bench\IAR\ARM_external\Obj\co #
#                    m_baud.r79                                              #
#                                                                            #
#                                                                            #
##############################################################################

C:\At91\software\projects\bench\Source\com_baud.c
      1          //*----------------------------------------------------------------------------
      2          //*      ATMEL Microcontroller Software Support  -  ROUSSET  -
      3          //*----------------------------------------------------------------------------
      4          //* The software is delivered "AS IS" without warranty or condition of any
      5          //* kind, either express, implied or statutory. This includes without
      6          //* limitation any warranty or condition with respect to merchantability or
      7          //* fitness for any particular purpose, or against the infringements of
      8          //* intellectual property rights of others.
      9          //*----------------------------------------------------------------------------
     10          //* File Name           : com_baud.c
     11          //* Object              : Baud rate compute com port terminal
     12          //*
     13          //* 1.0 25/08/00 JPP    : Creation
     14          //* 1.0 03/09/01 JPP    : Change com directory
     15          //*----------------------------------------------------------------------------
     16          
     17          #include "com.h"
     18          
     19          //*----------------------------------------------------------------------------
     20          //* Function Name       : at91_baud_com
     21          //* Object              : Compute the baud rate
     22          //* Input Parameters    : <mcki> external mcki if use in usart US_CLKS_MCK8 you
     23          //*                              must be divided mcki by 8
     24          //*                       <baud> use standart baud rate 4800,9600,19200,...
     25          //* Output Parameters   : Usart CD baud value
     26          //*----------------------------------------------------------------------------

   \                                 In segment NEARFUNC_A, align 4
   \   00000000                         CODE32   
     27          u_short at91_baud_com( u_int mcki, u_int baud)
     28          //* Begin
     29          {
   \                     at91_baud_com:
   \   00000000   10402DE9              STMDB    SP!,{R4,LR}        ;; Push
     30              u_short cd;
     31              u_int   user_baud;
     32          
     33              //* baud rate calculation
     34              user_baud = ((mcki*10)/(baud*16));
   \   00000004   0A30A0E3              MOV      R3,#+0xA
   \   00000008   900302E0              MUL      R2,R0,R3
   \   0000000C   0200A0E1              MOV      R0,R2
   \   00000010   0112A0E1              MOV      R1,R1, LSL #+4
   \   00000014   ........              BL       ??divu32_a
   \   00000018   0120A0E1              MOV      R2,R1
     35              //*
     36              cd  = user_baud/10;
   \   0000001C   0200A0E1              MOV      R0,R2
   \   00000020   0310A0E1              MOV      R1,R3
   \   00000024   ........              BL       ??divu32_a
   \   00000028   0108A0E1              MOV      R0,R1, LSL #+16
   \   0000002C   2008A0E1              MOV      R0,R0, LSR #+16
     37              //* compute the error
     38              user_baud = (user_baud - (cd *10));
     39              //* aproximation
     40              if (user_baud >= 5) cd++;
   \   00000030   900304E0              MUL      R4,R0,R3
   \   00000034   041042E0              SUB      R1,R2,R4
   \   00000038   050051E3              CMP      R1,#+0x5
   \   0000003C   01008022              ADDCS    R0,R0,#+0x1
     41              // return the CD value for the Usart
     42              return cd;
   \   00000040   0008A0E1              MOV      R0,R0, LSL #+16
   \   00000044   2008A0E1              MOV      R0,R0, LSR #+16
   \   00000048   1080BDE8              LDMIA    SP!,{R4,PC}        ;; return
     43          }
     44          //* End
     45          //*----------------------------------------------------------------------------
     46          //* Function Name       : at91_error_baud_com
     47          //* Object              : Compute the baud rate
     48          //* Input Parameters    : <mcki> external mcki if use in usart US_CLKS_MCK8 you
     49          //*                              must be divided mcki by 8
     50          //*                       <baud> use standart baud rate 4800,9600,19200,...
     51          //* Output Parameters   : baud error rate in % (sup average)
     52          //*----------------------------------------------------------------------------

   \                                 In segment NEARFUNC_A, align 4
   \   00000000                         CODE32   
     53          u_short at91_error_baud_com( u_int mcki, u_int baud)
     54          //* Begin
     55          {
   \                     at91_error_baud_com:
   \   00000000   70402DE9              STMDB    SP!,{R4-R6,LR}     ;; Push
   \   00000004   0030A0E1              MOV      R3,R0
   \   00000008   0120A0E1              MOV      R2,R1
     56              u_short cd;
     57              u_int usart_baud;
     58              //* Calculate the User cd
     59              cd = at91_baud_com(mcki, baud);
   \   0000000C   0A10A0E3              MOV      R1,#+0xA
   \   00000010   910000E0              MUL      R0,R1,R0
   \   00000014   0212A0E1              MOV      R1,R2, LSL #+4
   \   00000018   ........              BL       ??divu32_a
   \   0000001C   0140A0E1              MOV      R4,R1
   \   00000020   0400A0E1              MOV      R0,R4
   \   00000024   0A10A0E3              MOV      R1,#+0xA
   \   00000028   ........              BL       ??divu32_a
   \   0000002C   0118A0E1              MOV      R1,R1, LSL #+16
   \   00000030   2118A0E1              MOV      R1,R1, LSR #+16
   \   00000034   0A50A0E3              MOV      R5,#+0xA
   \   00000038   910506E0              MUL      R6,R1,R5
   \   0000003C   060044E0              SUB      R0,R4,R6
   \   00000040   050050E3              CMP      R0,#+0x5
   \   00000044   01108122              ADDCS    R1,R1,#+0x1
     60          
     61              //* compute the real baud rate
     62              usart_baud = (mcki/(cd*16));
   \   00000048   0300A0E1              MOV      R0,R3
   \   0000004C   0118A0E1              MOV      R1,R1, LSL #+16
   \   00000050   2118A0E1              MOV      R1,R1, LSR #+16
   \   00000054   0112A0E1              MOV      R1,R1, LSL #+4
   \   00000058   ........              BL       ??divu32_a
     63          
     64              //* compute error
     65              if (usart_baud < (baud))
   \   0000005C   020051E1              CMP      R1,R2
   \   00000060   6430A0E3              MOV      R3,#+0x64
     66               cd =  100 - ((usart_baud*100)/baud);
   \   00000064   91030030              MULCC    R0,R1,R3
   \   00000068   0210A031              MOVCC    R1,R2
     67              else
     68               cd =  100- ((baud*100)/usart_baud) ;
   \   0000006C   92030020              MULCS    R0,R2,R3
   \   00000070   ........              BL       ??divu32_a
   \   00000074   0118A0E1              MOV      R1,R1, LSL #+16
   \   00000078   2118A0E1              MOV      R1,R1, LSR #+16
   \   0000007C   640061E2              RSB      R0,R1,#+0x64
     69          
     70              // return the error value for the Usart
     71              return  cd;
   \   00000080   0008A0E1              MOV      R0,R0, LSL #+16
   \   00000084   2008A0E1              MOV      R0,R0, LSR #+16
   \   00000088   7080BDE8              LDMIA    SP!,{R4-R6,PC}     ;; return
     72          }
     73          //* End

   Maximum stack usage in bytes:

     Function             CSTACK
     --------             ------
     at91_baud_com            8 
     at91_error_baud_com     16 

 
 216 bytes in segment NEARFUNC_A
 
 216 bytes of CODE memory

Errors: none
Warnings: none

⌨️ 快捷键说明

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