Question regarding win32comport_demo.py

Peter Hansen peter at engcorp.com
Thu Jan 31 18:00:30 EST 2002


MDK wrote:
> 
> Does this program read from the Serial Port's Memory Buffer, the UART
> Buffer, or something else?

It does a ReadFile() in only one place, where it uses the handle which
was returned from a previous call to CreateFile().  The way serial
i/o works on most machines is that the UART generates a hardware 
interrupt when new data is received.  That interrupt triggers execution
of an interrupt service routine (ISR), usually (and in the case of Win32)
provided by the OS or in a driver.  The ISR adds the data into a
memory buffer the size of which might be controllable via an API call
(and again, in the case of Win32, I believe it is).  The file object
which wraps the serial port is connected to this memory buffer so
that reads come from there.

Does that help?  You didn't describe the reason behind your question,
which might be more helpful in soliciting a useful reply.  Why
do you think you need to know this type of detail?

-Peter



More information about the Python-list mailing list