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]

Re: Getting serial buffer status: patch attached


Grant Edwards wrote:
> 
> I've attached a patch that adds a config key and corresponding
> codeto get the current rx/tx buffer info for a serial device.
> This only returns status on the buffer implimented in the
> mid-level serial driver, and doesn't take into account any FIFO
> that the UART may have.

Hi Grant,

I have (finally) checked this in. Sorry for the delay. The contents of the
rest of the message are why I kept putting it off :-). I do have one
uncertainty though: if the device is polled (i.e. chan->{in,out}_cbuf.len
== 0), then should rx_count/tx_count really be set to 0? Or perhaps it
should actually be 1? I think 0 is probably right, but I want to flag it if
anyone else disagrees.

Robert, here's something extra to add to the eCos device driver
documentation.

This would go in the bit corresponding to 
http://sourceware.cygnus.com/ecos/docs-1.3.1/ref/ecos-ref.11.html

Firstly, at the end of Runtime configuration (after the description of
cyg_serial_info_t has finished) add:

-=-=-=-=-

typedef struct {
  cyg_int32 rx_bufsize;
  cyg_int32 rx_count;
  cyg_int32 tx_bufsize;
  cyg_int32 tx_count;
}
cyg_serial_buf_info_t;                                                                                              

The field 'rx_bufsize' contains the total size of the incoming data buffer.
This is set to 0 on devices that do not support buffering (i.e. polled
devices).

The field 'rx_count' contains the number of bytes currently occupied in the
incoming data buffer. This is set to 0 on devices that do not support
buffering (i.e. polled devices).

The field 'tx_bufsize' contains the total size of the transmit data buffer.
This is set to 0 on devices that do not support buffering (i.e. polled
devices).

The field 'tx_count' contains the number of bytes currently occrupied in
the transmit data buffer. This is set to 0 on devices that do not support
buffering (i.e. polled devices).

-=-=-=-=-


And then later, after the CYG_IO_GET_CONFIG_SERIAL_INFO key, add this new
key:

-=-=-=-=-=-=-=-
Key:
    CYG_IO_GET_CONFIG_SERIAL_BUFFER_INFO

Buf type:
    cyg_serial_buf_info_t

Function:

  This function retrieves the current state of the software buffers in the
serial drivers. For both receive and transmit buffers it returns the total
buffer size and the current number of bytes occupied in the buffer. It does
not take into account any buffering such as FIFOs or holding registers that
the serial device itself may have.

-=-=-=-=-=-=-=-

BTW Robert, this is only relevant for releases after now, not any of the
ones currently in the pipeline.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

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