📄 bench.s79
字号:
NAME bench
RTMODEL "__code_model", "small"
RTMODEL "__cpu_mode", "arm"
RTMODEL "__data_model", "absolute"
RTMODEL "__endian", "little"
RTMODEL "__rt_version", "2"
RTMODEL "__thumb_aware", "enabled"
RSEG CSTACK:DATA:NOROOT(2)
RSEG HUGE_Z:HUGEDATA:SORT:NOROOT(0)
EXTERN at91_pio_open
FUNCTION at91_pio_open,0202H
EXTERN at91_pio_write
FUNCTION at91_pio_write,0202H
EXTERN at91_baud_com
FUNCTION at91_baud_com,0202H
EXTERN at91_open_com
FUNCTION at91_open_com,0202H
EXTERN at91_print
FUNCTION at91_print,0202H
EXTERN at91_print_frame
FUNCTION at91_print_frame,0202H
EXTERN at91_pio_read
FUNCTION at91_pio_read,0202H
EXTERN at91_tc_open_count
FUNCTION at91_tc_open_count,0202H
EXTERN at91_tc_start
FUNCTION at91_tc_start,0202H
EXTERN at91_tc_stop
FUNCTION at91_tc_stop,0202H
EXTERN sprintf
FUNCTION sprintf,010202H
EXTERN testloop
FUNCTION testloop,0202H
EXTERN USART0_DESC
EXTERN TCB_DESC
EXTERN PIO_DESC
PUBWEAK ?init?tab?HUGE_Z
PUBLIC COM
PUBLIC main
FUNCTION main,0a03H
LOCFRAME CSTACK, 28, STACK
PUBLIC message
PUBLIC result
PUBLIC result_out
; C:\At91\software\projects\bench\Source\bench.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 : bench.c
; 11 //* Object : bench
; 12 //*
; 13 //* 1.0 15/05/01 JPP : Creation
; 14 //*----------------------------------------------------------------------------
; 15
; 16 #include "parts/r40807/lib_r40807.h"
; 17 #include "targets/eb40/eb40.h"
; 18 #include "com.h"
; 19
; 20 #include <stdio.h>
; 21
; 22 extern void at91_tc_open_count( const TCBlockDesc *TC_pt );
; 23 extern void at91_tc_start( const TCBlockDesc *TC_pt );
; 24 extern u_int at91_tc_stop( const TCBlockDesc *TC_pt );
; 25 extern void testloop(int Number_Of_Runs) ;
; 26 extern void testloop1(void) ;
; 27
; 28 #define MCKI 32768000
; 29 #define BAUD_RATE 38400
; 30
RSEG HUGE_Z:HUGEDATA:SORT:NOROOT(0)
; 31 char message[512];
message:
DS8 512
RSEG HUGE_Z:HUGEDATA:SORT:NOROOT(2)
; 32 ComDesc COM;
COM:
DS8 8
RSEG HUGE_C:HUGECONST:SORT:NOROOT(0)
; 33 static const char atmel_header[]=
atmel_header:
DC8 0AH, 0DH, 20H, 20H, 20H, 20H, 2AH, 2AH
DC8 2AH, 20H, 41H, 54H, 4DH, 45H, 4CH, 20H
DC8 55H, 53H, 41H, 52H, 54H, 20H, 42H, 45H
DC8 4EH, 43H, 48H, 4DH, 41H, 52H, 4BH, 20H
DC8 2AH, 2AH, 2AH, 0AH, 0DH, 43H, 6FH, 70H
DC8 79H, 72H, 69H, 67H, 68H, 74H, 20H, 28H
DC8 43H, 29H, 20H, 32H, 30H, 30H, 31H, 20H
DC8 41H, 54H, 4DH, 45H, 4CH, 20H, 56H, 65H
DC8 72H, 73H, 69H, 6FH, 6EH, 20H, 31H, 2EH
DC8 30H, 0AH, 0DH, 0
RSEG HUGE_C:HUGECONST:SORT:NOROOT(0)
`?<Constant "** Mearsure **\\n\\r">`:
DC8 "** Mearsure **\012\015"
RSEG HUGE_C:HUGECONST:SORT:NOROOT(0)
`?<Constant "- Out test %d \\n\\r">`:
DC8 "- Out test %d \012\015"
RSEG HUGE_C:HUGECONST:SORT:NOROOT(0)
`?<Constant "- cmpt++ test total:%...">`:
DC8 "- cmpt++ test total:%d test:%d\012\015"
RSEG HUGE_C:HUGECONST:SORT:NOROOT(0)
`?<Constant "- testloop total %d ...">`:
DC8 "- testloop total %d testloop %d\012\015"
; 34 {
; 35 "\n\r *** ATMEL USART BENCHMARK ***\n\r"
; 36 "Copyright (C) 2001 ATMEL Version 1.0\n\r"
; 37 };
RSEG HUGE_Z:HUGEDATA:SORT:NOROOT(2)
; 38 u_int result_out,result ;
result_out:
DS8 4
RSEG HUGE_Z:HUGEDATA:SORT:NOROOT(2)
result:
DS8 4
; 39
; 40
; 41 //*----------------------------------------------------------------------------
; 42 //* Function Name : main
; 43 //* Object : Main function of the led blink
; 44 //* Input Parameters : none
; 45 //* Output Parameters : TRUE
; 46 //*----------------------------------------------------------------------------
RSEG NEARFUNC_A:CODE:NOROOT(2)
CFI Names cfiNames0
CFI StackFrame CFA SP HUGEDATA
CFI Resource R0:32, R1:32, R2:32, R3:32, R4:32, R5:32, R6:32, R7:32
CFI Resource R8:32, R9:32, R10:32, R11:32, R12:32, SP:32, LR:32
CFI VirtualResource RET:32
CFI EndNames cfiNames0
CFI Common cfiCommon0 Using cfiNames0
CFI CodeAlign 4
CFI DataAlign 4
CFI ReturnAddress RET CODE
CFI CFA SP+0
CFI R0 Undefined
CFI R1 Undefined
CFI R2 Undefined
CFI R3 Undefined
CFI R4 SameValue
CFI R5 SameValue
CFI R6 SameValue
CFI R7 SameValue
CFI R8 SameValue
CFI R9 SameValue
CFI R10 SameValue
CFI R11 SameValue
CFI R12 Undefined
CFI LR Undefined
CFI RET LR
CFI EndCommon cfiCommon0
CFI Block cfiBlock0 Using cfiCommon0
CFI Function main
CODE32
; 47 void main( void )
; 48 //* Begin
; 49 {
main:
STMDB SP!,{R4,LR} ;; Push
CFI RET Frame(CFA, -4)
CFI R4 Frame(CFA, -8)
CFI CFA SP+8
; 50 u_short cd_baud;
; 51 u_int result_out,result ;
; 52 u_int cmpt;
; 53 //* Init
; 54 //* define led at PIO output
; 55 at91_pio_open ( &PIO_DESC, LED_MASK, PIO_OUTPUT );
MOV R2,#+0x1
MOV R1,#+0x16
LDR R0,??main_0+36 ;; #PIO_DESC
BL at91_pio_open
; 56
; 57 //* Init LED state
; 58 at91_pio_write ( &PIO_DESC, LED_MASK, PIO_CLEAR_OUT );
MOV R2,#+0x1
MOV R1,#+0x16
LDR R0,??main_0+36 ;; #PIO_DESC
BL at91_pio_write
; 59
; 60 //* define switch at PIO input
; 61 at91_pio_open ( &PIO_DESC, SW_MASK, PIO_INPUT );
MOV R2,#+0x0
MOV R1,#+0x220
ADD R1,R1,#+0x1000
LDR R0,??main_0+36 ;; #PIO_DESC
BL at91_pio_open
; 62
; 63 //* Init timer
; 64
; 65 //* open terminal for console
; 66 COM.usart=&USART0_DESC;
LDR R0,??main_0 ;; #USART0_DESC
LDR R1,??main_0+32 ;; #COM
STR R0,[R1, #+0]
; 67 cd_baud = at91_baud_com(MCKI, BAUD_RATE);
MOV R1,#+0x9600
MOV R0,#+0x1F40000
BL at91_baud_com
MOV R2,R0
; 68 //* open com
; 69 at91_open_com(&COM,(COM_8_BIT|COM_PAR_NONE|COM_NBSTOP_1|COM_FLOW_CONTROL_NONE), cd_baud);
MOV R1,#+0x8C0
LDR R0,??main_0+32 ;; #COM
BL at91_open_com
; 70 at91_print(&COM,message);
LDR R1,??main_0+28 ;; #message
LDR R0,??main_0+32 ;; #COM
BL at91_print
; 71 at91_print_frame(&COM,(char *)atmel_header,sizeof(atmel_header));
MOV R2,#+0x4C
LDR R1,??main_0+4 ;; #atmel_header
LDR R0,??main_0+32 ;; #COM
BL at91_print_frame
; 72
; 73 for (;;)
; 74 {
; 75 //* check switch SW5 is push wait
; 76 if (( at91_pio_read ( &PIO_DESC) & SW5_MASK ) == SW5_MASK )
??main_1:
LDR R0,??main_0+36 ;; #PIO_DESC
BL at91_pio_read
MOV R0,R0, LSL #+16
MOV R0,R0, LSR #+16
AND R0,R0,#+0x200
CMP R0,#+0x200
BNE ??main_1
; 77 { // if switch
; 78 at91_print(&COM,"** Mearsure **\n\r");
LDR R1,??main_0+8 ;; #`?<Constant "** Mearsure **\\n\\r">`
LDR R0,??main_0+32 ;; #COM
BL at91_print
; 79 at91_pio_write ( &PIO_DESC, LED1, PIO_SET_OUT );
MOV R2,#+0x0
MOV R1,#+0x2
LDR R0,??main_0+36 ;; #PIO_DESC
BL at91_pio_write
; 80 // open timer &TCB0_DESC
; 81 at91_tc_open_count(&TCB_DESC);
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_open_count
; 82 //* Start timer
; 83 at91_tc_start(&TCB_DESC);
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_start
; 84
; 85 //* Stop timer
; 86 result_out= at91_tc_stop(&TCB_DESC );
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_stop
MOV R4,R0
; 87 sprintf(message,"- Out test %d \n\r",result_out);
STMDB SP!,{R4} ;; Push
CFI CFA SP+12
LDR R1,??main_0+12 ;; #`?<Constant "- Out test %d \\n\\r">`
LDR R0,??main_0+28 ;; #message
BL sprintf
; 88 at91_print(&COM,message);
LDR R1,??main_0+28 ;; #message
LDR R0,??main_0+32 ;; #COM
BL at91_print
; 89 // open timer &TCB0_DESC
; 90 at91_tc_open_count(&TCB_DESC);
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_open_count
; 91 //* Start timer
; 92 at91_tc_start(&TCB_DESC);
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_start
; 93 cmpt++;
; 94 result= at91_tc_stop(&TCB_DESC );
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_stop
; 95 sprintf(message,"- cmpt++ test total:%d test:%d\n\r",result,result-result_out);
SUB R1,R0,R4
STMDB SP!,{R0,R1} ;; Push
CFI CFA SP+20
LDR R1,??main_0+16 ;; #`?<Constant "- cmpt++ test total:%...">`
LDR R0,??main_0+28 ;; #message
BL sprintf
; 96 at91_print(&COM,message);
LDR R1,??main_0+28 ;; #message
LDR R0,??main_0+32 ;; #COM
BL at91_print
; 97
; 98 // open timer &TCB0_DESC
; 99 at91_tc_open_count(&TCB_DESC);
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_open_count
; 100 //* Start timer
; 101 at91_tc_start(&TCB_DESC);
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_start
; 102
; 103 // start test
; 104 testloop(10000);
MOV R0,#+0x710
ADD R0,R0,#+0x2000
BL testloop
; 105
; 106 result= at91_tc_stop(&TCB_DESC );
LDR R0,??main_0+20 ;; #TCB_DESC
BL at91_tc_stop
; 107 sprintf(message,"- testloop total %d testloop %d\n\r",result,result-result_out);
SUB R1,R0,R4
STMDB SP!,{R0,R1} ;; Push
CFI CFA SP+28
LDR R1,??main_0+24 ;; #`?<Constant "- testloop total %d ...">`
LDR R0,??main_0+28 ;; #message
BL sprintf
; 108 at91_print(&COM,message);
LDR R1,??main_0+28 ;; #message
LDR R0,??main_0+32 ;; #COM
BL at91_print
; 109
; 110 // send result
; 111 at91_pio_write ( &PIO_DESC, LED1, PIO_CLEAR_OUT );
MOV R2,#+0x1
MOV R1,#+0x2
LDR R0,??main_0+36 ;; #PIO_DESC
BL at91_pio_write
ADD SP,SP,#+0x14 ;; stack cleaning
CFI CFA SP+8
B ??main_1
DATA
??main_0:
DC32 USART0_DESC
DC32 atmel_header
DC32 `?<Constant "** Mearsure **\\n\\r">`
DC32 `?<Constant "- Out test %d \\n\\r">`
DC32 `?<Constant "- cmpt++ test total:%...">`
DC32 TCB_DESC
DC32 `?<Constant "- testloop total %d ...">`
DC32 message
DC32 COM
DC32 PIO_DESC
CFI EndBlock cfiBlock0
; 112 }
; 113 }
; 114
; 115 //* End
; 116 }
RSEG INITTAB:CODE:ROOT(2)
?init?tab?HUGE_Z:
DCD sfe(HUGE_Z) - sfb(HUGE_Z), sfb(HUGE_Z), sfb(HUGE_Z)
END
; 117
;
; 178 bytes in segment HUGE_C
; 528 bytes in segment HUGE_Z
; 12 bytes in segment INITTAB
; 424 bytes in segment NEARFUNC_A
;
; 424 bytes of CODE memory (+ 12 bytes shared)
; 178 bytes of HUGECONST memory
; 528 bytes of HUGEDATA memory
;
;Errors: none
;Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -