diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-05-18 14:33:34 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-05-18 14:33:34 +0000 |
commit | 9d733d44b402ce33c3c41e45b497c2f92be393f5 (patch) | |
tree | 2ddf8b9b25e696ec4a2ab30c181f253005036be7 /Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c | |
parent | 41de1d1dab863c7b769f6e492c36c115994c403d (diff) | |
download | lufa-9d733d44b402ce33c3c41e45b497c2f92be393f5.tar.gz lufa-9d733d44b402ce33c3c41e45b497c2f92be393f5.tar.bz2 lufa-9d733d44b402ce33c3c41e45b497c2f92be393f5.zip |
Add new RNDIS_Host_IsPacketReceived(), RNDIS_Device_ReadPacket() and RNDIS_Device_WritePacket() functions to the Device RNDIS Class Driver.
Modify RNDIS demos to suit the simplified Ethernet_Frame_Info_t structure.
Diffstat (limited to 'Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c')
-rw-r--r-- | Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index e14f3f1de..dc9682a05 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -63,6 +63,8 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface = }, }; +static Ethernet_Frame_Info_t FrameIN; +static Ethernet_Frame_Info_t FrameOUT; /** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. @@ -79,14 +81,23 @@ int main(void) for (;;) { - if (Ethernet_RNDIS_Interface.State.FrameIN.FrameInBuffer) + if (RNDIS_Device_IsPacketReceived(&Ethernet_RNDIS_Interface)) { LEDs_SetAllLEDs(LEDMASK_USB_BUSY); - Ethernet_ProcessPacket(&Ethernet_RNDIS_Interface.State.FrameIN, &Ethernet_RNDIS_Interface.State.FrameOUT); + + RNDIS_Device_ReadPacket(&Ethernet_RNDIS_Interface, &FrameIN.FrameData, &FrameIN.FrameLength); + Ethernet_ProcessPacket(&FrameIN, &FrameOUT); + + if (FrameOUT.FrameLength) + { + RNDIS_Device_SendPacket(&Ethernet_RNDIS_Interface, &FrameOUT.FrameData, FrameOUT.FrameLength); + FrameOUT.FrameLength = 0; + } + LEDs_SetAllLEDs(LEDMASK_USB_READY); } - TCP_TCPTask(&Ethernet_RNDIS_Interface); + TCP_TCPTask(&Ethernet_RNDIS_Interface, &FrameOUT); RNDIS_Device_USBTask(&Ethernet_RNDIS_Interface); USB_USBTask(); |