To assist me in testing I wrote a simple version of the variable receiver function getcalc(), which implements part of the TI linking protocol and runs entirely in userspace (except for the read() and write() system calls themselves). For the most part the link device worked fine. When a byte comes in and the read queue is full, the driver disables receiving until the user program drains the queue (at least by one byte). However, I discovered that no additional interrupts were being triggered to indicate that a byte is available in the hardware's receive buffer, even after those interrupts were re-enabled.
I finally fixed this today by setting a flag to indicate overflow of the read queue and then, in the system call (non-interrupt) code, read from the hardware receive buffer if overflow is flagged. Then interrupts are enabled again at this point and receiving bytes continues as normal, until the read queue becomes full again of course.
No comments:
Post a Comment