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

📄 systime.lst

📁 无线传感器星型网络的节点的基站程序,采用802.15.4协议
💻 LST
📖 第 1 页 / 共 4 页
字号:
   1               		.file	"systime.c"
   2               		.arch atmega128
   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
  11               		.text
  12               	.Ltext0:
 222               	.global	systime16L
 224               	systime16L:
   1:systime.c     **** //----------------------------------------------------//
   2:systime.c     **** //-------Institute Of  Computing Technology-----------//
   3:systime.c     **** //------------Chinese Academic  Science---------------//
   4:systime.c     **** //-----中国科学院计算技术研究所先进测试技术实验室-----//
   5:systime.c     **** //----------------------------------------------------//
   6:systime.c     **** 
   7:systime.c     **** // **************************************************
   8:systime.c     **** // * @copyright:nbicc_lpp
   9:systime.c     **** // * @this is timer1 systime
  10:systime.c     **** // * @author zhouqiang  (zhouhongren@163.com)
  11:systime.c     **** // *              liulingyi      (lingyiliu@ict.ac.cn)
  12:systime.c     **** // * @data:2005.11.05
  13:systime.c     **** // * @version:0.0.1
  14:systime.c     **** // * @updata:$
  15:systime.c     **** // **************************************************
  16:systime.c     **** #include "systime.h"
  17:systime.c     **** 
  18:systime.c     **** extern  MAC_PIB  mac_pib_data;
  19:systime.c     **** extern MAC_STATE_TYPE mac_current_state;
  20:systime.c     **** extern bool         Is_received_beacon;
  21:systime.c     **** extern  uint8_t     loss_sync_number;
  22:systime.c     **** //extern  uint8_t  test_variable;
  23:systime.c     **** extern   bool  IS_NETWORK_FORMED;
  24:systime.c     **** union time_u
  25:systime.c     **** {
  26:systime.c     **** 	struct
  27:systime.c     **** 	{
  28:systime.c     **** 		uint16_t low;
  29:systime.c     **** 		uint16_t high;
  30:systime.c     **** 	};
  31:systime.c     **** 	uint32_t full;
  32:systime.c     **** };
  33:systime.c     **** uint16_t systime16L(void)
  34:systime.c     **** {
 226               	.LM1:
 227               	/* prologue: frame size=0 */
 228               	/* prologue end (size=0) */
  35:systime.c     **** 	return TCNT1;
 230               	.LM2:
 231 0000 8CB5      		in r24,76-0x20
 232 0002 9DB5      		in r25,(76)+1-0x20
 233               	/* epilogue: frame size=0 */
 234 0004 0895      		ret
 235               	/* epilogue end (size=1) */
 236               	/* function systime16L size 3 (2) */
 239               	.global	systime16H
 241               	systime16H:
  36:systime.c     **** }
  37:systime.c     **** uint16_t systime16H(void)
  38:systime.c     **** {
 243               	.LM3:
 244               	/* prologue: frame size=0 */
 245               	/* prologue end (size=0) */
  39:systime.c     **** 	return currentTime;
  40:systime.c     **** }
 247               	.LM4:
 248 0006 8091 0000 		lds r24,currentTime
 249 000a 9091 0000 		lds r25,(currentTime)+1
 250               	/* epilogue: frame size=0 */
 251 000e 0895      		ret
 252               	/* epilogue end (size=1) */
 253               	/* function systime16H size 5 (4) */
 256               	.global	systime32
 258               	systime32:
  41:systime.c     **** uint32_t systime32(void)
  42:systime.c     **** {
 260               	.LM5:
 261               	/* prologue: frame size=0 */
 262 0010 EF92      		push r14
 263 0012 FF92      		push r15
 264 0014 0F93      		push r16
 265 0016 1F93      		push r17
 266               	/* prologue end (size=4) */
 267               	.LBB2:
  43:systime.c     ****         union time_u time;
  44:systime.c     **** 	
  45:systime.c     **** 	{ os_atomic_t _nesc_atomic = os_atomic_start();
 269               	.LM6:
 270 0018 0E94 0000 		call os_atomic_start
 271 001c 282F      		mov r18,r24
  46:systime.c     **** 	{
  47:systime.c     **** 		time.low = TCNT1;
 273               	.LM7:
 274 001e 8CB5      		in r24,76-0x20
 275 0020 9DB5      		in r25,(76)+1-0x20
 276 0022 7C01      		movw r14,r24
  48:systime.c     **** 		time.high = currentTime;
 278               	.LM8:
 279 0024 0091 0000 		lds r16,currentTime
 280 0028 1091 0000 		lds r17,(currentTime)+1
  49:systime.c     **** 
  50:systime.c     **** 		
  51:systime.c     **** 		if( bit_is_set(TIFR, TOV1) && ((int16_t)time.low) >= 0 )
 282               	.LM9:
 283 002c 06B6      		in __tmp_reg__,86-0x20
 284 002e 02FE      		sbrs __tmp_reg__,2
 285 0030 04C0      		rjmp .L4
 287               	.LM10:
 288 0032 97FD      		sbrc r25,7
 289 0034 02C0      		rjmp .L4
  52:systime.c     **** 			++time.high;
 291               	.LM11:
 292 0036 0F5F      		subi r16,lo8(-(1))
 293 0038 1F4F      		sbci r17,hi8(-(1))
 294               	.L4:
  53:systime.c     **** 	}
  54:systime.c     **** 	os_atomic_end(_nesc_atomic); }
 296               	.LM12:
 297 003a 822F      		mov r24,r18
 298 003c 0E94 0000 		call os_atomic_end
 299               	.LBE2:
  55:systime.c     **** 
  56:systime.c     **** 	return time.full;
  57:systime.c     **** }
 301               	.LM13:
 302 0040 C801      		movw r24,r16
 303 0042 B701      		movw r22,r14
 304               	/* epilogue: frame size=0 */
 305 0044 1F91      		pop r17
 306 0046 0F91      		pop r16
 307 0048 FF90      		pop r15
 308 004a EF90      		pop r14
 309 004c 0895      		ret
 310               	/* epilogue end (size=5) */
 311               	/* function systime32 size 31 (22) */
 318               	.global	systime_init
 320               	systime_init:
  58:systime.c     **** void systime_init(void)
  59:systime.c     **** {
 322               	.LM14:
 323               	/* prologue: frame size=0 */
 324               	/* prologue end (size=0) */
  60:systime.c     **** 	uint8_t timsk;
  61:systime.c     **** 	head_of_systimer_queue=NULL;
 326               	.LM15:
 327 004e 1092 0000 		sts (head_of_systimer_queue)+1,__zero_reg__
 328 0052 1092 0000 		sts head_of_systimer_queue,__zero_reg__
  62:systime.c     **** 	currentTime=0x0000;
 330               	.LM16:
 331 0056 1092 0000 		sts (currentTime)+1,__zero_reg__
 332 005a 1092 0000 		sts currentTime,__zero_reg__
  63:systime.c     **** 	TCNT1=0x0000;
 334               	.LM17:
 335 005e 1DBC      		out (76)+1-0x20,__zero_reg__
 336 0060 1CBC      		out 76-0x20,__zero_reg__
  64:systime.c     **** 	TCCR1A = 0x00;
 338               	.LM18:
 339 0062 1FBC      		out 79-0x20,__zero_reg__
  65:systime.c     **** 	TCCR1B = 0x00;
 341               	.LM19:
 342 0064 1EBC      		out 78-0x20,__zero_reg__
 343               	.LBB3:
  66:systime.c     ****        
  67:systime.c     **** 	{ os_atomic_t _nesc_atomic = os_atomic_start();
 345               	.LM20:
 346 0066 0E94 0000 		call os_atomic_start
  68:systime.c     **** 	{
  69:systime.c     **** 		timsk = TIMSK;
 348               	.LM21:
 349 006a 97B7      		in r25,87-0x20
  70:systime.c     **** 	  	timsk |= (1<<TOIE1);//enable overflow interrupt
  71:systime.c     **** 		timsk |=(1<<TICIE1);//enable input capture interrupt
 351               	.LM22:
 352 006c 9462      		ori r25,lo8(36)
  72:systime.c     **** 		TIMSK = timsk;
 354               	.LM23:
 355 006e 97BF      		out 87-0x20,r25
  73:systime.c     **** 		//---------------------------------------
  74:systime.c     **** 		//  add some codes for timequeue inital
  75:systime.c     **** 		//---------------------------------------
  76:systime.c     **** 		
  77:systime.c     **** 		       
  78:systime.c     **** 	}
  79:systime.c     **** 	 os_atomic_end(_nesc_atomic); }
 357               	.LM24:
 358 0070 0E94 0000 		call os_atomic_end
 359               	.LBE3:
  80:systime.c     **** 	 //-------------------------------
  81:systime.c     **** 	 // add some codes for timestamp initial
  82:systime.c     **** 	 //-------------------------------
  83:systime.c     **** 		
  84:systime.c     **** 	TCCR1B =0xc0|0x05;//! start th timer with 1/1024 prescaler, 0.5 symbol on gainz,normal model,risin
 361               	.LM25:
 362 0074 85EC      		ldi r24,lo8(-59)
 363 0076 8EBD      		out 78-0x20,r24
 364               	/* epilogue: frame size=0 */
 365 0078 0895      		ret
 366               	/* epilogue end (size=1) */
 367               	/* function systime_init size 22 (21) */
 371               	.global	systime_stop
 373               	systime_stop:
  85:systime.c     **** }
  86:systime.c     **** void systime_stop(void)
  87:systime.c     **** {
 375               	.LM26:
 376               	/* prologue: frame size=0 */
 377               	/* prologue end (size=0) */
  88:systime.c     **** 	
  89:systime.c     **** 	TCCR1B = 0x00;// stop the timer
 379               	.LM27:
 380 007a 1EBC      		out 78-0x20,__zero_reg__
 381               	/* epilogue: frame size=0 */
 382 007c 0895      		ret
 383               	/* epilogue end (size=1) */
 384               	/* function systime_stop size 2 (1) */
 387               	.global	Timer1_OCR_intDisable
 389               	Timer1_OCR_intDisable:
  90:systime.c     **** }
  91:systime.c     **** 
  92:systime.c     **** 
  93:systime.c     **** //---------------------------------------------------------------------------
  94:systime.c     **** //      some timer1 drivers for timequeue added by zhouqiang in 2005.12.04
  95:systime.c     **** //---------------------------------------------------------------------------
  96:systime.c     **** 
  97:systime.c     **** void Timer1_OCR_intDisable(void)//disable the ocr1 interrupt
  98:systime.c     ****  {
 391               	.LM28:
 392               	/* prologue: frame size=0 */
 393               	/* prologue end (size=0) */
 394               	.LBB4:
  99:systime.c     ****       { os_atomic_t _nesc_atomic = os_atomic_start();
 396               	.LM29:
 397 007e 0E94 0000 		call os_atomic_start
 100:systime.c     ****        	{
 101:systime.c     **** 	 		TIMSK &= 0xef;
 399               	.LM30:
 400 0082 97B7      		in r25,87-0x20
 401 0084 9F7E      		andi r25,lo8(-17)
 402 0086 97BF      		out 87-0x20,r25
 102:systime.c     **** 		}
 103:systime.c     ****       os_atomic_end(_nesc_atomic); }        	
 404               	.LM31:
 405 0088 0E94 0000 		call os_atomic_end
 406               	.LBE4:
 407               	/* epilogue: frame size=0 */
 408 008c 0895      		ret
 409               	/* epilogue end (size=1) */
 410               	/* function Timer1_OCR_intDisable size 8 (7) */
 414               	.global	Timer1_setInterval
 416               	Timer1_setInterval:
 104:systime.c     ****  }
 105:systime.c     **** 
 106:systime.c     **** uint8_t  Timer1_setInterval(uint16_t interval)
 107:systime.c     **** {
 418               	.LM32:
 419               	/* prologue: frame size=0 */
 420 008e 0F93      		push r16
 421 0090 1F93      		push r17
 422               	/* prologue end (size=2) */
 423 0092 8C01      		movw r16,r24
 424               	.LBB5:
 108:systime.c     ****    
 109:systime.c     **** 
 110:systime.c     ****      { os_atomic_t _nesc_atomic = os_atomic_start();
 426               	.LM33:
 427 0094 0E94 0000 		call os_atomic_start
 111:systime.c     ****          {
 112:systime.c     ****                      TIFR|=1<<OCF1A;
 429               	.LM34:
 430 0098 96B7      		in r25,86-0x20
 431 009a 9061      		ori r25,lo8(16)
 432 009c 96BF      		out 86-0x20,r25
 113:systime.c     **** 		     	OCR1A = interval;//this is the scale
 434               	.LM35:
 435 009e 1BBD      		out (74)+1-0x20,r17
 436 00a0 0ABD      		out 74-0x20,r16
 114:systime.c     **** 		     	//OCR1B = 0x0000;
 115:systime.c     **** 		     	//OCR1C = 0x0000;
 116:systime.c     **** 		     	//TCNT1 = 0x0000; //this is the counter
 117:systime.c     **** 		     	//TCCR1A = 0x00;//Output: A: Disconnected, B: Disconnected, C: Disconnected,WGM[1..0]=00
 118:systime.c     **** 		     	//scale |= 0x08;//
 119:systime.c     **** 		     	//TCCR1B |= scale;//clk/(scale),WGM[3..2]=01/CTC
 120:systime.c     **** 		     	//TCCR1C = 0x00;//
 121:systime.c     **** 		     	TIMSK |= 0x10;//OCIE1A is enable 
 438               	.LM36:
 439 00a2 97B7      		in r25,87-0x20
 440 00a4 9061      		ori r25,lo8(16)
 441 00a6 97BF      		out 87-0x20,r25
 122:systime.c     ****      	
 123:systime.c     ****          }
 124:systime.c     ****          os_atomic_end(_nesc_atomic); }
 443               	.LM37:
 444 00a8 0E94 0000 		call os_atomic_end
 445               	.LBE5:
 125:systime.c     **** 		 //printf("*****the interval is %04x",interval);
 126:systime.c     ****          return SUCCESS;
 127:systime.c     **** }
 447               	.LM38:
 448 00ac 80E0      		ldi r24,lo8(0)
 449 00ae 90E0      		ldi r25,hi8(0)
 450               	/* epilogue: frame size=0 */
 451 00b0 1F91      		pop r17
 452 00b2 0F91      		pop r16
 453 00b4 0895      		ret
 454               	/* epilogue end (size=3) */
 455               	/* function Timer1_setInterval size 20 (15) */
 459               	.global	Timer1_sethalfsymbol
 461               	Timer1_sethalfsymbol:
 128:systime.c     **** 
 129:systime.c     **** 
 130:systime.c     **** void      Timer1_sethalfsymbol(uint16_t symbols)
 131:systime.c     **** {
 463               	.LM39:
 464               	/* prologue: frame size=0 */
 465               	/* prologue end (size=0) */
 132:systime.c     ****       uint16_t halfsymbols;
 133:systime.c     ****       halfsymbols=symbols*2;
 134:systime.c     ****       Timer1_setInterval(symbols);
 467               	.LM40:
 468 00b6 0E94 0000 		call Timer1_setInterval
 469               	/* epilogue: frame size=0 */
 470 00ba 0895      		ret
 471               	/* epilogue end (size=1) */
 472               	/* function Timer1_sethalfsymbol size 3 (2) */
 476               	.global	Timer1_acquireInterval
 478               	Timer1_acquireInterval:
 135:systime.c     **** }
 136:systime.c     **** 
 137:systime.c     **** //供高层调用获得下一次定时的比较寄存器应当设置的值
 138:systime.c     **** uint32_t 	Timer1_acquireInterval(uint32_t interval)
 139:systime.c     **** {
 480               	.LM41:
 481               	/* prologue: frame size=0 */
 482 00bc EF92      		push r14
 483 00be FF92      		push r15
 484 00c0 0F93      		push r16

⌨️ 快捷键说明

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