2 #include "dev/rtl8019dev.h"
4 /*****************************************************************************
5 * Module Name: Realtek 8019AS Driver Interface for uIP-AVR Port
7 * Created By: Louis Beaudoin (www.embedded-creations.com)
9 * Original Release: September 21, 2002
12 * Provides three functions to interface with the Realtek 8019AS driver
13 * These functions can be called directly from the main uIP control loop
14 * to send packets from uip_buf and uip_appbuf, and store incoming packets to
17 * September 30, 2002 - Louis Beaudoin
18 * Modifications required to handle the packet receive function changes in
19 * rtl8019.c. There is no longer a need to poll for an empty buffer or
21 * Added support for the Imagecraft Compiler
23 *****************************************************************************/
26 #define IP_TCP_HEADER_LENGTH 40
27 #define TOTAL_HEADER_LENGTH (IP_TCP_HEADER_LENGTH+ETHERNET_HEADER_LENGTH)
31 void RTL8019dev_init(void)
37 void RTL8019dev_send(void)
39 RTL8019beginPacketSend(uip_len
);
41 // send packet, using data in uip_appdata if over the IP+TCP header size
42 if( uip_len
<= TOTAL_HEADER_LENGTH
) {
43 RTL8019sendPacketData(uip_buf
, uip_len
);
45 uip_len
-= TOTAL_HEADER_LENGTH
;
46 RTL8019sendPacketData(uip_buf
, TOTAL_HEADER_LENGTH
);
47 RTL8019sendPacketData((unsigned char *)uip_appdata
, uip_len
);
50 RTL8019endPacketSend();
55 unsigned int RTL8019dev_poll(void)
57 unsigned int packetLength
;
59 packetLength
= RTL8019beginPacketRetreive();
61 // if there's no packet or an error - exit without ending the operation
65 // drop anything too big for the buffer
66 if( packetLength
> UIP_BUFSIZE
)
68 RTL8019endPacketRetreive();
72 // copy the packet data into the uIP packet buffer
73 RTL8019retreivePacketData( uip_buf
, packetLength
);
74 RTL8019endPacketRetreive();
80 void RTL8019dev_exit(void)