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

📄 level3.lst

📁 此程序为利用mage8 AVR 和EM4094实现读取TYPE B类型卡的C程序、读卡稳定、这个项目我们做了好久、非常不错的程序、很适合做这方面产品的朋友们参考
💻 LST
📖 第 1 页 / 共 4 页
字号:
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccWGbaaa.s 			page 1


   1               		.file	"level3.c"
   2               		.arch atmega8
   3               	__SREG__ = 0x3f
   4               	__SP_H__ = 0x3e
   5               	__SP_L__ = 0x3d
   6               	__tmp_reg__ = 0
   7               	__zero_reg__ = 1
   8               		.global __do_copy_data
   9               		.global __do_clear_bss
  10               		.stabs	"E:\\PROJECT_GCC\\ISO14443-B_OK/",100,0,0,.Ltext0
  11               		.stabs	"level3.c",100,0,0,.Ltext0
  12               		.text
  13               	.Ltext0:
  14               		.stabs	"gcc2_compiled.",60,0,0,0
  15               		.stabs	"int:t(0,1)=r(0,1);-32768;32767;",128,0,0,0
  16               		.stabs	"char:t(0,2)=@s8;r(0,2);0;255;",128,0,0,0
  17               		.stabs	"long int:t(0,3)=@s32;r(0,3);0020000000000;0017777777777;",128,0,0,0
  18               		.stabs	"unsigned int:t(0,4)=r(0,4);0000000000000;0000000177777;",128,0,0,0
  19               		.stabs	"long unsigned int:t(0,5)=@s32;r(0,5);0000000000000;0037777777777;",128,0,0,0
  20               		.stabs	"long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;",128,0,0,
  21               		.stabs	"long long unsigned int:t(0,7)=@s64;r(0,7);0000000000000;01777777777777777777777;",128,0,0,
  22               		.stabs	"short int:t(0,8)=r(0,8);-32768;32767;",128,0,0,0
  23               		.stabs	"short unsigned int:t(0,9)=r(0,9);0000000000000;0000000177777;",128,0,0,0
  24               		.stabs	"signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,0
  25               		.stabs	"unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,0
  26               		.stabs	"float:t(0,12)=r(0,1);4;0;",128,0,0,0
  27               		.stabs	"double:t(0,13)=r(0,1);4;0;",128,0,0,0
  28               		.stabs	"long double:t(0,14)=r(0,1);4;0;",128,0,0,0
  29               		.stabs	"complex int:t(0,15)=s4real:(0,1),0,16;imag:(0,1),16,16;;",128,0,0,0
  30               		.stabs	"complex float:t(0,16)=R3;8;0;",128,0,0,0
  31               		.stabs	"complex double:t(0,17)=R3;8;0;",128,0,0,0
  32               		.stabs	"complex long double:t(0,18)=R3;8;0;",128,0,0,0
  33               		.stabs	"__builtin_va_list:t(0,19)=*(0,20)=(0,20)",128,0,0,0
  34               		.stabs	"_Bool:t(0,21)=@s8;-16;",128,0,0,0
  35               		.stabs	"level3.c",130,0,0,0
  36               		.stabs	"C:/WinAVR/avr/include/avr/io.h",130,0,0,0
  37               		.stabs	"C:/WinAVR/avr/include/avr/sfr_defs.h",130,0,0,0
  38               		.stabs	"C:/WinAVR/avr/include/inttypes.h",130,0,0,0
  39               		.stabs	"int8_t:t(4,1)=(0,10)",128,0,67,0
  40               		.stabs	"uint8_t:t(4,2)=(0,11)",128,0,72,0
  41               		.stabs	"int16_t:t(4,3)=(0,1)",128,0,90,0
  42               		.stabs	"uint16_t:t(4,4)=(0,4)",128,0,95,0
  43               		.stabs	"int32_t:t(4,5)=(0,3)",128,0,106,0
  44               		.stabs	"uint32_t:t(4,6)=(0,5)",128,0,111,0
  45               		.stabs	"int64_t:t(4,7)=(0,6)",128,0,124,0
  46               		.stabs	"uint64_t:t(4,8)=(0,7)",128,0,129,0
  47               		.stabs	"intptr_t:t(4,9)=(4,3)",128,0,141,0
  48               		.stabs	"uintptr_t:t(4,10)=(4,4)",128,0,146,0
  49               		.stabn	162,0,0,0
  50               		.stabn	162,0,0,0
  51               		.stabs	"C:/WinAVR/avr/include/avr/iom8.h",130,0,0,0
  52               		.stabn	162,0,0,0
  53               		.stabs	"C:/WinAVR/avr/include/avr/portpins.h",130,0,0,0
  54               		.stabn	162,0,0,0
  55               		.stabn	162,0,0,0
  56               		.stabs	"C:/WinAVR/avr/include/avr/interrupt.h",130,0,0,0
  57               		.stabn	162,0,0,0
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccWGbaaa.s 			page 2


  58               		.stabs	"C:/WinAVR/avr/include/avr/signal.h",130,0,0,0
  59               		.stabn	162,0,0,0
  60               		.stabs	"C:/WinAVR/avr/include/avr/wdt.h",130,0,0,0
  61               		.stabn	162,0,0,0
  62               		.stabs	"level4.h",130,0,0,0
  63               		.stabn	162,0,0,0
  64               		.stabs	"level3.h",130,0,0,0
  65               		.stabn	162,0,0,0
  66               		.stabs	"level2.h",130,0,0,0
  67               		.stabn	162,0,0,0
  68               		.stabs	"level1.h",130,0,0,0
  69               		.stabn	162,0,0,0
  70               		.stabs	"Compute_Timeouts:F(0,20)",36,0,42,Compute_Timeouts
  71               	.global	Compute_Timeouts
  72               		.type	Compute_Timeouts, @function
  73               	Compute_Timeouts:
   1:level3.c      **** 
   2:level3.c      **** 
   3:level3.c      **** 
   4:level3.c      **** #include <avr/io.h>
   5:level3.c      **** #include <inttypes.h>
   6:level3.c      **** #include <avr/interrupt.h>
   7:level3.c      **** #include <avr/signal.h>
   8:level3.c      **** #include <avr/wdt.h>
   9:level3.c      **** #include "level4.h"
  10:level3.c      **** #include "level3.h"
  11:level3.c      **** #include "level2.h"
  12:level3.c      **** #include "level1.h"
  13:level3.c      **** 
  14:level3.c      **** //#define STD_WAIT 145                  //~318us = (145+13)x32 @ 16MHz , 13x32 uC clocks is a setup
  15:level3.c      **** 
  16:level3.c      **** //--------------------------------------------------------------
  17:level3.c      **** //global variables
  18:level3.c      **** 
  19:level3.c      **** uint8_t clean_data_cnt;               //clean response data length
  20:level3.c      **** uint8_t maxCaptureTime;                 //current maximum capture time (used to initialise TCNT2)
  21:level3.c      **** uint8_t maxCaptureTimeScale;            //scale of current maximum capture time (expected value 3 -
  22:level3.c      **** uint8_t temp;
  23:level3.c      **** uint8_t number;
  24:level3.c      **** uint8_t sec;
  25:level3.c      **** uint16_t maxTGeneral;                 //current datarate maximum response capture time
  26:level3.c      **** uint8_t expectedResponseLen;          // expected number of response bits
  27:level3.c      **** 
  28:level3.c      **** 
  29:level3.c      **** //--------------------------------------------------------------
  30:level3.c      **** //Local functions declaration
  31:level3.c      **** void Capture( void );
  32:level3.c      **** void Compute_Timeouts( void );
  33:level3.c      **** uint16_t ScaleOnce( uint16_t period );
  34:level3.c      **** uint8_t ScaleTime( uint16_t period );
  35:level3.c      **** void Send( uint8_t len , uint16_t wait_time );
  36:level3.c      **** void Wait( uint16_t period );
  37:level3.c      **** uint8_t Read_TypeB_Card( void );
  38:level3.c      **** //--------------------------------------------------------------
  39:level3.c      **** //compute the timeouts according to the flag byte
  40:level3.c      **** //
  41:level3.c      **** void Compute_Timeouts( void ) 
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccWGbaaa.s 			page 3


  42:level3.c      **** {
  74               		.stabn 68,0,42,.LM1-Compute_Timeouts
  75               	.LM1:
  76               	/* prologue: frame size=0 */
  77               	/* prologue end (size=0) */
  43:level3.c      ****     uint16_t pom = 0;
  44:level3.c      ****     //type B
  45:level3.c      ****     pom = ( uint16_t )expectedResponseLen * 64 + 128;  //128RF/32 = 4 TCNT2 pulses per bit + reserv
  78               		.stabn 68,0,45,.LM2-Compute_Timeouts
  79               	.LM2:
  80               	.LBB2:
  81 0000 8091 0000 		lds r24,expectedResponseLen
  82 0004 9927      		clr r25
  83 0006 0024      		clr __tmp_reg__
  84 0008 9695      		lsr r25
  85 000a 8795      		ror r24
  86 000c 0794      		ror __tmp_reg__
  87 000e 9695      		lsr r25
  88 0010 8795      		ror r24
  89 0012 0794      		ror __tmp_reg__
  90 0014 982F      		mov r25,r24
  91 0016 802D      		mov r24,__tmp_reg__
  92 0018 8058      		subi r24,lo8(-(128))
  93 001a 9F4F      		sbci r25,hi8(-(128))
  46:level3.c      ****     pom = ( 19 * ( uint32_t )pom ) / 16 + 1;   //13.56 to 16 correction
  94               		.stabn 68,0,46,.LM3-Compute_Timeouts
  95               	.LM3:
  96 001c AA27      		clr r26
  97 001e BB27      		clr r27
  98 0020 BC01      		movw r22,r24
  99 0022 CD01      		movw r24,r26
 100 0024 23E1      		ldi r18,lo8(19)
 101 0026 30E0      		ldi r19,hi8(19)
 102 0028 40E0      		ldi r20,hlo8(19)
 103 002a 50E0      		ldi r21,hhi8(19)
 104 002c 00D0      		rcall __mulsi3
 105 002e DC01      		movw r26,r24
 106 0030 CB01      		movw r24,r22
 107 0032 24E0      		ldi r18,4
 108 0034 B695      	1:	lsr r27
 109 0036 A795      		ror r26
 110 0038 9795      		ror r25
 111 003a 8795      		ror r24
 112 003c 2A95      		dec r18
 113 003e D1F7      		brne 1b
 114 0040 0196      		adiw r24,1
  47:level3.c      ****     maxTGeneral     = pom;
 115               		.stabn 68,0,47,.LM4-Compute_Timeouts
 116               	.LM4:
 117 0042 9093 0000 		sts (maxTGeneral)+1,r25
 118 0046 8093 0000 		sts maxTGeneral,r24
  48:level3.c      **** }
 119               		.stabn 68,0,48,.LM5-Compute_Timeouts
 120               	.LM5:
 121               	.LBE2:
 122               	/* epilogue: frame size=0 */
 123 004a 0895      		ret
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccWGbaaa.s 			page 4


 124               	/* epilogue end (size=1) */
 125               	/* function Compute_Timeouts size 38 (37) */
 126               		.size	Compute_Timeouts, .-Compute_Timeouts
 127               		.stabs	"pom:r(4,4)",64,0,43,24
 128               		.stabn	192,0,0,.LBB2-Compute_Timeouts
 129               		.stabn	224,0,0,.LBE2-Compute_Timeouts
 130               	.Lscope0:
 131               		.stabs	"",36,0,0,.Lscope0-Compute_Timeouts
 132               		.stabs	"Send:F(0,20)",36,0,56,Send
 133               		.stabs	"len:P(4,2)",64,0,55,17
 134               		.stabs	"wait_time:P(4,4)",64,0,55,14
 135               	.global	Send
 136               		.type	Send, @function
 137               	Send:
  49:level3.c      **** 
  50:level3.c      **** 
  51:level3.c      **** 
  52:level3.c      **** //--------------------------------------------------------------
  53:level3.c      **** //send command and wait
  54:level3.c      **** //
  55:level3.c      **** void Send( uint8_t len , uint16_t wait_time ) 
  56:level3.c      **** {
 138               		.stabn 68,0,56,.LM6-Send
 139               	.LM6:
 140               	/* prologue: frame size=0 */
 141 004c EF92      		push r14
 142 004e FF92      		push r15
 143 0050 0F93      		push r16
 144 0052 1F93      		push r17
 145 0054 CF93      		push r28
 146               	/* prologue end (size=5) */
 147 0056 182F      		mov r17,r24
 148 0058 7B01      		movw r14,r22
  57:level3.c      ****     uint8_t fwd_bit_count;
  58:level3.c      ****     uint8_t i;
  59:level3.c      **** 
  60:level3.c      ****     fwd_bit_count = Prepare_SOF( );
 149               		.stabn 68,0,60,.LM7-Send
 150               	.LM7:
 151               	.LBB3:
 152 005a 00D0      		rcall Prepare_SOF
 153 005c 082F      		mov r16,r24
  61:level3.c      **** 
  62:level3.c      ****     for ( i = 0 ; i < len ; i++ ) 
 154               		.stabn 68,0,62,.LM8-Send
 155               	.LM8:
 156 005e C0E0      		ldi r28,lo8(0)
 157 0060 C117      		cp r28,r17
 158 0062 A0F0      		brlo .L7
 159               	.L10:
  63:level3.c      ****         fwd_bit_count += Prepare_Data( cmd_message[ i ] , len );
  64:level3.c      **** 
  65:level3.c      ****     fwd_bit_count += Prepare_EOF( len );
 160               		.stabn 68,0,65,.LM9-Send
 161               	.LM9:
 162 0064 812F      		mov r24,r17
 163 0066 00D0      		rcall Prepare_EOF
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccWGbaaa.s 			page 5


 164 0068 080F      		add r16,r24
  66:level3.c      **** 
  67:level3.c      ****     Compute_Timeouts( );
 165               		.stabn 68,0,67,.LM10-Send
 166               	.LM10:
 167 006a CADF      		rcall Compute_Timeouts
  68:level3.c      ****     ClearCaptureBuffers( );
 168               		.stabn 68,0,68,.LM11-Send
 169               	.LM11:
 170 006c 00D0      		rcall ClearCaptureBuffers
  69:level3.c      ****     maxCaptureTime = ScaleTime( maxTGeneral );
 171               		.stabn 68,0,69,.LM12-Send
 172               	.LM12:
 173 006e 8091 0000 		lds r24,maxTGeneral
 174 0072 9091 0000 		lds r25,(maxTGeneral)+1
 175 0076 80D0      		rcall ScaleTime
 176 0078 8093 0000 		sts maxCaptureTime,r24
  70:level3.c      **** 
  71:level3.c      ****     SendForward( fwd_bit_count );
 177               		.stabn 68,0,71,.LM13-Send
 178               	.LM13:
 179 007c 802F      		mov r24,r16
 180 007e 00D0      		rcall SendForward
  72:level3.c      **** 
  73:level3.c      ****     if ( wait_time != 0 ) 
 181               		.stabn 68,0,73,.LM14-Send
 182               	.LM14:
 183 0080 E114      		cp r14,__zero_reg__
 184 0082 F104      		cpc r15,__zero_reg__
 185 0084 79F0      		breq .L2
  74:level3.c      ****     	  Wait( wait_time );
 186               		.stabn 68,0,74,.LM15-Send
 187               	.LM15:
 188 0086 C701      		movw r24,r14
 189 0088 48D0      		rcall Wait
 190 008a 0CC0      		rjmp .L2
 191               	.L7:
 192               		.stabn 68,0,63,.LM16-Send
 193               	.LM16:
 194 008c EC2F      		mov r30,r28
 195 008e FF27      		clr r31
 196 0090 E050      		subi r30,lo8(-(cmd_message))
 197 0092 F040      		sbci r31,hi8(-(cmd_message))
 198 0094 612F      		mov r22,r17
 199 0096 8081      		ld r24,Z
 200 0098 00D0      		rcall Prepare_Data
 201 009a 080F      		add r16,r24
 202               		.stabn 68,0,62,.LM17-Send
 203               	.LM17:
 204 009c CF5F      		subi r28,lo8(-(1))
 205 009e C117      		cp r28,r17
 206 00a0 A8F3      		brlo .L7
 207 00a2 E0CF      		rjmp .L10
  75:level3.c      **** }
 208               		.stabn 68,0,75,.LM18-Send
 209               	.LM18:
 210               	.L2:
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccWGbaaa.s 			page 6

⌨️ 快捷键说明

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