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

📄 uip_arp.lis

📁 uIP是免费的TCP/IP协议栈,我们将它移植到我们的AVR以太网开发板中
💻 LIS
📖 第 1 页 / 共 4 页
字号:
 02CC                   .dbline 247
 02CC           ;      (uip_hostaddr[1] & uip_arp_netmask[1])) {
 02CC                   .dbline 248
 02CC           ;     return;
 02CC 05C0              xjmp L42
 02CE           L46:
 02CE                   .dbline 250
 02CE           ;   }
 02CE           ;   uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));
 02CE 20E0              ldi R18,<_uip_buf+6
 02D0 30E0              ldi R19,>_uip_buf+6
 02D2 00E0              ldi R16,<_uip_buf+26
 02D4 10E0              ldi R17,>_uip_buf+26
 02D6 F3DE              xcall _uip_arp_update
 02D8                   .dbline 252
 02D8           ;   
 02D8           ;   return;
 02D8                   .dbline -2
 02D8           L42:
 02D8                   .dbline 0 ; func end
 02D8 0895              ret
 02DA                   .dbend
 02DA                   .dbfunc e uip_arp_arpin _uip_arp_arpin fV
                        .even
 02DA           _uip_arp_arpin::
 02DA 2297              sbiw R28,2
 02DC                   .dbline -1
 02DC                   .dbline 279
 02DC           ; }
 02DC           ; /*-----------------------------------------------------------------------------------*/
 02DC           ; /**
 02DC           ;  * ARP processing for incoming ARP packets.
 02DC           ;  *
 02DC           ;  * This function should be called by the device driver when an ARP
 02DC           ;  * packet has been received. The function will act differently
 02DC           ;  * depending on the ARP packet type: if it is a reply for a request
 02DC           ;  * that we previously sent out, the ARP cache will be filled in with
 02DC           ;  * the values from the ARP reply. If the incoming ARP packet is an ARP
 02DC           ;  * request for our IP address, an ARP reply packet is created and put
 02DC           ;  * into the uip_buf[] buffer.
 02DC           ;  *
 02DC           ;  * When the function returns, the value of the global variable uip_len
 02DC           ;  * indicates whether the device driver should send out a packet or
 02DC           ;  * not. If uip_len is zero, no packet should be sent. If uip_len is
 02DC           ;  * non-zero, it contains the length of the outbound packet that is
 02DC           ;  * present in the uip_buf[] buffer.
 02DC           ;  *
 02DC           ;  * This function expects an ARP packet with a prepended Ethernet
 02DC           ;  * header in the uip_buf[] buffer, and the length of the packet in the
 02DC           ;  * global variable uip_len.
 02DC           ;  */
 02DC           ; /*-----------------------------------------------------------------------------------*/
 02DC           ; void
 02DC           ; uip_arp_arpin(void)
 02DC           ; {
 02DC                   .dbline 281
 02DC           ; 
 02DC           ;   if(uip_len < sizeof(struct arp_hdr)) {
 02DC 80910000          lds R24,_uip_len
 02E0 90910100          lds R25,_uip_len+1
 02E4 8A32              cpi R24,42
 02E6 E0E0              ldi R30,0
 02E8 9E07              cpc R25,R30
 02EA 38F4              brsh L56
 02EC                   .dbline 281
 02EC                   .dbline 282
 02EC           ;     uip_len = 0;
 02EC 2224              clr R2
 02EE 3324              clr R3
 02F0 30920100          sts _uip_len+1,R3
 02F4 20920000          sts _uip_len,R2
 02F8                   .dbline 283
 02F8           ;     return;
 02F8 B1C0              xjmp L55
 02FA           L56:
 02FA                   .dbline 286
 02FA           ;   }
 02FA           ; 
 02FA           ;   uip_len = 0;
 02FA 2224              clr R2
 02FC 3324              clr R3
 02FE 30920100          sts _uip_len+1,R3
 0302 20920000          sts _uip_len,R2
 0306                   .dbline 288
 0306           ;   
 0306           ;   switch(BUF->opcode) {
 0306 80911400          lds R24,_uip_buf+20
 030A 90911500          lds R25,_uip_buf+20+1
 030E 8030              cpi R24,0
 0310 E1E0              ldi R30,1
 0312 9E07              cpc R25,R30
 0314 79F0              breq L61
 0316 8030              cpi R24,0
 0318 E1E0              ldi R30,1
 031A 9E07              cpc R25,R30
 031C 0CF4              brge X8
 031E 9EC0              xjmp L55
 0320           X8:
 0320           L94:
 0320 80911400          lds R24,_uip_buf+20
 0324 90911500          lds R25,_uip_buf+20+1
 0328 8030              cpi R24,0
 032A E2E0              ldi R30,2
 032C 9E07              cpc R25,R30
 032E 09F4              brne X9
 0330 78C0              xjmp L85
 0332           X9:
 0332 94C0              xjmp L55
 0334           X7:
 0334                   .dbline 288
 0334           L61:
 0334                   .dbline 292
 0334           ;   case HTONS(ARP_REQUEST):
 0334           ;     /* ARP request. If it asked for our address, we send out a
 0334           ;        reply. */
 0334           ;     if(BUF->dipaddr[0] == uip_hostaddr[0] &&
 0334 E0E0              ldi R30,<_uip_hostaddr
 0336 F0E0              ldi R31,>_uip_hostaddr
 0338 0590              lpm R0,Z+
 033A 1490              lpm R1,Z
 033C F001              movw R30,R0
 033E 20902600          lds R2,_uip_buf+38
 0342 30902700          lds R3,_uip_buf+38+1
 0346 2E16              cp R2,R30
 0348 3F06              cpc R3,R31
 034A 09F0              breq X10
 034C 87C0              xjmp L55
 034E           X10:
 034E E0E0              ldi R30,<_uip_hostaddr+2
 0350 F0E0              ldi R31,>_uip_hostaddr+2
 0352 0590              lpm R0,Z+
 0354 1490              lpm R1,Z
 0356 F001              movw R30,R0
 0358 20902800          lds R2,_uip_buf+38+2
 035C 30902900          lds R3,_uip_buf+38+2+1
 0360 2E16              cp R2,R30
 0362 3F06              cpc R3,R31
 0364 09F0              breq X11
 0366 7AC0              xjmp L55
 0368           X11:
 0368                   .dbline 293
 0368           ;        BUF->dipaddr[1] == uip_hostaddr[1]) {
 0368                   .dbline 295
 0368           ;       /* The reply opcode is 2. */
 0368           ;       BUF->opcode = HTONS(2);
 0368 80E0              ldi R24,512
 036A 92E0              ldi R25,2
 036C 90931500          sts _uip_buf+20+1,R25
 0370 80931400          sts _uip_buf+20,R24
 0374                   .dbline 297
 0374           ; 
 0374           ;       memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
 0374 86E0              ldi R24,6
 0376 90E0              ldi R25,0
 0378 9983              std y+1,R25
 037A 8883              std y+0,R24
 037C 20E0              ldi R18,<_uip_buf+22
 037E 30E0              ldi R19,>_uip_buf+22
 0380 00E0              ldi R16,<_uip_buf+32
 0382 10E0              ldi R17,>_uip_buf+32
 0384 0E940000          xcall _memcpy
 0388                   .dbline 298
 0388           ;       memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
 0388 86E0              ldi R24,6
 038A 90E0              ldi R25,0
 038C 9983              std y+1,R25
 038E 8883              std y+0,R24
 0390 20E0              ldi R18,<_uip_ethaddr
 0392 30E0              ldi R19,>_uip_ethaddr
 0394 00E0              ldi R16,<_uip_buf+22
 0396 10E0              ldi R17,>_uip_buf+22
 0398 0E940000          xcall _memcpy
 039C                   .dbline 299
 039C           ;       memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
 039C 86E0              ldi R24,6
 039E 90E0              ldi R25,0
 03A0 9983              std y+1,R25
 03A2 8883              std y+0,R24
 03A4 20E0              ldi R18,<_uip_ethaddr
 03A6 30E0              ldi R19,>_uip_ethaddr
 03A8 00E0              ldi R16,<_uip_buf+6
 03AA 10E0              ldi R17,>_uip_buf+6
 03AC 0E940000          xcall _memcpy
 03B0                   .dbline 300
 03B0           ;       memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
 03B0 86E0              ldi R24,6
 03B2 90E0              ldi R25,0
 03B4 9983              std y+1,R25
 03B6 8883              std y+0,R24
 03B8 20E0              ldi R18,<_uip_buf+32
 03BA 30E0              ldi R19,>_uip_buf+32
 03BC 00E0              ldi R16,<_uip_buf
 03BE 10E0              ldi R17,>_uip_buf
 03C0 0E940000          xcall _memcpy
 03C4                   .dbline 302
 03C4           ;       
 03C4           ;       BUF->dipaddr[0] = BUF->sipaddr[0];
 03C4 20901C00          lds R2,_uip_buf+28
 03C8 30901D00          lds R3,_uip_buf+28+1
 03CC 30922700          sts _uip_buf+38+1,R3
 03D0 20922600          sts _uip_buf+38,R2
 03D4                   .dbline 303
 03D4           ;       BUF->dipaddr[1] = BUF->sipaddr[1];
 03D4 20901E00          lds R2,_uip_buf+28+2
 03D8 30901F00          lds R3,_uip_buf+28+2+1
 03DC 30922900          sts _uip_buf+38+2+1,R3
 03E0 20922800          sts _uip_buf+38+2,R2
 03E4                   .dbline 304
 03E4           ;       BUF->sipaddr[0] = uip_hostaddr[0];
 03E4 E0E0              ldi R30,<_uip_hostaddr
 03E6 F0E0              ldi R31,>_uip_hostaddr
 03E8 0590              lpm R0,Z+
 03EA 1490              lpm R1,Z
 03EC F001              movw R30,R0
 03EE F0931D00          sts _uip_buf+28+1,R31
 03F2 E0931C00          sts _uip_buf+28,R30
 03F6                   .dbline 305
 03F6           ;       BUF->sipaddr[1] = uip_hostaddr[1];
 03F6 E0E0              ldi R30,<_uip_hostaddr+2
 03F8 F0E0              ldi R31,>_uip_hostaddr+2
 03FA 0590              lpm R0,Z+
 03FC 1490              lpm R1,Z
 03FE F001              movw R30,R0
 0400 F0931F00          sts _uip_buf+28+2+1,R31
 0404 E0931E00          sts _uip_buf+28+2,R30
 0408                   .dbline 307
 0408           ; 
 0408           ;       BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);      
 0408 88E0              ldi R24,1544
 040A 96E0              ldi R25,6
 040C 90930D00          sts _uip_buf+12+1,R25
 0410 80930C00          sts _uip_buf+12,R24
 0414                   .dbline 308
 0414           ;       uip_len = sizeof(struct arp_hdr);
 0414 8AE2              ldi R24,42
 0416 90E0              ldi R25,0
 0418 90930100          sts _uip_len+1,R25
 041C 80930000          sts _uip_len,R24
 0420                   .dbline 309
 0420           ;     }      
 0420                   .dbline 310
 0420           ;     break;
 0420 1DC0              xjmp L55
 0422           L85:
 0422                   .dbline 314
 0422           ;   case HTONS(ARP_REPLY):
 0422           ;     /* ARP reply. We insert or update the ARP table if it was meant
 0422           ;        for us. */
 0422           ;     if(BUF->dipaddr[0] == uip_hostaddr[0] &&
 0422 E0E0              ldi R30,<_uip_hostaddr
 0424 F0E0              ldi R31,>_uip_hostaddr
 0426 0590              lpm R0,Z+
 0428 1490              lpm R1,Z
 042A F001              movw R30,R0
 042C 20902600          lds R2,_uip_buf+38
 0430 30902700          lds R3,_uip_buf+38+1
 0434 2E16              cp R2,R30
 0436 3F06              cpc R3,R31
 0438 89F4              brne L55
 043A E0E0              ldi R30,<_uip_hostaddr+2
 043C F0E0              ldi R31,>_uip_hostaddr+2
 043E 0590              lpm R0,Z+
 0440 1490              lpm R1,Z
 0442 F001              movw R30,R0
 0444 20902800          lds R2,_uip_buf+38+2
 0448 30902900          lds R3,_uip_buf+38+2+1
 044C 2E16              cp R2,R30
 044E 3F06              cpc R3,R31
 0450 29F4              brne L55
 0452                   .dbline 315
 0452           ;        BUF->dipaddr[1] == uip_hostaddr[1]) {
 0452                   .dbline 317
 0452           ; 
 0452           ;       uip_arp_update(BUF->sipaddr, &BUF->shwaddr);
 0452 20E0              ldi R18,<_uip_buf+22
 0454 30E0              ldi R19,>_uip_buf+22
 0456 00E0              ldi R16,<_uip_buf+28
 0458 10E0              ldi R17,>_uip_buf+28
 045A 31DE              xcall _uip_arp_update
 045C                   .dbline 318
 045C           ;     }
 045C                   .dbline 319
 045C           ;     break;
 045C                   .dbline 322
 045C           ;   }
 045C           ; 
 045C           ;   return;
 045C                   .dbline -2
 045C           L55:
 045C 2296              adiw R28,2
 045E                   .dbline 0 ; func end
 045E 0895              ret
 0460                   .dbend
 0460                   .dbfunc e uip_arp_out _uip_arp_out fV
 0460           ;         tabptr -> R10,R11
                        .even
 0460           _uip_arp_out::
 0460 0E940000          xcall push_gset3x
 0464 2297              sbiw R28,2
 0466                   .dbline -1
 0466                   .dbline 354
 0466           ; }
 0466           ; /*-----------------------------------------------------------------------------------*/
 0466           ; /**
 0466           ;  * Prepend Ethernet header to an outbound IP packet and see if we need
 0466           ;  * to send out an ARP request.
 0466           ;  *
 0466           ;  * This function should be called before sending out an IP packet. The
 0466           ;  * function checks the destination IP address of the IP packet to see
 0466           ;  * what Ethernet MAC address that should be used as a destination MAC
 0466           ;  * address on the Ethernet.
 0466           ;  *
 0466           ;  * If the destination IP address is in the local network (determined
 0466           ;  * by logical ANDing of netmask and our IP address), the function
 0466           ;  * checks the ARP cache to see if an entry for the destination IP
 0466           ;  * address is found. If so, an Ethernet header is prepended and the
 0466           ;  * function returns. If no ARP cache entry is found for the
 0466           ;  * destination IP address, the packet in the uip_buf[] is replaced by
 0466           ;  * an ARP request packet for the IP address. The IP packet is dropped
 0466           ;  * and it is assumed that they higher level protocols (e.g., TCP)
 0466           ;  * eventually will retransmit the dropped packet.
 0466           ;  *
 0466           ;  * If the destination IP address is not on the local network, the IP
 0466           ;  * address of the default router is used instead.
 0466           ;  *
 0466           ;  * When the function returns, a packet is present in the uip_buf[]
 0466           ;  * buffer, and the length of the packet is in the global variable
 0466           ;  * uip_len.
 0466           ;  */
 0466           ; /*-----------------------------------------------------------------------------------*/
 0466           ; void
 0466           ; uip_arp_out(void)
 0466           ; {
 0466                   .dbline 364
 0466           ;   struct arp_entry *tabptr;
 0466           ;   /* Find the destination IP address in the ARP table and construct
 0466           ;      the Ethernet header. If the destination IP addres isn't on the
 0466           ;      local network, we use the default router's IP address instead.
 0466           ; 
 0466           ;      If not ARP table entry is found, we overwrite the original IP
 0466           ;      packet with an ARP request for the IP address. */
 0466           ; 
 0466           ;   /* Check if the destination address is on the local network. */
 0466           ;   if((IPBUF->destipaddr[0] & uip_arp_netmask[0]) !=
 0466 E0E0              ldi R30,<_uip_arp_netmask
 0468 F0E0              ldi R31,>_uip_arp_netmask
 046A 0590              lpm R0,Z+
 046C 1490              lpm R1,Z
 046E F001              movw R30,R0
 0470 A0E0              ldi R26,<_uip_hostaddr
 0472 B0E0              ldi R27,>_uip_hostaddr
 0474 FA93              st -y,R31
 0476 EA93              st -y,R30
 0478 FD01              movw R30,R26

⌨️ 快捷键说明

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