📄 udp.lis
字号:
.module udp.c
.area lit(rom, con, rel)
0000 _udp_str1::
0000 202020205544504864723A2053726350 .byte 32,32,32,32,'U,'D,'P,'H,'d,'r,58,32,'S,'r,'c,'P
0010 72743A00 .byte 'r,'t,58,0
0014 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\udp.c
0014 .dbsym e udp_str1 _udp_str1 A[20:20]kc
0014 _udp_str2::
0014 20446573745072743A00 .byte 32,'D,'e,'s,'t,'P,'r,'t,58,0
001E .dbsym e udp_str2 _udp_str2 A[10:10]kc
001E _udp_str3::
001E 204C656E3A00 .byte 32,'L,'e,'n,58,0
0024 .dbsym e udp_str3 _udp_str3 A[6:6]kc
0024 _udp_str4::
0024 2043686B73756D3A00 .byte 32,'C,'h,'k,'s,'u,'m,58,0
002D .dbsym e udp_str4 _udp_str4 A[9:9]kc
002D _udp_str5::
002D 204461746142797465733A00 .byte 32,'D,'a,'t,'a,'B,'y,'t,'e,'s,58,0
0039 .dbsym e udp_str5 _udp_str5 A[12:12]kc
0039 _udp_str6::
0039 202D20424C4F434B45440A00 .byte 32,45,32,'B,'L,'O,'C,'K,'E,'D,10,0
0045 .dbsym e udp_str6 _udp_str6 A[12:12]kc
0045 _udp_str7::
0045 2A2A2A205544502063686B73756D2065 .byte 42,42,42,32,'U,'D,'P,32,'c,'h,'k,'s,'u,'m,32,'e
0055 72720A00 .byte 'r,'r,10,0
0059 .dbsym e udp_str7 _udp_str7 A[20:20]kc
.area data(ram, con, rel)
0000 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\udp.c
0000 _UDP_Header::
0000 .blkb 2
.area idata
0000 0000 .word 0
.area data(ram, con, rel)
0002 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\udp.c
0002 .dbstruct 0 8 TUDPHeader
0002 .dbfield 0 SourcePort s
0002 .dbfield 2 DestPort s
0002 .dbfield 4 Length s
0002 .dbfield 6 Checksum s
0002 .dbend
0002 .dbsym e UDP_Header _UDP_Header pS[TUDPHeader]
.area text(rom, con, rel)
0000 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\udp.c
0000 .dbfunc e UDP_DisplayHeader _UDP_DisplayHeader fV
0000 ; TotalBytes -> R20,R21
0000 ; HeaderIdx -> R22,R23
.even
0000 _UDP_DisplayHeader::
0000 0E940000 xcall push_gset2
0004 A901 movw R20,R18
0006 B801 movw R22,R16
0008 2297 sbiw R28,2
000A .dbline -1
000A .dbline 74
000A ;
000A ; /*
000A ; * Copyright (C) 2003-2004 by Clive Moss All rights reserved.
000A ; *
000A ; * Help & Contributions from D.J.Armstrong
000A ;
000A ; * Redistribution and use in source and binary forms, with or without
000A ; * modification, are permitted provided that the following conditions
000A ; * are met:
000A ; *
000A ; * 1. Redistributions of source code must retain the above copyright
000A ; * notice, this list of conditions and the following disclaimer.
000A ; * 2. Redistributions in binary form must reproduce the above copyright
000A ; * notice, this list of conditions and the following disclaimer in the
000A ; * documentation and/or other materials provided with the distribution.
000A ; * 3. Neither the name of the copyright holders nor the names of
000A ; * contributors may be used to endorse or promote products derived
000A ; * from this software without specific prior written permission.
000A ; *
000A ; * THIS SOFTWARE IS PROVIDED BY CLIVE MOSS 'AS IS' AND ANY EXPRESS OR
000A ; * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
000A ; * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
000A ; * ARE DISCLAIMED.
000A ; * IN NO EVENT SHALL CLIVE MOSS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
000A ; * INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
000A ; * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
000A ; * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
000A ; * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
000A ; * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
000A ; * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
000A ; * SUCH DAMAGE.
000A ; */
000A ;
000A ; //#ifdef CPU_eZ8
000A ; // #pragma stkck // enable stack checking
000A ; //#endif
000A ; #include <iom128v.h>
000A ; #include <string.h>
000A ; #include <stdio.h>
000A ;
000A ; #include "common.h"
000A ; #include "ppp.h"
000A ; #include "ip.h"
000A ; #include "udp.h"
000A ;
000A ; #ifdef IncludeNTP
000A ; #include "ntp.h"
000A ; #endif
000A ;
000A ; #ifdef Debug
000A ; flash char udp_str1[] = " UDPHdr: SrcPrt:";
000A ; flash char udp_str2[] = " DestPrt:";
000A ; flash char udp_str3[] = " Len:";
000A ; flash char udp_str4[] = " Chksum:";
000A ; flash char udp_str5[] = " DataBytes:";
000A ; flash char udp_str6[] = " - BLOCKED\n";
000A ; flash char udp_str7[] = "*** UDP chksum err\n";
000A ; #endif
000A ;
000A ; #ifdef CPU_eZ8
000A ; near u16 UDP_len;
000A ; #endif
000A ; #ifdef CPU_ATmega128
000A ; u16 UDP_len;
000A ; #endif
000A ;
000A ; T_UDP_Header *UDP_Header = NULL;
000A ;
000A ; //*********************************************************************************************************************
000A ;
000A ; #ifdef Debug
000A ;
000A ; void UDP_DisplayHeader(int HeaderIdx, int TotalBytes)
000A ; {
000A .dbline 86
000A ; /*
000A ; 0 1 2 3
000A ; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
000A ; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
000A ; | Source Port | Destination Port |
000A ; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
000A ; | Length | Checksum |
000A ; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
000A ; */
000A ; // display the header
000A ;
000A ; if (!SendDebugRStr(udp_str1)) return;
000A 00E0 ldi R16,<_udp_str1
000C 10E0 ldi R17,>_udp_str1
000E 0E940000 xcall _SendDebugRStr
0012 0023 tst R16
0014 09F4 brne L2
0016 .dbline 86
0016 8BC0 xjmp L1
0018 L2:
0018 .dbline 87
0018 ; sprintf((char*)ScratchPad, "%u", ntohs(UDP_Header->SourcePort));
0018 E0910000 lds R30,_UDP_Header
001C F0910100 lds R31,_UDP_Header+1
0020 0081 ldd R16,z+0
0022 1181 ldd R17,z+1
0024 0E940000 xcall _ntohs
0028 1983 std y+1,R17
002A 0883 std y+0,R16
002C 20E0 ldi R18,<L4
002E 30E0 ldi R19,>L4
0030 00E0 ldi R16,<_ScratchPad
0032 10E0 ldi R17,>_ScratchPad
0034 0E940000 xcall _sprintf
0038 .dbline 88
0038 ; if (!SendDebugStr((char*)ScratchPad)) return;
0038 00E0 ldi R16,<_ScratchPad
003A 10E0 ldi R17,>_ScratchPad
003C 0E940000 xcall _SendDebugStr
0040 0023 tst R16
0042 09F4 brne L5
0044 .dbline 88
0044 74C0 xjmp L1
0046 L5:
0046 .dbline 90
0046 ;
0046 ; if (!SendDebugRStr(udp_str2)) return;
0046 00E0 ldi R16,<_udp_str2
0048 10E0 ldi R17,>_udp_str2
004A 0E940000 xcall _SendDebugRStr
004E 0023 tst R16
0050 09F4 brne L7
0052 .dbline 90
0052 6DC0 xjmp L1
0054 L7:
0054 .dbline 91
0054 ; sprintf((char*)ScratchPad, "%u", ntohs(UDP_Header->DestPort));
0054 E0910000 lds R30,_UDP_Header
0058 F0910100 lds R31,_UDP_Header+1
005C 0281 ldd R16,z+2
005E 1381 ldd R17,z+3
0060 0E940000 xcall _ntohs
0064 1983 std y+1,R17
0066 0883 std y+0,R16
0068 20E0 ldi R18,<L4
006A 30E0 ldi R19,>L4
006C 00E0 ldi R16,<_ScratchPad
006E 10E0 ldi R17,>_ScratchPad
0070 0E940000 xcall _sprintf
0074 .dbline 92
0074 ; if (!SendDebugStr((char*)ScratchPad)) return;
0074 00E0 ldi R16,<_ScratchPad
0076 10E0 ldi R17,>_ScratchPad
0078 0E940000 xcall _SendDebugStr
007C 0023 tst R16
007E 09F4 brne L9
0080 .dbline 92
0080 56C0 xjmp L1
0082 L9:
0082 .dbline 94
0082 ;
0082 ; if (!SendDebugRStr(udp_str3)) return;
0082 00E0 ldi R16,<_udp_str3
0084 10E0 ldi R17,>_udp_str3
0086 0E940000 xcall _SendDebugRStr
008A 0023 tst R16
008C 09F4 brne L11
008E .dbline 94
008E 4FC0 xjmp L1
0090 L11:
0090 .dbline 95
0090 ; sprintf((char*)ScratchPad, "%u", ntohs(UDP_Header->Length));
0090 E0910000 lds R30,_UDP_Header
0094 F0910100 lds R31,_UDP_Header+1
0098 0481 ldd R16,z+4
009A 1581 ldd R17,z+5
009C 0E940000 xcall _ntohs
00A0 1983 std y+1,R17
00A2 0883 std y+0,R16
00A4 20E0 ldi R18,<L4
00A6 30E0 ldi R19,>L4
00A8 00E0 ldi R16,<_ScratchPad
00AA 10E0 ldi R17,>_ScratchPad
00AC 0E940000 xcall _sprintf
00B0 .dbline 96
00B0 ; if (!SendDebugStr((char*)ScratchPad)) return;
00B0 00E0 ldi R16,<_ScratchPad
00B2 10E0 ldi R17,>_ScratchPad
00B4 0E940000 xcall _SendDebugStr
00B8 0023 tst R16
00BA 09F4 brne L13
00BC .dbline 96
00BC 38C0 xjmp L1
00BE L13:
00BE .dbline 98
00BE ;
00BE ; if (!SendDebugRStr(udp_str4)) return;
00BE 00E0 ldi R16,<_udp_str4
00C0 10E0 ldi R17,>_udp_str4
00C2 0E940000 xcall _SendDebugRStr
00C6 0023 tst R16
00C8 09F4 brne L15
00CA .dbline 98
00CA 31C0 xjmp L1
00CC L15:
00CC .dbline 99
00CC ; sprintf((char*)ScratchPad, "%04x", ntohs(UDP_Header->Checksum));
00CC E0910000 lds R30,_UDP_Header
00D0 F0910100 lds R31,_UDP_Header+1
00D4 0681 ldd R16,z+6
00D6 1781 ldd R17,z+7
00D8 0E940000 xcall _ntohs
00DC 1983 std y+1,R17
00DE 0883 std y+0,R16
00E0 20E0 ldi R18,<L17
00E2 30E0 ldi R19,>L17
00E4 00E0 ldi R16,<_ScratchPad
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -