📄 common.s
字号:
.module common.c
.area lit(rom, con, rel)
_Str3::
.byte 10,35,35,35,35,35,10,'R,'e,'b,'o,'o,'t,'e,'d,32
.byte 46,46,46,46,46,10,10,0
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e Str3 _Str3 A[24:24]kc
_Version::
.word 40
.dbsym e Version _Version ks
_VersionStr::
.byte 'V,'e,'r,58,32,'v,0
.dbsym e VersionStr _VersionStr A[7:7]kc
_Title::
.byte 'A,'T,47,'P,'P,'P,47,'I,'C,'M,'P,47,'U,'D,'P,47
.byte 'T,'C,'P,32,'b,'y,32,'C,46,'M,'o,'s,'s,10,0
.dbsym e Title _Title A[31:31]kc
_Date::
.byte 53,'t,'h,32,'F,'e,'b,32,50,48,48,52,10,0
.dbsym e Date _Date A[14:14]kc
_HelpStr::
.byte 10,32,32,'h,'e,'l,'p,32,'o,'r,32,63,32,46,46,46
.byte 46,46,46,46,46,32,'g,'u,'e,'s,'s,10,32,32,'i,'p
.byte 'c,'o,'n,'f,'i,'g,32,46,46,46,46,46,46,46,46,46
.byte 32,'d,'i,'s,'p,'l,'a,'y,32,'i,'p,32,'a,'d,'d,'r
.byte 'e,'s,'s,'e,'s,10,32,32,'d,'i,'a,'l,32,46,46,46
.byte 46,46,46,46,46,46,46,46,46,46,32,'c,'o,'n,'n,'e
.byte 'c,'t,10,32,32,'d,'i,'s,'c,32,46,46,46,46,46,46
.byte 46,46,46,46,46,46,46,32,'d,'i,'s,'c,'o,'n,'n,'e
.byte 'c,'t,10,32,32,'d,'e,'b,'u,'g,32,'o,'f,'f,32,46
.byte 46,46,46,46,46,46,46,32,'d,'e,'b,'u,'g,32,'m,'e
.byte 's,'s,'a,'g,'e,'s,32,'o,'f,'f,10,32,32,'d,'e,'b
.byte 'u,'g,32,'o,'n,32,46,46,46,46,46,46,46,46,46,32
.byte 'd,'e,'b,'u,'g,32,'m,'e,'s,'s,'a,'g,'e,'s,32,'o
.byte 'n,10,32,32,'p,'i,'n,'g,32,60,'i,'p,62,32,46,46
.byte 46,46,46,46,46,46,32,'p,'i,'n,'g,10,32,32,'t,'c
.byte 'p,32,60,'i,'p,62,91,58,'p,'o,'r,'t,93,32,46,46
.byte 32,'t,'c,'p,32,'i,'n,'t,'o,32,'a,32,'s,'e,'r,'v
.byte 'e,'r,10,32,32,'t,'c,'p,32,'d,'o,'w,'n,32,46,46
.byte 46,46,46,46,46,46,46,32,'t,'c,'p,32,'d,'i,'s,'c
.byte 'o,'n,'n,'e,'c,'t,10,32,32,'r,'e,'b,'o,'o,'t,32
.byte 46,46,46,46,46,46,46,46,46,46,46,32,'r,'e,'b,'o
.byte 'o,'t,33,10,0
.dbsym e HelpStr _HelpStr A[341:341]kc
_DebugMessagesStr1::
.byte 10,42,42,42,32,'D,'e,'b,'u,'g,32,'M,'s,'g,'s,58
.byte 32,0
.dbsym e DebugMessagesStr1 _DebugMessagesStr1 A[18:18]kc
_DebugMessagesStr2::
.byte 'o,'f,'f,10,0
.dbsym e DebugMessagesStr2 _DebugMessagesStr2 A[5:5]kc
_DebugMessagesStr3::
.byte 'o,'n,10,0
.dbsym e DebugMessagesStr3 _DebugMessagesStr3 A[4:4]kc
_RebootingStr::
.byte 10,'R,'e,'b,'o,'o,'t,'i,'n,'g,32,46,46,10,0
.dbsym e RebootingStr _RebootingStr A[15:15]kc
_Str4::
.byte 10,'B,'u,'t,'t,'o,'n,10,0
.dbsym e Str4 _Str4 A[9:9]kc
.area eeprom(rom, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
_Unit_ID::
.byte 0
.word 0,0,0,0,0
.word 0,0,0,0,0
.word 0,0,0,0,0
.byte 0
.dbsym e Unit_ID _Unit_ID A[32:32]c
_Unit_ID_crc::
.word 65535
.dbsym e Unit_ID_crc _Unit_ID_crc s
_ServerIP1::
.byte 0,0
.byte 0,0
.dbunion 0 4 TIPAddr
.dbfield 0 ip8 A[4:4]c
.dbfield 0 ip32 l
.dbend
.dbsym e ServerIP1 _ServerIP1 S[TIPAddr]
_ServerIP1_crc::
.word 65535
.dbsym e ServerIP1_crc _ServerIP1_crc s
_ServerIP2::
.byte 0,0
.byte 0,0
.dbsym e ServerIP2 _ServerIP2 S[TIPAddr]
_ServerIP2_crc::
.word 65535
.dbsym e ServerIP2_crc _ServerIP2_crc s
_ServerPhoneNum1::
.byte 0
.word 0,0,0,0,0
.word 0,0,0,0,0
.word 0,0,0,0,0
.byte 0
.dbsym e ServerPhoneNum1 _ServerPhoneNum1 A[32:32]c
_ServerPhoneNum1_crc::
.word 65535
.dbsym e ServerPhoneNum1_crc _ServerPhoneNum1_crc s
_ServerPhoneNum2::
.byte 0
.word 0,0,0,0,0
.word 0,0,0,0,0
.word 0,0,0,0,0
.byte 0
.dbsym e ServerPhoneNum2 _ServerPhoneNum2 A[32:32]c
_ServerPhoneNum2_crc::
.word 65535
.dbsym e ServerPhoneNum2_crc _ServerPhoneNum2_crc s
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
_LastResetReason::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e LastResetReason _LastResetReason c
_WatchdogCounter::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e WatchdogCounter _WatchdogCounter c
_Flags1::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e Flags1 _Flags1 c
_Flags2::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e Flags2 _Flags2 c
_TimerIntCounter::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e TimerIntCounter _TimerIntCounter c
_button_push::
.blkb 1
.area idata
.byte 255
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e button_push _button_push c
_MainBufferRd_Rx::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e MainBufferRd_Rx _MainBufferRd_Rx s
_MainBufferWr_Rx::
.blkb 2
.area idata
.word -1
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e MainBufferWr_Rx _MainBufferWr_Rx S
_MainBufferWr_Tx::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e MainBufferWr_Tx _MainBufferWr_Tx s
_UART0_RxBufferWr::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e UART0_RxBufferWr _UART0_RxBufferWr c
_UART0_RxBufferRd::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e UART0_RxBufferRd _UART0_RxBufferRd c
_UART1_RxBufferWr::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e UART1_RxBufferWr _UART1_RxBufferWr c
_UART1_RxBufferRd::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbsym e UART1_RxBufferRd _UART1_RxBufferRd c
.area text(rom, con, rel)
.dbfile C:\AVR\AT-Modem__PPP__UDP__IC\common.c
.dbfunc e _StackOverflowed __StackOverflowed fV
; c -> R20
.even
__StackOverflowed::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 232
;
; /*
; * Copyright (C) 2003-2004 by Clive Moss All rights reserved.
; *
; * Help & Contributions from D.J.Armstrong
;
; * Redistribution and use in source and binary forms, with or without
; * modification, are permitted provided that the following conditions
; * are met:
; *
; * 1. Redistributions of source code must retain the above copyright
; * notice, this list of conditions and the following disclaimer.
; * 2. Redistributions in binary form must reproduce the above copyright
; * notice, this list of conditions and the following disclaimer in the
; * documentation and/or other materials provided with the distribution.
; * 3. Neither the name of the copyright holders nor the names of
; * contributors may be used to endorse or promote products derived
; * from this software without specific prior written permission.
; *
; * THIS SOFTWARE IS PROVIDED BY CLIVE MOSS 'AS IS' AND ANY EXPRESS OR
; * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
; * ARE DISCLAIMED.
; * IN NO EVENT SHALL CLIVE MOSS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
; * INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
; * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
; * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
; * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
; * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
; * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
; * SUCH DAMAGE.
; */
;
; //#ifdef CPU_eZ8
; // #pragma stkck // enable stack checking
; //#endif
;
; #ifdef CPU_eZ8
; #include <eZ8.h>
; #endif
;
; #ifdef CPU_ATmega128
; #include <iom128v.h>
; #include <macros.h>
; #endif
;
; #include <string.h>
; #include <ctype.h>
; #include <stdio.h>
; #include <stdlib.h>
;
; #include "common.h"
; #include "fcs.h"
; #include "at.h"
; #include "ppp.h"
; #include "ip.h"
;
; #ifdef IncludeTCP
; #include "tcp.h"
; #endif
;
; #ifdef IncludeICMP
; #include "icmp.h"
; #endif
;
; #ifdef IncludeUDP
; #include "udp.h"
; #endif
;
; #ifdef IncludeNTP
; #include "ntp.h"
; #endif
;
; // *********************************************************************************
; // Flash constants
;
; flash char Str3[] = "\n#####\nRebooted .....\n\n";
;
; flash u16 Version = 0x0028; // version (BCD)
; flash char VersionStr[] = "Ver: v";
;
; flash char Title[] = "AT/PPP/ICMP/UDP/TCP by C.Moss\n";
; flash char Date[] = "5th Feb 2004\n";
;
; flash char HelpStr[] = "\n"
; " help or ? ........ guess\n"
; " ipconfig ......... display ip addresses\n"
; " dial ............. connect\n"
; " disc ............. disconnect\n"
; #ifdef Debug
; " debug off ........ debug messages off\n"
; " debug on ......... debug messages on\n"
; #endif
; #ifdef IncludeICMP
; " ping <ip> ........ ping\n"
; #endif
; #ifdef IncludeTCP
; " tcp <ip>[:port] .. tcp into a server\n"
; " tcp down ......... tcp disconnect\n"
; #endif
; #ifdef IncludeNTP
; " ntp <ip> ......... sync clock to ntp server\n"
; #endif
; #ifndef WindowsPPP
; " at<modem cmd> .... gets sent to modem\n"
; #endif
; " reboot ........... reboot!\n";
;
; #ifdef Debug
; flash char DebugMessagesStr1[] = "\n*** Debug Msgs: ";
; flash char DebugMessagesStr2[] = "off\n";
; flash char DebugMessagesStr3[] = "on\n";
; #endif
;
; flash char RebootingStr[] = "\nRebooting ..\n";
;
; #ifdef Debug
; flash char Str4[] = "\nButton\n";
; #endif
;
; // *********************************************************************************
; // EEPROM locations - 4096 bytes
; //
; // every entry must have it's own crc.
; // This means we don't loose the whole lot due to a single byte corruption - which would be
; // the case if we just crc error checked the entire eeprom in one go.
;
; #ifdef CPU_ATmega128
;
; #define Unit_ID_Len 32
; #define MaxPhoneNumLen 32
;
; #pragma data:eeprom
;
; char Unit_ID[Unit_ID_Len] = {""}; // Unit ID
; u16 Unit_ID_crc = 0xffff;
;
; T_IP_Addr ServerIP1 = {0, 0, 0, 0}; // primary server ip
; u16 ServerIP1_crc = 0xffff;
;
; T_IP_Addr ServerIP2 = {0, 0, 0, 0}; // seconday server ip
; u16 ServerIP2_crc = 0xffff;
;
; char ServerPhoneNum1[MaxPhoneNumLen] = {""}; // primary server phone number
; u16 ServerPhoneNum1_crc = 0xffff;
;
; char ServerPhoneNum2[MaxPhoneNumLen] = {""}; // secondary server phone number
; u16 ServerPhoneNum2_crc = 0xffff;
;
; #pragma data:data
;
; #endif
;
; // *********************************************************************************
;
; #ifdef CPU_eZ8
;
; near u8 LastResetReason = 0;
;
; volatile near u8 WatchdogCounter = 0;
;
; volatile near u8 Flags1 = 0;
; volatile near u8 Flags2 = 0;
;
; volatile near u8 TimerIntCounter = 0;
;
; volatile near u8 button_push = 255;
;
; volatile near u32 Random32;
;
; near u16 MainBufferRd_Rx = 0;
; near s16 MainBufferWr_Rx = -1;
; near u16 MainBufferWr_Tx = 0;
;
; volatile near u8 UART0_RxBuffer[32]; // UART-0 ring buffer
; volatile near u8 UART0_RxBufferWr = 0;
; volatile near u8 UART0_RxBufferRd = 0;
;
; volatile near u8 UART1_RxBuffer[96]; // UART-1 ring buffer
; volatile near u8 UART1_RxBufferWr = 0;
; volatile near u8 UART1_RxBufferRd = 0;
;
; #endif
;
; #ifdef CPU_ATmega128
;
; u8 LastResetReason = 0;
;
; volatile u8 WatchdogCounter = 0;
;
; volatile u8 Flags1 = 0;
; volatile u8 Flags2 = 0;
;
; volatile u8 TimerIntCounter = 0;
;
; volatile u8 button_push = 255;
;
; volatile u32 Random32;
;
; u16 MainBufferRd_Rx = 0;
; s16 MainBufferWr_Rx = -1;
; u16 MainBufferWr_Tx = 0;
;
; volatile u8 UART0_RxBuffer[32]; // UART-0 ring buffer
; volatile u8 UART0_RxBufferWr = 0;
; volatile u8 UART0_RxBufferRd = 0;
;
; volatile u8 UART1_RxBuffer[96]; // UART-1 ring buffer
; volatile u8 UART1_RxBufferWr = 0;
; volatile u8 UART1_RxBufferRd = 0;
;
; #endif
;
; volatile u16 ADC_Input[8]; // this is where the ADC input values are stored
;
; u8 CommandBuffer[32]; // console command buffer
; u8 ScratchPad[256]; // general usage buffer for strings etc
;
; //u8 MainBuffer[1550]; // must be big enough for the 1500 ppp/udp/tcp packets
; u8 MainBuffer[MainBufferSize]; // - sod that, we just aint got the ram
;
; // *********************************************************************************
; // macros
;
; #define BRG(freq, baud) ((unsigned long)(freq) / ((unsigned long)(baud) * 16))
;
; // *********************************************************************************
;
; #ifdef CPU_ATmega128
;
; void _StackOverflowed(char c)
; { // we end up here if a stack overflow occured - this replaces iccavr's routine
.dbline 234
;
; Disable_Ints();
cli
.dbline 235
; Reset_WD();
wdr
.dbline 241
;
; // c = 0 ... software stack overflow
; // c = 1 ... hardware stack overflow
;
; #ifdef Debug
; SendDebugStr("\n\n*** Stack Overflow\n"); // doubt if this will work - the stack is messed up :(
ldi R16,<L2
ldi R17,>L2
xcall _SendDebugStr
.dbline 244
L3:
.dbline 244
.dbline 244
.dbline 244
xjmp L3
X0:
.dbline -2
L1:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbend
.dbfunc e u16_Put _u16_Put fV
; savedSREG -> R20
; w -> R18,R19
; pnter -> R16,R17
.even
_u16_Put::
xcall push_gset1
.dbline -1
.dbline 254
; #endif
;
; for (;;); // infinate loop - let the watch dog reset us
; }
;
; #endif
;
; // **************************************************************************
; // saftly read multi-byte values from the executive that are modified by an interrupt.
; // at the moment, I'm just disabling global ints while I read/set the value - maybe not be the best way to go about this
;
; void u16_Put(volatile u16 *pnter, u16 w)
; {
.dbline 260
; #ifdef CPU_eZ8
; *pnter = w; // read the value
; #endif
;
; #ifdef CPU_ATmega128
; u8 savedSREG = SREG; // keep interrupt setting
in R20,0x3f
.dbline 261
; Disable_Ints(); //
cli
.dbline 262
; *pnter = w; // set the value
movw R30,R16
std z+1,R19
std z+0,R18
.dbline 263
; SREG = savedSREG; // restore interrupt setting
out 0x3f,R20
.dbline -2
L7:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r savedSREG 20 c
.dbsym r w 18 s
.dbsym r pnter 16 ps
.dbend
.dbfunc e u16_Get _u16_Get fs
; savedSREG -> R22
; w -> R20,R21
; pnter -> R16,R17
.even
_u16_Get::
xcall push_gset2
.dbline -1
.dbline 268
; #endif
; }
;
; u16 u16_Get(volatile u16 *pnter)
; {
.dbline 275
; #ifdef CPU_eZ8
; return *pnter; // read the value
; #endif
;
; #ifdef CPU_ATmega128
; u16 w;
; u8 savedSREG = SREG; // keep interrupt setting
in R22,0x3f
.dbline 276
; Disable_Ints(); //
cli
.dbline 277
; w = *pnter; // read the value
movw R30,R16
ldd R20,z+0
ldd R21,z+1
.dbline 278
; SREG = savedSREG; // restore interrupt setting
out 0x3f,R22
.dbline 279
; return w; //
movw R16,R20
.dbline -2
L8:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r savedSREG 22 c
.dbsym r w 20 s
.dbsym r pnter 16 ps
.dbend
.dbfunc e s16_Get _s16_Get fS
; savedSREG -> R22
; i -> R20,R21
; pnter -> R16,R17
.even
_s16_Get::
xcall push_gset2
.dbline -1
.dbline 284
; #endif
; }
;
; s16 s16_Get(volatile s16 *pnter)
; {
.dbline 291
; #ifdef CPU_eZ8
; return *pnter; // read the value
; #endif
;
; #ifdef CPU_ATmega128
; s16 i;
; u8 savedSREG = SREG; // keep interrupt setting
in R22,0x3f
.dbline 292
; Disable_Ints(); //
cli
.dbline 293
; i = *pnter; // read the value
movw R30,R16
ldd R20,z+0
ldd R21,z+1
.dbline 294
; SREG = savedSREG; // restore interrupt setting
out 0x3f,R22
.dbline 295
; return i; //
movw R16,R20
.dbline -2
L9:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r savedSREG 22 c
.dbsym r i 20 S
.dbsym r pnter 16 pS
.dbend
.dbfunc e u32_Put _u32_Put fV
; savedSREG -> R20
; dw -> y+2
; pnter -> R16,R17
.even
_u32_Put::
st -y,r19
st -y,r18
xcall push_gset1
.dbline -1
.dbline 300
; #endif
; }
;
; void u32_Put(volatile u32 *pnter, u32 dw)
; {
.dbline 306
; #ifdef CPU_eZ8
; *pnter = dw; // set the value
; #endif
;
; #ifdef CPU_ATmega128
; u8 savedSREG = SREG; // keep interrupt setting
in R20,0x3f
.dbline 307
; Disable_Ints(); //
cli
.dbline 308
; *pnter = dw; // set the value
movw R30,R28
ldd R2,z+2
ldd R3,z+3
ldd R4,z+4
ldd R5,z+5
movw R30,R16
std z+0,R2
std z+1,R3
std z+2,R4
std z+3,R5
.dbline 309
; SREG = savedSREG; // restore interrupt setting
out 0x3f,R20
.dbline -2
L10:
xcall pop_gset1
adiw R28,2
.dbline 0 ; func end
ret
.dbsym r savedSREG 20 c
.dbsym l dw 2 l
.dbsym r pnter 16 pl
.dbend
.dbfunc e u32_Get _u32_Get fl
; savedSREG -> R20
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -