Closing/disabling a device
|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
Hey All,I'm looking to interface a serial GPS unit to an Atmel AT91 using eCos. GPS units constantly stream out data at 4800 baud, but I actually only need to get data from the unit once every few hours to check time and position. The idea is to have a thread wake up, read the data, then go back to sleep. The code (ported from Linux) uses the stdio FILE input routines (fopen, fgetc, etc)
But the data arriving consistently from the GPS is filling up the buffer in the AT91 serial driver and I can't figure out how to empty or clear it. I tried CYG_IO_GET_CONFIG_SERIAL_INPUT_FLUSH, and also to just close the port (fclose) while the thread is sleeping.
I have started looking at the driver to see if the ability to flush/drain the buffers is implemented, but I think I would prefer the second option - closing down the driver to disable interrupts for that serial port while it's not needed.
I don't see a low-level mechanism to do this. Am I missing something? Is there low-level code that trickles down to a driver when an application calls close() or fclose() on a device?
As always, thanks for the help, Frank -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss