This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Another serial driver question



I've been looking at the serial driver, and it appears that the
serial_rcv_char() callback function doesn't check to see if the
receive buffer is full before putting the next byte.  Putting
one too many bytes into the buffer will result in an empty
buffer.  This is perhaps reasonable behavior if flow control is
not enabled in the UART.  But if flow control is enabled, in
order to prevent data loss when the application reading the
device falls behind, you have to stop reading bytes from the
UART.

So, I need to change the DSR so that it will not read bytes
from the UART if there is no place to put them in the receive
buffer.  I'm thinking of changing serial_rcv_char() so that

 1) it checks to see if the buffer is full and discards bytes
    rather than overflowing the buffer.

 2) it returns a status to indicate if the byte was
    successfully written to the receive buffer -- similar to
    the way it works for transmit data being written to the
    UART 
    
    -or- 

    it calls a stop_recv function to tell the hardware layer
    that there's no more room in the receive buffer. This would
    be an additional pointer in the serial_funs struct.

After the receive buffer fills up, and the DSR stops reading
from the UART, and then the application subsequently does a
read(), I need to start reading bytes from the UART again.

DSR's can only be scheduled from the corresponding IRQ, right?
IOW, I can't do something in serial_read() to request that a
DSR be run.  In that case, I'll need to add a a start_recv
function pointer to the serial_funs structure so that
serial_read can restart the receive processing after it's been
stopped.

-- 
Grant Edwards
grante@visi.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]