diff --git a/include/net.h b/include/net.h index 4aed649dc..6b766e622 100644 --- a/include/net.h +++ b/include/net.h @@ -61,7 +61,7 @@ struct eth_device { int (*init) (struct eth_device*); int (*open) (struct eth_device*); - int (*send) (struct eth_device*, volatile void *packet, int length); + int (*send) (struct eth_device*, void *packet, int length); int (*recv) (struct eth_device*); void (*halt) (struct eth_device*); int (*get_mac_address) (struct eth_device*, unsigned char *adr); @@ -84,7 +84,7 @@ extern int eth_get_dev_index (void); /* get the device index */ extern void eth_set_enetaddr(int num, char* a); /* Set new MAC address */ extern int eth_init(void); /* Initialize the device */ -extern int eth_send(volatile void *packet, int length); /* Send a packet */ +extern int eth_send(void *packet, int length); /* Send a packet */ extern int eth_rx(void); /* Check for received packets */ extern void eth_halt(void); /* stop SCC */ extern char *eth_get_name(void); /* get name of current device */ @@ -268,9 +268,9 @@ extern uchar NetOurEther[6]; /* Our ethernet address */ extern uchar NetServerEther[6]; /* Boot server enet address */ extern IPaddr_t NetOurIP; /* Our IP addr (0 = unknown) */ extern IPaddr_t NetServerIP; /* Server IP addr (0 = unknown) */ -extern volatile uchar * NetTxPacket; /* THE transmit packet */ -extern volatile uchar * NetRxPackets[PKTBUFSRX];/* Receive packets */ -extern volatile uchar * NetRxPkt; /* Current receive packet */ +extern uchar * NetTxPacket; /* THE transmit packet */ +extern uchar * NetRxPackets[PKTBUFSRX];/* Receive packets */ +extern uchar * NetRxPkt; /* Current receive packet */ extern int NetRxPktLen; /* Current rx packet length */ extern unsigned NetIPID; /* IP ID (counting) */ extern uchar NetBcastAddr[6]; /* Ethernet boardcast address */ @@ -329,10 +329,10 @@ extern void NetStartAgain(void); extern int NetEthHdrSize(void); /* Set ethernet header; returns the size of the header */ -extern int NetSetEther(volatile uchar *, uchar *, uint); +extern int NetSetEther(uchar *, uchar *, uint); /* Set IP header */ -extern void NetSetIP(volatile uchar *, IPaddr_t, int, int, int); +extern void NetSetIP(uchar *, IPaddr_t, int, int, int); /* Checksum */ extern int NetCksumOk(uchar *, int); /* Return true if cksum OK */ @@ -343,13 +343,13 @@ extern void NetSetHandler(rxhand_f *); /* Set RX packet handler */ extern void NetSetTimeout(uint64_t, thand_f *);/* Set timeout handler */ /* Transmit "NetTxPacket" */ -extern void NetSendPacket(volatile uchar *, int); +extern void NetSendPacket(uchar *, int); /* Transmit UDP packet, performing ARP request if needed */ extern int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len); /* Processes a received packet */ -extern void NetReceive(volatile uchar *, int); +extern void NetReceive(uchar *, int); /* Print an IP address on the console */ #ifdef CONFIG_NET diff --git a/net/net.c b/net/net.c index e74af31dd..a59c640a5 100644 --- a/net/net.c +++ b/net/net.c @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include "bootp.h" @@ -121,7 +122,7 @@ uchar NetServerEther[6] = /* Boot server enet address */ { 0, 0, 0, 0, 0, 0 }; IPaddr_t NetOurIP; /* Our IP addr (0 = unknown) */ IPaddr_t NetServerIP; /* Our IP addr (0 = unknown) */ -volatile uchar *NetRxPkt; /* Current receive packet */ +uchar *NetRxPkt; /* Current receive packet */ int NetRxPktLen; /* Current rx packet length */ unsigned NetIPID; /* IP packet ID */ uchar NetBcastAddr[6] = /* Ethernet bcast address */ @@ -160,15 +161,15 @@ void NcStart(void); int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len); #endif -volatile uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN]; +uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN]; -volatile uchar *NetRxPackets[PKTBUFSRX]; /* Receive packets */ +uchar *NetRxPackets[PKTBUFSRX]; /* Receive packets */ static rxhand_f *packetHandler; /* Current RX packet handler */ static thand_f *timeHandler; /* Current timeout handler */ static uint64_t timeStart; /* Time base value */ static uint64_t timeDelta; /* Current timeout value */ -volatile uchar *NetTxPacket = 0; /* THE transmit packet */ +uchar *NetTxPacket = 0; /* THE transmit packet */ static int net_check_prereq (proto_t protocol); @@ -186,7 +187,7 @@ int NetArpWaitTry; void ArpRequest (void) { int i; - volatile uchar *pkt; + uchar *pkt; ARP_t *arp; #ifdef ET_DEBUG @@ -380,11 +381,12 @@ restart: DhcpRequest(); /* Basically same as BOOTP */ break; #endif - +#ifdef CONFIG_NET_BOOTP case BOOTP: BootpTry = 0; BootpRequest (); break; +#endif #ifdef CONFIG_NET_RARP case RARP: RarpTry = 0; @@ -577,7 +579,7 @@ NetSetTimeout(uint64_t iv, thand_f * f) void -NetSendPacket(volatile uchar * pkt, int len) +NetSendPacket(uchar * pkt, int len) { (void) eth_send(pkt, len); } @@ -716,9 +718,9 @@ static ushort CDP_compute_csum(const uchar *buff, ushort len) int CDPSendTrigger(void) { - volatile uchar *pkt; - volatile ushort *s; - volatile ushort *cp; + uchar *pkt; + ushort *s; + ushort *cp; Ethernet_t *et; int len; ushort chksum; @@ -745,7 +747,7 @@ int CDPSendTrigger(void) /* CDP header */ *pkt++ = 0x02; /* CDP version 2 */ *pkt++ = 180; /* TTL */ - s = (volatile ushort *)pkt; + s = (ushort *)pkt; cp = s; *s++ = htons(0); /* checksum (0 for later calculation) */ @@ -985,7 +987,7 @@ static void CDPStart(void) void -NetReceive(volatile uchar * inpkt, int len) +NetReceive(uchar * inpkt, int len) { Ethernet_t *et; IP_t *ip; @@ -1432,7 +1434,7 @@ NetEthHdrSize(void) } int -NetSetEther(volatile uchar * xet, uchar * addr, uint prot) +NetSetEther(uchar * xet, uchar * addr, uint prot) { Ethernet_t *et = (Ethernet_t *)xet; ushort myvlanid; @@ -1457,9 +1459,9 @@ NetSetEther(volatile uchar * xet, uchar * addr, uint prot) } void -NetSetIP(volatile uchar * xip, IPaddr_t dest, int dport, int sport, int len) +NetSetIP(uchar * xip, IPaddr_t dest, int dport, int sport, int len) { - volatile IP_t *ip = (IP_t *)xip; + IP_t *ip = (IP_t *)xip; /* * If the data is an odd number of bytes, zero the