From: Spiro T. <tri...@gm...> - 2005-03-15 16:41:11
|
Hello Johnny, * On Tue, Mar 15, 2005 at 05:23:27PM +0100 Johnny Karlsson wrote: > Has anyone a good idea on how to implement a interrupt driven > function? My first attempt looks like this: [snipp] If I understand your approach correctly, your writing the packet from the NIC directly in the UIP buffer. This will not work, because you could overwrite some contents (in the UIP buffer) which are currently scanned by other functions! Personally, I'd use a buffering approach: Whenever an interrupt occurs, get the data from the controller and put it into a buffer. Now, whenever uIP wants to poll for another buffer, check if there is something in that receive buffer. If memory is a problem, you might want to restrict yourself to two buffers only: The UIP buffer, and a "shadow" buffer which is written by the interrupt routine. Anyway, make sure you do not write into the wrong buffer while it is read/written by "the other side", thus, you need correct synchronization mechanism. Regards, Spiro. -- Spiro R. Trikaliotis http://www.trikaliotis.net/ http://cbm4win.sf.net/ |