📄 main.lis
字号:
.module main.c
.area text(rom, con, rel)
0000 .dbfile D:\hexok项目\AVRNET项目\AVRNET光盘\AVRuIP\main.c
0000 .dbfunc e initTimer _initTimer fV
.even
0000 _initTimer::
0000 .dbline -1
0000 .dbline 57
0000 ; /*****************************************************************************
0000 ; * Module Name: uIP-AVR Port - main control loop shell
0000 ; *
0000 ; * Created By: Louis Beaudoin (www.embedded-creations.com)
0000 ; *
0000 ; * Original Release: September 21, 2002
0000 ; *
0000 ; * Module Description:
0000 ; * This main control loop shell provides everything required for a basic uIP
0000 ; * application using the RTL8019AS NIC
0000 ; *
0000 ; *
0000 ; * November 16, 2003
0000 ; * Changed NIC interface from RTL8019 specific to general NIC calls
0000 ; * Calls the uip_arp_timer function every 10 seconds
0000 ; *
0000 ; * September 30, 2002
0000 ; * Added support for Imagecraft Compiler
0000 ; *****************************************************************************/
0000 ;
0000 ;
0000 ; #include "uip.h"
0000 ; #include "nic.h"
0000 ; #include "uip_arp.h"
0000 ; #include "httpd.h"
0000 ;
0000 ; #include "fs.h"
0000 ; #include "fsdata.h"
0000 ; #include "cgi.h"
0000 ; #include "filelist.h"
0000 ; #include "compiler.h"
0000 ;
0000 ;
0000 ; #define BUF ((struct uip_eth_hdr *)&uip_buf[0])
0000 ;
0000 ;
0000 ;
0000 ; /*****************************************************************************
0000 ; * Periodic Timout Functions and variables
0000 ; *
0000 ; * The periodic timeout rate can be changed depeding on your application
0000 ; * Modify these functions and variables based on your AVR device and clock
0000 ; * rate
0000 ; * The current setup will interrupt every 256 timer ticks when the timer
0000 ; * counter overflows. timerCounter must count until 0.5 seconds have
0000 ; * alapsed
0000 ; *****************************************************************************/
0000 ;
0000 ; #define TIMER_PRESCALE 1024
0000 ; #define F_CPU 12000000
0000 ;
0000 ; #define TIMERCOUNTER_PERIODIC_TIMEOUT (F_CPU / TIMER_PRESCALE / 2 / 256)
0000 ;
0000 ; static unsigned char timerCounter;
0000 ;
0000 ; void initTimer(void)
0000 ; {
0000 .dbline 58
0000 ; outp( 7, TCCR0 ) ; // timer0 prescale 1/1024 (7)
0000 87E0 ldi R24,7
0002 83BF out 0x33,R24
0004 .dbline 61
0004 ;
0004 ; // interrupt on overflow
0004 ; sbi( TIMSK, TOIE0 ) ;
0004 87B7 in R24,0x37
0006 8160 ori R24,1
0008 87BF out 0x37,R24
000A .dbline 63
000A ;
000A ; timerCounter = 0;
000A 2224 clr R2
000C 20920000 sts _timerCounter,R2
0010 .dbline -2
0010 L7:
0010 .dbline 0 ; func end
0010 0895 ret
0012 .dbend
.area vector(rom, abs)
.org 64
0040 0C940900 jmp _SIG_OVERFLOW0
.area text(rom, con, rel)
0012 .dbfile D:\hexok项目\AVRNET项目\AVRNET光盘\AVRuIP\main.c
0012 .dbfunc e SIG_OVERFLOW0 _SIG_OVERFLOW0 fV
.even
0012 _SIG_OVERFLOW0::
0012 8A93 st -y,R24
0014 9A93 st -y,R25
0016 8FB7 in R24,0x3f
0018 8A93 st -y,R24
001A .dbline -1
001A .dbline 73
001A ; }
001A ;
001A ;
001A ;
001A ; #ifdef __IMAGECRAFT__
001A ; #pragma interrupt_handler SIG_OVERFLOW0:iv_TIMER0_OVF
001A ; #endif
001A ;
001A ; SIGNAL(SIG_OVERFLOW0)
001A ; {
001A .dbline 74
001A ; timerCounter++;
001A 80910000 lds R24,_timerCounter
001E 8F5F subi R24,255 ; addi 1
0020 80930000 sts _timerCounter,R24
0024 .dbline -2
0024 L8:
0024 8991 ld R24,y+
0026 8FBF out 0x3f,R24
0028 9991 ld R25,y+
002A 8991 ld R24,y+
002C .dbline 0 ; func end
002C 1895 reti
002E .dbend
002E .dbfunc e main _main fI
002E ; arptimer -> R10
002E ; i -> R12
.even
002E _main::
002E .dbline -1
002E .dbline 85
002E ; }
002E ;
002E ;
002E ;
002E ; /*****************************************************************************
002E ; * Main Control Loop
002E ; *
002E ; *
002E ; *****************************************************************************/
002E ; int main(void)
002E ; {
002E .dbline 87
002E ; unsigned char i;
002E ; unsigned char arptimer=0;
002E AA24 clr R10
0030 .dbline 88
0030 ; PORTD = 0x02;
0030 82E0 ldi R24,2
0032 82BB out 0x12,R24
0034 .dbline 89
0034 ; DDRD = 0x30;
0034 80E3 ldi R24,48
0036 81BB out 0x11,R24
0038 .dbline 91
0038 ; // init NIC device driver
0038 ; nic_init();
0038 0E940000 xcall _nic_init
003C .dbline 94
003C ;
003C ; // init uIP
003C ; uip_init();
003C 0E940000 xcall _uip_init
0040 .dbline 97
0040 ;
0040 ; // init http
0040 ; httpd_init();
0040 0E940000 xcall _httpd_init
0044 .dbline 100
0044 ;
0044 ; // init ARP cache
0044 ; uip_arp_init();
0044 0E940000 xcall _uip_arp_init
0048 .dbline 103
0048 ;
0048 ; // init periodic timer
0048 ; initTimer();
0048 DBDF xcall _initTimer
004A .dbline 105
004A ;
004A ; sei();
004A 7894 sei
004C 7FC0 xjmp L11
004E L10:
004E .dbline 108
004E ;
004E ; while(1)
004E ; {
004E .dbline 110
004E ; // look for a packet
004E ; uip_len = nic_poll();
004E 0E940000 xcall _nic_poll
0052 10930100 sts _uip_len+1,R17
0056 00930000 sts _uip_len,R16
005A .dbline 111
005A ; if(uip_len == 0)
005A 20900000 lds R2,_uip_len
005E 30900100 lds R3,_uip_len+1
0062 2220 tst R2
0064 09F0 breq X5
0066 3EC0 xjmp L13
0068 X5:
0068 3320 tst R3
006A 09F0 breq X6
006C 3BC0 xjmp L13
006E X6:
006E X0:
006E .dbline 112
006E ; {
006E .dbline 114
006E ; // if timed out, call periodic function for each connection
006E ; if(timerCounter > TIMERCOUNTER_PERIODIC_TIMEOUT)
006E 86E1 ldi R24,22
0070 90E0 ldi R25,0
0072 A0E0 ldi R26,0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -