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

📄 level3.lst

📁 此程序为利用mage8 AVR 和EM4094实现读取TYPE A类型卡的C程序、读卡稳定、这个项目我们做了好久、非常不错的程序、很适合做这方面产品的朋友们参考
💻 LST
📖 第 1 页 / 共 5 页
字号:
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccmgaaaa.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-A_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/ccmgaaaa.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               		.stabs	"TDECODE:T(12,1)=s256capture_data:(12,2)=ar(12,3)=r(12,3);0000000000000;0000000177777;;0;12
  68               		.stabs	"TDECODE:t(12,4)=(12,1)",128,0,69,0
  69               		.stabs	"TCAPTURE:T(12,5)=s576decoded_data:(12,1),0,2048;raw_data:(12,6)=ar(12,3);0;319;(4,2),2048,
  70               		.stabs	"TCAPTURE:t(12,7)=(12,5)",128,0,74,0
  71               		.stabn	162,0,0,0
  72               		.stabs	"level1.h",130,0,0,0
  73               		.stabn	162,0,0,0
  74               		.stabs	"Capture:F(0,20)",36,0,47,Capture
  75               	.global	Capture
  76               		.type	Capture, @function
  77               	Capture:
   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      **** //--------------------------------------------------------------
  15:level3.c      **** //global variables
  16:level3.c      **** uint8_t volatile sof;                   //sof and eof indication
  17:level3.c      **** uint8_t maxCaptureTime;                 //current maximum capture time (used to initialise TCNT2)
  18:level3.c      **** uint8_t maxCaptureTimeScale;            //scale of current maximum capture time (expected value 3 -
  19:level3.c      **** uint8_t cmd_message[ UART_IN_BUFFER_SIZE ];  // maximum
  20:level3.c      **** 
  21:level3.c      **** uint8_t debug_mode;
  22:level3.c      **** uint8_t expectedResponseLen;            // expected number of response bits
  23:level3.c      **** uint8_t clean_data_cnt;                 //clean response data length
  24:level3.c      **** uint16_t maxTGeneral;                   //current datarate maximum response capture time
  25:level3.c      **** uint8_t em4094_data_valid;              //EM4094读到了有效数据,即读到了卡号;
  26:level3.c      **** //--------------------------------------------------------------
  27:level3.c      **** //Local function declarations
  28:level3.c      **** 
  29:level3.c      **** void Capture( void );
  30:level3.c      **** void Compute_Timeouts( void );
  31:level3.c      **** uint16_t ScaleOnce( uint16_t period );
  32:level3.c      **** uint8_t ScaleTime( uint16_t period );
  33:level3.c      **** void Send( uint8_t len , uint16_t wait_time );
  34:level3.c      **** void store_bit( uint8_t b , uint8_t v );
  35:level3.c      **** void store_pulse( uint8_t b );
  36:level3.c      **** void type_A_polling( void );
  37:level3.c      **** void TypeA_GetUID( void );
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccmgaaaa.s 			page 3


  38:level3.c      **** void Wait( uint16_t period ); 
  39:level3.c      **** 
  40:level3.c      **** 
  41:level3.c      **** // ==================================================================
  42:level3.c      **** // Down Link setup function
  43:level3.c      **** // Requires: maxCaptureTime and maxCaptureTimeScale
  44:level3.c      **** //   (located here instead of level2 because of register variables)
  45:level3.c      **** 
  46:level3.c      **** void Capture( void ) 
  47:level3.c      **** {
  78               		.stabn 68,0,47,.LM1-Capture
  79               	.LM1:
  80               	/* prologue: frame size=0 */
  81               	/* prologue end (size=0) */
  48:level3.c      ****     TCCR0 = 0;                                //disable Counter0
  82               		.stabn 68,0,48,.LM2-Capture
  83               	.LM2:
  84 0000 13BE      		out 83-0x20,__zero_reg__
  49:level3.c      ****     TCCR1B = 0;                               //disable Counter1
  85               		.stabn 68,0,49,.LM3-Capture
  86               	.LM3:
  87 0002 1EBC      		out 78-0x20,__zero_reg__
  50:level3.c      ****     TCNT1 = 0;
  88               		.stabn 68,0,50,.LM4-Capture
  89               	.LM4:
  90 0004 1DBC      		out (76)+1-0x20,__zero_reg__
  91 0006 1CBC      		out 76-0x20,__zero_reg__
  51:level3.c      ****     if ( !bufferClean ) 
  92               		.stabn 68,0,51,.LM5-Capture
  93               	.LM5:
  94 0008 8091 0000 		lds r24,bufferClean
  95 000c 8823      		tst r24
  96 000e 09F4      		brne .+2
  97 0010 41C0      		rjmp .L10
  98               	.L2:
  52:level3.c      ****     	  ClearCaptureBuffers( );
  53:level3.c      ****     bufferClean = 0;
  99               		.stabn 68,0,53,.LM6-Capture
 100               	.LM6:
 101 0012 1092 0000 		sts bufferClean,__zero_reg__
  54:level3.c      ****     captured_bit_count = 0;                   //reset some values
 102               		.stabn 68,0,54,.LM7-Capture
 103               	.LM7:
 104 0016 9924      		clr r9
  55:level3.c      ****     capture_cnt = 0;
 105               		.stabn 68,0,55,.LM8-Capture
 106               	.LM8:
 107 0018 892C      		mov r8,r9
  56:level3.c      ****     raw_cnt = 0;
 108               		.stabn 68,0,56,.LM9-Capture
 109               	.LM9:
 110 001a B92C      		mov r11,r9
  57:level3.c      ****     bit_pos = 1;
 111               		.stabn 68,0,57,.LM10-Capture
 112               	.LM10:
 113 001c 81E0      		ldi r24,lo8(1)
 114 001e A82E      		mov r10,r24
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccmgaaaa.s 			page 4


  58:level3.c      ****     sof = 0;
 115               		.stabn 68,0,58,.LM11-Capture
 116               	.LM11:
 117 0020 9092 0000 		sts sof,r9
  59:level3.c      ****     //set hi byte of maximum capture timer2 timeout
  60:level3.c      ****     TCNT2 = ~maxCaptureTime;                  //set timer2 timeout
 118               		.stabn 68,0,60,.LM12-Capture
 119               	.LM12:
 120 0024 8091 0000 		lds r24,maxCaptureTime
 121 0028 8095      		com r24
 122 002a 84BD      		out 68-0x20,r24
  61:level3.c      ****     TCNT0 = 0;                                //clear timer0
 123               		.stabn 68,0,61,.LM13-Capture
 124               	.LM13:
 125 002c 92BE      		out 82-0x20,r9
  62:level3.c      ****     TIFR = TIFR | ( 1 << ICF1 ) | ( 1 << TOV1 ) | ( 1 << OCF2 ) | ( 1 << TOV2 );      //clear pendi
 126               		.stabn 68,0,62,.LM14-Capture
 127               	.LM14:
 128 002e 88B7      		in r24,88-0x20
 129 0030 846E      		ori r24,lo8(-28)
 130 0032 88BF      		out 88-0x20,r24
  63:level3.c      ****     sbi( TIMSK , TOIE2 );                      //enable timer2 overflow
 131               		.stabn 68,0,63,.LM15-Capture
 132               	.LM15:
 133 0034 89B7      		in r24,89-0x20
 134 0036 8064      		ori r24,lo8(64)
 135 0038 89BF      		out 89-0x20,r24
  64:level3.c      ****     sbi( SFIOR , PSR2 );                       //clear timer2 prescaler
 136               		.stabn 68,0,64,.LM16-Capture
 137               	.LM16:
 138 003a 80B7      		in r24,80-0x20
 139 003c 8260      		ori r24,lo8(2)
 140 003e 80BF      		out 80-0x20,r24
  65:level3.c      ****     //  enable_capture = style;                   //set capture style
  66:level3.c      ****     TCCR2 = maxCaptureTimeScale;              //run T2
 141               		.stabn 68,0,66,.LM17-Capture
 142               	.LM17:
 143 0040 8091 0000 		lds r24,maxCaptureTimeScale
 144 0044 85BD      		out 69-0x20,r24
  67:level3.c      ****     if( forward_link_type == 2 ) 
 145               		.stabn 68,0,67,.LM18-Capture
 146               	.LM18:
 147 0046 8091 0000 		lds r24,forward_link_type
 148 004a 8230      		cpi r24,lo8(2)
 149 004c C1F0      		breq .L11
 150               	.L3:
  68:level3.c      ****     {                //type A
  69:level3.c      ****         TCCR0 = 6;                                //external clock source, falling edge
  70:level3.c      ****         TCCR1B = counter1set;                     //run! at clk
  71:level3.c      ****         type_A_polling( );                         //do polling until done for Manchester
  72:level3.c      ****         
  73:level3.c      ****         wdt_reset( );
  74:level3.c      ****         
  75:level3.c      **** #ifdef WDT
  76:level3.c      ****         WatchDog_Feed( );
  77:level3.c      **** #endif
  78:level3.c      ****         TCCR0 = 0;                                //stop all
GAS LISTING C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccmgaaaa.s 			page 5


  79:level3.c      ****         TCCR1B = 0;
  80:level3.c      ****     } 
  81:level3.c      ****     
  82:level3.c      ****     TCCR2 = 0;
 151               		.stabn 68,0,82,.LM19-Capture
 152               	.LM19:
 153 004e 15BC      		out 69-0x20,__zero_reg__
  83:level3.c      ****     cbi( TIMSK , TOIE2 );                        //disable timer2 overflow
 154               		.stabn 68,0,83,.LM20-Capture
 155               	.LM20:
 156 0050 89B7      		in r24,89-0x20
 157 0052 8F7B      		andi r24,lo8(-65)
 158 0054 89BF      		out 89-0x20,r24
  84:level3.c      ****     sbi( TIFR , TOV2 );                          //clear pending interrupt
 159               		.stabn 68,0,84,.LM21-Capture
 160               	.LM21:
 161 0056 88B7      		in r24,88-0x20
 162 0058 8064      		ori r24,lo8(64)
 163 005a 88BF      		out 88-0x20,r24
  85:level3.c      **** 
  86:level3.c      ****     if ( ( debug_mode != 1 ) && ( forward_link_type != 3 ) ) 
 164               		.stabn 68,0,86,.LM22-Capture
 165               	.LM22:
 166 005c 8091 0000 		lds r24,debug_mode
 167 0060 8130      		cpi r24,lo8(1)
 168 0062 31F0      		breq .L1
 169 0064 8091 0000 		lds r24,forward_link_type
 170 0068 8330      		cpi r24,lo8(3)
 171 006a 11F0      		breq .L1
  87:level3.c      ****     {
  88:level3.c      ****         while ( captured_bit_count != 0 )           //flush captured bits
 172               		.stabn 68,0,88,.LM23-Capture
 173               	.LM23:
 174 006c 9920      		tst r9
 175 006e 09F4      		brne .L8
  89:level3.c      ****         store_bit( 0 , 1 );
  90:level3.c      ****     }
  91:level3.c      **** }
 176               		.stabn 68,0,91,.LM24-Capture
 177               	.LM24:
 178               	.L1:
 179 0070 0895      		ret
 180               	.L8:
 181               		.stabn 68,0,89,.LM25-Capture
 182               	.LM25:
 183 0072 61E0      		ldi r22,lo8(1)
 184 0074 80E0      		ldi r24,lo8(0)
 185 0076 3DD1      		rcall store_bit
 186 0078 9920      		tst r9
 187 007a D9F7      		brne .L8

⌨️ 快捷键说明

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