mirror of
https://gitlab.com/dm38/padavan-ng.git
synced 2024-02-13 08:34:03 +08:00
uboot: code cleaning
This commit is contained in:
@ -93,6 +93,25 @@ tapdev_init(void)
|
|||||||
|
|
||||||
lasttime = 0;
|
lasttime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump_mem(int type, int len)
|
||||||
|
{
|
||||||
|
#if DUMP == 1
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < len; i++)
|
||||||
|
printf("%c", uip_buf[i]);
|
||||||
|
if(type)
|
||||||
|
{
|
||||||
|
printf("\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01");
|
||||||
|
printf("\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01");
|
||||||
|
} else {
|
||||||
|
printf("\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02");
|
||||||
|
printf("\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02");
|
||||||
|
}
|
||||||
|
fflush(stdout);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
unsigned int
|
unsigned int
|
||||||
tapdev_read(void)
|
tapdev_read(void)
|
||||||
@ -125,7 +144,7 @@ tapdev_read(void)
|
|||||||
}
|
}
|
||||||
gettimeofday(&tv, &tz);
|
gettimeofday(&tv, &tz);
|
||||||
lasttime += (tv.tv_sec - now.tv_sec) * 1000000 + (tv.tv_usec - now.tv_usec);
|
lasttime += (tv.tv_sec - now.tv_sec) * 1000000 + (tv.tv_usec - now.tv_usec);
|
||||||
|
dump_mem(0, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
@ -163,6 +182,8 @@ tapdev_send(void)
|
|||||||
ret = writev(fd, iov, 2);
|
ret = writev(fd, iov, 2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
dump_mem(1, ret);
|
||||||
|
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
perror("tap_dev: tapdev_send: writev");
|
perror("tap_dev: tapdev_send: writev");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -73,18 +73,18 @@ header fields and finally send the packet back to the peer.
|
|||||||
|
|
||||||
/* The IP address of this host. If it is defined to be fixed (by setting UIP_FIXEDADDR to 1 in uipopt.h), the address is set here. Otherwise, the address */
|
/* The IP address of this host. If it is defined to be fixed (by setting UIP_FIXEDADDR to 1 in uipopt.h), the address is set here. Otherwise, the address */
|
||||||
#if UIP_FIXEDADDR > 0
|
#if UIP_FIXEDADDR > 0
|
||||||
const u16_t uip_hostaddr[2] =
|
const unsigned short int uip_hostaddr[2] =
|
||||||
{HTONS((UIP_IPADDR0 << 8) | UIP_IPADDR1),
|
{HTONS((UIP_IPADDR0 << 8) | UIP_IPADDR1),
|
||||||
HTONS((UIP_IPADDR2 << 8) | UIP_IPADDR3)};
|
HTONS((UIP_IPADDR2 << 8) | UIP_IPADDR3)};
|
||||||
const u16_t uip_arp_draddr[2] =
|
const unsigned short int uip_arp_draddr[2] =
|
||||||
{HTONS((UIP_DRIPADDR0 << 8) | UIP_DRIPADDR1),
|
{HTONS((UIP_DRIPADDR0 << 8) | UIP_DRIPADDR1),
|
||||||
HTONS((UIP_DRIPADDR2 << 8) | UIP_DRIPADDR3)};
|
HTONS((UIP_DRIPADDR2 << 8) | UIP_DRIPADDR3)};
|
||||||
const u16_t uip_arp_netmask[2] =
|
const unsigned short int uip_arp_netmask[2] =
|
||||||
{HTONS((UIP_NETMASK0 << 8) | UIP_NETMASK1),
|
{HTONS((UIP_NETMASK0 << 8) | UIP_NETMASK1),
|
||||||
HTONS((UIP_NETMASK2 << 8) | UIP_NETMASK3)};
|
HTONS((UIP_NETMASK2 << 8) | UIP_NETMASK3)};
|
||||||
#else
|
#else
|
||||||
u16_t uip_hostaddr[2];
|
unsigned short int uip_hostaddr[2];
|
||||||
u16_t uip_arp_draddr[2], uip_arp_netmask[2];
|
unsigned short int uip_arp_draddr[2], uip_arp_netmask[2];
|
||||||
#endif /* UIP_FIXEDADDR */
|
#endif /* UIP_FIXEDADDR */
|
||||||
|
|
||||||
u8_t uip_buf[UIP_BUFSIZE+2]; /* The packet buffer that contains
|
u8_t uip_buf[UIP_BUFSIZE+2]; /* The packet buffer that contains
|
||||||
@ -100,7 +100,7 @@ volatile u8_t *uip_urgdata; /* The uip_urgdata pointer points to
|
|||||||
volatile u8_t uip_urglen, uip_surglen;
|
volatile u8_t uip_urglen, uip_surglen;
|
||||||
#endif /* UIP_URGDATA > 0 */
|
#endif /* UIP_URGDATA > 0 */
|
||||||
|
|
||||||
volatile u16_t uip_len, uip_slen;
|
volatile unsigned short int uip_len, uip_slen;
|
||||||
/* The uip_len is either 8 or 16 bits,
|
/* The uip_len is either 8 or 16 bits,
|
||||||
depending on the maximum packet
|
depending on the maximum packet
|
||||||
size. */
|
size. */
|
||||||
@ -114,7 +114,7 @@ struct uip_conn *uip_conn; /* uip_conn always points to the current
|
|||||||
struct uip_conn uip_conns[UIP_CONNS];
|
struct uip_conn uip_conns[UIP_CONNS];
|
||||||
/* The uip_conns array holds all TCP
|
/* The uip_conns array holds all TCP
|
||||||
connections. */
|
connections. */
|
||||||
u16_t uip_listenports[UIP_LISTENPORTS];
|
unsigned short int uip_listenports[UIP_LISTENPORTS];
|
||||||
/* The uip_listenports list all currently
|
/* The uip_listenports list all currently
|
||||||
listning ports. */
|
listning ports. */
|
||||||
#if UIP_UDP
|
#if UIP_UDP
|
||||||
@ -123,7 +123,7 @@ struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
|
|||||||
#endif /* UIP_UDP */
|
#endif /* UIP_UDP */
|
||||||
|
|
||||||
|
|
||||||
static u16_t ipid; /* Ths ipid variable is an increasing
|
static unsigned short int ipid; /* Ths ipid variable is an increasing
|
||||||
number that is used for the IP ID
|
number that is used for the IP ID
|
||||||
field. */
|
field. */
|
||||||
|
|
||||||
@ -131,14 +131,14 @@ static u8_t iss[4]; /* The iss variable is used for the TCP
|
|||||||
initial sequence number. */
|
initial sequence number. */
|
||||||
|
|
||||||
#if UIP_ACTIVE_OPEN
|
#if UIP_ACTIVE_OPEN
|
||||||
static u16_t lastport; /* Keeps track of the last port used for
|
static unsigned short int lastport; /* Keeps track of the last port used for
|
||||||
a new connection. */
|
a new connection. */
|
||||||
#endif /* UIP_ACTIVE_OPEN */
|
#endif /* UIP_ACTIVE_OPEN */
|
||||||
|
|
||||||
/* Temporary variables. */
|
/* Temporary variables. */
|
||||||
volatile u8_t uip_acc32[4];
|
volatile u8_t uip_acc32[4];
|
||||||
static u8_t c, opt;
|
static u8_t c, opt;
|
||||||
static u16_t tmp16;
|
static unsigned short int tmp16;
|
||||||
|
|
||||||
/* Structures and definitions. */
|
/* Structures and definitions. */
|
||||||
#define TCP_FIN 0x01
|
#define TCP_FIN 0x01
|
||||||
@ -166,11 +166,10 @@ struct uip_stats uip_stat;
|
|||||||
#endif /* UIP_STATISTICS == 1 */
|
#endif /* UIP_STATISTICS == 1 */
|
||||||
|
|
||||||
#if UIP_LOGGING == 1
|
#if UIP_LOGGING == 1
|
||||||
#include <stdio.h>
|
extern void puts(const char *s);
|
||||||
void uip_log(char *msg);
|
#define UIP_LOG(m) puts(m)
|
||||||
#define UIP_LOG(m) uip_log(m)
|
|
||||||
#else
|
#else
|
||||||
#define UIP_LOG( m )
|
#define UIP_LOG(m)
|
||||||
#endif /* UIP_LOGGING == 1 */
|
#endif /* UIP_LOGGING == 1 */
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
@ -203,7 +202,7 @@ uip_init(void)
|
|||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
#if UIP_ACTIVE_OPEN
|
#if UIP_ACTIVE_OPEN
|
||||||
struct uip_conn *
|
struct uip_conn *
|
||||||
uip_connect(u16_t *ripaddr, u16_t rport)
|
uip_connect(unsigned short int *ripaddr, unsigned short int rport)
|
||||||
{
|
{
|
||||||
register struct uip_conn *conn, *cconn;
|
register struct uip_conn *conn, *cconn;
|
||||||
|
|
||||||
@ -271,7 +270,7 @@ uip_connect(u16_t *ripaddr, u16_t rport)
|
|||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
#if UIP_UDP
|
#if UIP_UDP
|
||||||
struct uip_udp_conn *
|
struct uip_udp_conn *
|
||||||
uip_udp_new(u16_t *ripaddr, u16_t rport)
|
uip_udp_new(unsigned short int *ripaddr, unsigned short int rport)
|
||||||
{
|
{
|
||||||
register struct uip_udp_conn *conn;
|
register struct uip_udp_conn *conn;
|
||||||
|
|
||||||
@ -312,7 +311,7 @@ uip_udp_new(u16_t *ripaddr, u16_t rport)
|
|||||||
#endif /* UIP_UDP */
|
#endif /* UIP_UDP */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uip_unlisten(u16_t port)
|
uip_unlisten(unsigned short int port)
|
||||||
{
|
{
|
||||||
for(c = 0; c < UIP_LISTENPORTS; ++c) {
|
for(c = 0; c < UIP_LISTENPORTS; ++c) {
|
||||||
if(uip_listenports[c] == port) {
|
if(uip_listenports[c] == port) {
|
||||||
@ -323,7 +322,7 @@ uip_unlisten(u16_t port)
|
|||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uip_listen(u16_t port)
|
uip_listen(unsigned short int port)
|
||||||
{
|
{
|
||||||
for(c = 0; c < UIP_LISTENPORTS; ++c) {
|
for(c = 0; c < UIP_LISTENPORTS; ++c) {
|
||||||
if(uip_listenports[c] == 0) {
|
if(uip_listenports[c] == 0) {
|
||||||
@ -341,7 +340,7 @@ static u8_t uip_reassbuf[UIP_REASS_BUFSIZE];
|
|||||||
static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
|
static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];
|
||||||
static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,
|
static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,
|
||||||
0x0f, 0x07, 0x03, 0x01};
|
0x0f, 0x07, 0x03, 0x01};
|
||||||
static u16_t uip_reasslen;
|
static unsigned short int uip_reasslen;
|
||||||
static u8_t uip_reassflags;
|
static u8_t uip_reassflags;
|
||||||
#define UIP_REASS_FLAG_LASTFRAG 0x01
|
#define UIP_REASS_FLAG_LASTFRAG 0x01
|
||||||
static u8_t uip_reasstmr;
|
static u8_t uip_reasstmr;
|
||||||
@ -352,8 +351,8 @@ static u8_t uip_reasstmr;
|
|||||||
static u8_t
|
static u8_t
|
||||||
uip_reass(void)
|
uip_reass(void)
|
||||||
{
|
{
|
||||||
u16_t offset, len;
|
unsigned short int offset, len;
|
||||||
u16_t i;
|
unsigned short int i;
|
||||||
|
|
||||||
/* If ip_reasstmr is zero, no packet is present in the buffer, so we
|
/* If ip_reasstmr is zero, no packet is present in the buffer, so we
|
||||||
write the IP header of the fragment into the reassembly
|
write the IP header of the fragment into the reassembly
|
||||||
@ -467,7 +466,7 @@ uip_reass(void)
|
|||||||
#endif /* UIP_REASSEMBL */
|
#endif /* UIP_REASSEMBL */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
uip_add_rcv_nxt(u16_t n)
|
uip_add_rcv_nxt(unsigned short int n)
|
||||||
{
|
{
|
||||||
uip_add32(uip_conn->rcv_nxt, n);
|
uip_add32(uip_conn->rcv_nxt, n);
|
||||||
uip_conn->rcv_nxt[0] = uip_acc32[0];
|
uip_conn->rcv_nxt[0] = uip_acc32[0];
|
||||||
@ -693,7 +692,7 @@ uip_process(u8_t flag)
|
|||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
// icmp_input:
|
//icmp_input:
|
||||||
UIP_STAT(++uip_stat.icmp.recv);
|
UIP_STAT(++uip_stat.icmp.recv);
|
||||||
|
|
||||||
/* ICMP echo (i.e., ping) processing. This is simple, we only change
|
/* ICMP echo (i.e., ping) processing. This is simple, we only change
|
||||||
@ -978,8 +977,8 @@ uip_process(u8_t flag)
|
|||||||
} else if(opt == 0x02 &&
|
} else if(opt == 0x02 &&
|
||||||
uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0x04) {
|
uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0x04) {
|
||||||
/* An MSS option with the right option length. */
|
/* An MSS option with the right option length. */
|
||||||
tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
|
tmp16 = ((unsigned short int)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
|
||||||
(u16_t)uip_buf[40 + UIP_LLH_LEN + 3 + c];
|
(unsigned short int)uip_buf[40 + UIP_LLH_LEN + 3 + c];
|
||||||
uip_connr->initialmss = uip_connr->mss =
|
uip_connr->initialmss = uip_connr->mss =
|
||||||
tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
|
tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
|
||||||
|
|
||||||
@ -1249,7 +1248,7 @@ uip_process(u8_t flag)
|
|||||||
and the application will retransmit it. This is called the
|
and the application will retransmit it. This is called the
|
||||||
"persistent timer" and uses the retransmission mechanim.
|
"persistent timer" and uses the retransmission mechanim.
|
||||||
*/
|
*/
|
||||||
tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1];
|
tmp16 = ((unsigned short int)BUF->wnd[0] << 8) + (unsigned short int)BUF->wnd[1];
|
||||||
if(tmp16 > uip_connr->initialmss ||
|
if(tmp16 > uip_connr->initialmss ||
|
||||||
tmp16 == 0) {
|
tmp16 == 0) {
|
||||||
tmp16 = uip_connr->initialmss;
|
tmp16 = uip_connr->initialmss;
|
||||||
@ -1471,7 +1470,7 @@ uip_process(u8_t flag)
|
|||||||
BUF->tcpchksum = 0;
|
BUF->tcpchksum = 0;
|
||||||
BUF->tcpchksum = ~(uip_tcpchksum());
|
BUF->tcpchksum = ~(uip_tcpchksum());
|
||||||
|
|
||||||
// ip_send_nolen:
|
//ip_send_nolen:
|
||||||
|
|
||||||
BUF->vhl = 0x45;
|
BUF->vhl = 0x45;
|
||||||
BUF->tos = 0;
|
BUF->tos = 0;
|
||||||
@ -1495,10 +1494,10 @@ uip_process(u8_t flag)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
//u16_t
|
/*unsigned short int
|
||||||
//htons(u16_t val)
|
htons(unsigned short int val)
|
||||||
//{
|
{
|
||||||
// return HTONS(val);
|
return HTONS(val);
|
||||||
//}
|
}*/
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -61,8 +61,6 @@
|
|||||||
|
|
||||||
#include "uip_arp.h"
|
#include "uip_arp.h"
|
||||||
|
|
||||||
//#include <string.h>
|
|
||||||
|
|
||||||
struct arp_hdr {
|
struct arp_hdr {
|
||||||
struct uip_eth_hdr ethhdr;
|
struct uip_eth_hdr ethhdr;
|
||||||
u16_t hwtype;
|
u16_t hwtype;
|
||||||
@ -144,7 +142,7 @@ uip_arp_init(void)
|
|||||||
void
|
void
|
||||||
uip_arp_timer(void)
|
uip_arp_timer(void)
|
||||||
{
|
{
|
||||||
struct arp_entry *tabptr = 0;
|
struct arp_entry *tabptr;
|
||||||
|
|
||||||
++arptime;
|
++arptime;
|
||||||
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
|
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
|
||||||
|
@ -480,7 +480,6 @@ void uip_log(char *msg);
|
|||||||
* which are big endian. The BYTE_ORDER macro should be changed to
|
* which are big endian. The BYTE_ORDER macro should be changed to
|
||||||
* reflect the CPU architecture on which uIP is to be run.
|
* reflect the CPU architecture on which uIP is to be run.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LITTLE_ENDIAN
|
#ifndef LITTLE_ENDIAN
|
||||||
#define LITTLE_ENDIAN 3412
|
#define LITTLE_ENDIAN 3412
|
||||||
#endif /* LITTLE_ENDIAN */
|
#endif /* LITTLE_ENDIAN */
|
||||||
@ -488,7 +487,6 @@ void uip_log(char *msg);
|
|||||||
#define BIG_ENDIAN 1234
|
#define BIG_ENDIAN 1234
|
||||||
#endif /* BIGE_ENDIAN */
|
#endif /* BIGE_ENDIAN */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The byte order of the CPU architecture on which uIP is to be run.
|
* The byte order of the CPU architecture on which uIP is to be run.
|
||||||
*
|
*
|
||||||
|
@ -17,41 +17,24 @@
|
|||||||
#include "../httpd/uip.h"
|
#include "../httpd/uip.h"
|
||||||
#include "../httpd/uip_arp.h"
|
#include "../httpd/uip_arp.h"
|
||||||
|
|
||||||
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
|
|
||||||
|
|
||||||
static int arptimer = 0;
|
static int arptimer = 0;
|
||||||
|
|
||||||
void HttpdHandler(void){
|
void HttpdHandler(void){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ( uip_len == 0 ) {
|
for(i = 0; i < UIP_CONNS; i++){
|
||||||
for ( i = 0; i < UIP_CONNS; i++ ) {
|
uip_periodic(i);
|
||||||
uip_periodic( i );
|
|
||||||
if ( uip_len > 0 ) {
|
if(uip_len > 0){
|
||||||
uip_arp_out();
|
uip_arp_out();
|
||||||
NetSendHttpd();
|
NetSendHttpd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ++arptimer == 20 ) {
|
if(++arptimer == 20){
|
||||||
uip_arp_timer();
|
uip_arp_timer();
|
||||||
arptimer = 0;
|
arptimer = 0;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if ( BUF->type == htons( UIP_ETHTYPE_IP ) ) {
|
|
||||||
uip_arp_ipin();
|
|
||||||
uip_input();
|
|
||||||
if ( uip_len > 0 ) {
|
|
||||||
uip_arp_out();
|
|
||||||
NetSendHttpd();
|
|
||||||
}
|
|
||||||
} else if ( BUF->type == htons( UIP_ETHTYPE_ARP ) ) {
|
|
||||||
uip_arp_arpin();
|
|
||||||
if ( uip_len > 0 ) {
|
|
||||||
NetSendHttpd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// start http daemon
|
// start http daemon
|
||||||
|
@ -1810,41 +1810,39 @@ IPaddr_t getenv_IPaddr (char *var)
|
|||||||
|
|
||||||
#if (CONFIG_COMMANDS & CFG_CMD_HTTPD)
|
#if (CONFIG_COMMANDS & CFG_CMD_HTTPD)
|
||||||
|
|
||||||
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
|
|
||||||
|
|
||||||
void NetSendHttpd( void ){
|
void NetSendHttpd( void ){
|
||||||
volatile uchar *tmpbuf = NetTxPacket;
|
volatile uchar *tmpbuf = NetTxPacket;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for ( i = 0; i < 40 + UIP_LLH_LEN; i++ ) {
|
for(i = 0; i < 40 + UIP_LLH_LEN; i++){
|
||||||
tmpbuf[i] = uip_buf[i];
|
tmpbuf[i] = uip_buf[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ; i < uip_len; i++ ) {
|
for(; i < uip_len; i++){
|
||||||
tmpbuf[i] = uip_appdata[ i - 40 - UIP_LLH_LEN ];
|
tmpbuf[i] = uip_appdata[i - 40 - UIP_LLH_LEN];
|
||||||
}
|
}
|
||||||
|
|
||||||
eth_send( NetTxPacket, uip_len );
|
eth_send(NetTxPacket, uip_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetReceiveHttpd( volatile uchar * inpkt, int len ) {
|
void NetReceiveHttpd( volatile uchar * inpkt, int len ) {
|
||||||
memcpy( uip_buf, ( const void * )inpkt, len );
|
struct uip_eth_hdr *eth_hdr = (struct uip_eth_hdr *)uip_buf;
|
||||||
|
|
||||||
|
memcpy(uip_buf, (const void *)inpkt, len);
|
||||||
uip_len = len;
|
uip_len = len;
|
||||||
|
|
||||||
if ( BUF->type == htons( UIP_ETHTYPE_IP ) ) {
|
if(eth_hdr->type == htons(UIP_ETHTYPE_IP)){
|
||||||
|
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
uip_input();
|
uip_input();
|
||||||
|
|
||||||
if ( uip_len > 0 ) {
|
if(uip_len > 0){
|
||||||
uip_arp_out();
|
uip_arp_out();
|
||||||
NetSendHttpd();
|
NetSendHttpd();
|
||||||
}
|
}
|
||||||
} else if( BUF->type == htons( UIP_ETHTYPE_ARP ) ) {
|
} else if(eth_hdr->type == htons(UIP_ETHTYPE_ARP)){
|
||||||
|
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
|
|
||||||
if ( uip_len > 0 ) {
|
if(uip_len > 0){
|
||||||
NetSendHttpd();
|
NetSendHttpd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1925,7 +1923,7 @@ restart2:
|
|||||||
} else {
|
} else {
|
||||||
ethinit_attempt++;
|
ethinit_attempt++;
|
||||||
eth_halt();
|
eth_halt();
|
||||||
udelay( 1000000 );
|
milisecdelay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1992,7 +1990,7 @@ restart2:
|
|||||||
ulong led_time = get_timer(0);
|
ulong led_time = get_timer(0);
|
||||||
|
|
||||||
// infinite loop
|
// infinite loop
|
||||||
for ( ; ; ) {
|
for (;;) {
|
||||||
if (get_timer(led_time) > (CFG_HZ/5)) {
|
if (get_timer(led_time) > (CFG_HZ/5)) {
|
||||||
LED_ALERT_BLINK();
|
LED_ALERT_BLINK();
|
||||||
led_time = get_timer(0);
|
led_time = get_timer(0);
|
||||||
@ -2037,10 +2035,9 @@ restart2:
|
|||||||
|
|
||||||
// try to make upgrade!
|
// try to make upgrade!
|
||||||
if ( do_http_upgrade( NetBootFileXferSize, webfailsafe_upgrade_type ) >= 0 ) {
|
if ( do_http_upgrade( NetBootFileXferSize, webfailsafe_upgrade_type ) >= 0 ) {
|
||||||
udelay( 500000 );
|
milisecdelay(500);
|
||||||
do_http_progress( WEBFAILSAFE_PROGRESS_UPGRADE_READY );
|
do_http_progress( WEBFAILSAFE_PROGRESS_UPGRADE_READY );
|
||||||
udelay( 500000 );
|
milisecdelay(500);
|
||||||
|
|
||||||
/* reset the board */
|
/* reset the board */
|
||||||
do_reset( NULL, 0, 0, NULL );
|
do_reset( NULL, 0, 0, NULL );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user