Changed packet drivers from services to plain processes.

Now tcpip_output() is a function pointer that is supposed to be set via the macro tcpip_set_outputfunc(). Packet drivers do so on process startup.

Thus if there are several packet drivers in a Contiki system the one started last is the one actually used. This behaviour is especially useful for the 'IP forwarding' "meta" packet driver.
This commit is contained in:
oliverschmidt 2007-05-26 23:05:36 +00:00
parent 6ab3a6d1e3
commit 75f04995a9
5 changed files with 91 additions and 69 deletions

View file

@ -30,7 +30,7 @@
void RTL8019dev_init(void)
{
initRTL8019();
initRTL8019();
}
@ -54,24 +54,29 @@ void RTL8019dev_send(void)
unsigned int RTL8019dev_poll(void)
{
unsigned int packetLength;
unsigned int packetLength;
packetLength = RTL8019beginPacketRetreive();
packetLength = RTL8019beginPacketRetreive();
// if there's no packet or an error - exit without ending the operation
if( !packetLength )
return 0;
// if there's no packet or an error - exit without ending the operation
if( !packetLength )
return 0;
// drop anything too big for the buffer
if( packetLength > UIP_BUFSIZE )
{
RTL8019endPacketRetreive();
return 0;
}
// drop anything too big for the buffer
if( packetLength > UIP_BUFSIZE )
{
RTL8019endPacketRetreive();
return 0;
}
// copy the packet data into the uIP packet buffer
RTL8019retreivePacketData( uip_buf, packetLength );
RTL8019endPacketRetreive();
// copy the packet data into the uIP packet buffer
RTL8019retreivePacketData( uip_buf, packetLength );
RTL8019endPacketRetreive();
return packetLength;
return packetLength;
}
void RTL8019dev_exit(void)
{
}