]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - include/net.h
ATMEL/PIO: Enable new feature of PIO on Atmel device
[karo-tx-uboot.git] / include / net.h
index 8dd407e6cfe132008f7baf948d38ac02203c37a6..a092f291bbcd643b8eda122b10b0509d1fd4b719 100644 (file)
 #include <asm/cache.h>
 #include <asm/byteorder.h>     /* for nton* / ntoh* stuff */
 
+#define DEBUG_LL_STATE 0       /* Link local state machine changes */
+#define DEBUG_DEV_PKT 0                /* Packets or info directed to the device */
+#define DEBUG_NET_PKT 0                /* Packets on info on the network at large */
+#define DEBUG_INT_STATE 0      /* Internal network state changes */
 
 /*
  *     The number of receive packet buffers, and the required packet buffer
@@ -395,7 +399,7 @@ extern int          NetRestartWrap;         /* Tried all network devices */
 
 enum proto_t {
        BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
-       TFTPSRV, TFTPPUT
+       TFTPSRV, TFTPPUT, LINKLOCAL
 };
 
 /* from net/net.c */
@@ -436,6 +440,7 @@ extern IPaddr_t Mcast_addr;
 #endif
 
 /* Initialize the network adapter */
+extern void net_init(void);
 extern int NetLoop(enum proto_t);
 
 /* Shutdown adapters and cleanup */
@@ -449,6 +454,7 @@ extern int  NetEthHdrSize(void);
 
 /* Set ethernet header; returns the size of the header */
 extern int NetSetEther(uchar *, uchar *, uint);
+extern int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
 extern void net_set_ip_header(uchar *pkt, IPaddr_t dest, IPaddr_t source);
@@ -460,8 +466,10 @@ extern int NetCksumOk(uchar *, int);       /* Return true if cksum OK */
 extern uint    NetCksum(uchar *, int);         /* Calculate the checksum */
 
 /* Callbacks */
-extern rxhand_f *NetGetHandler(void);          /* Get RX packet handler */
-extern void    NetSetHandler(rxhand_f *);      /* Set RX packet handler */
+extern rxhand_f *net_get_udp_handler(void);    /* Get UDP RX packet handler */
+extern void net_set_udp_handler(rxhand_f *);   /* Set UDP RX packet handler */
+extern rxhand_f *net_get_arp_handler(void);    /* Get ARP RX packet handler */
+extern void net_set_arp_handler(rxhand_f *);   /* Set ARP RX packet handler */
 extern void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */
 extern void    NetSetTimeout(ulong, thand_f *);/* Set timeout handler */
 
@@ -476,17 +484,19 @@ static inline void net_set_state(enum net_loop_state state)
 {
        extern enum net_loop_state net_state;
 
+       debug_cond(DEBUG_INT_STATE, "--- NetState set to %d\n", state);
        net_state = state;
 }
 
-/* Transmit "NetTxPacket" */
+/* Transmit a packet */
 static inline void NetSendPacket(uchar *pkt, int len)
 {
        (void) eth_send(pkt, len);
 }
 
 /*
- * Transmit UDP packet, performing ARP request if needed
+ * Transmit "NetTxPacket" as UDP packet, performing ARP request if needed
+ *  (ether will be populated)
  *
  * @param ether Raw packet buffer
  * @param dest IP address to send the datagram to
@@ -494,7 +504,7 @@ static inline void NetSendPacket(uchar *pkt, int len)
  * @param sport Source UDP port
  * @param payload_len Length of data after the UDP header
  */
-extern int     NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport,
+extern int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport,
                        int sport, int payload_len);
 
 /* Processes a received packet */