From: Jan Kiszka <jan.kiszka@domain.hid>
To: Axel Beierlein <belatronix@domain.hid>
Cc: "Xenomai-help@domain.hid" <Xenomai-help@domain.hid>
Subject: Re: [Xenomai-help] Sourcecode 16550A.c
Date: Thu, 09 Aug 2007 15:11:40 +0200 [thread overview]
Message-ID: <46BB128C.4030608@domain.hid> (raw)
In-Reply-To: <46BB0777.7010907@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 2658 bytes --]
Jan Kiszka wrote:
> Axel Beierlein wrote:
>> Hello Jan,
>>
>> could you explain me the meaning of the variable in_nwait, in_tail and
>> in_npend of the rt_16550_context structure?
>> Especially i?ll try to find out the functionality of the if statements
>> behind the while in rt_16650_interrupt(...).
>>
>> Or, do you have a more commented Version?
>
> struct rt_16550_context {
> struct rtser_config config; /* current device configuration */
>
> rtdm_irq_t irq_handle; /* device IRQ handle */
> rtdm_lock_t lock; /* lock to protect context struct */
>
> unsigned long base_addr; /* hardware IO base address */
> #ifdef CONFIG_XENO_DRIVERS_16550A_ANY
> int io_mode; /* hardware IO-access mode */
> #endif
> int tx_fifo; /* cached global tx_fifo[<device>] */
>
> int in_head; /* RX ring buffer, head pointer */
> int in_tail; /* RX ring buffer, tail pointer */
> size_t in_npend; /* pending bytes in RX ring */
> int in_nwait; /* bytes the user waits for */
> rtdm_event_t in_event; /* raised to unblock reader */
> char in_buf[IN_BUFFER_SIZE]; /* RX ring buffer */
> volatile unsigned long in_lock; /* single-reader lock */
> uint64_t *in_history; /* RX timestamp buffer */
>
> int out_head; /* TX ring buffer, head pointer */
> int out_tail; /* TX ring buffer, tail pointer */
> size_t out_npend; /* pending bytes in TX ring */
> rtdm_event_t out_event; /* raised to unblock writer */
> char out_buf[OUT_BUFFER_SIZE]; /* TX ring buffer */
> rtdm_mutex_t out_lock; /* single-writer mutex */
>
> uint64_t last_timestamp; /* timestamp of last event */
> int ioc_events; /* recorded events */
> rtdm_event_t ioc_event; /* raised to unblock event waiter */
> volatile unsigned long ioc_event_lock; /* single-waiter lock */
>
> int ier_status; /* IER cache */
> int mcr_status; /* MCR cache */
> int status; /* cache for LSR + soft-states */
> int saved_errors; /* error cache for RTIOC_GET_STATUS */
> };
>
> There are a few "volatiles" less in the above version. For in_nwait
> becoming truely non-volatile, some code changes to rt_16550_read() are
> pending (need more review). Will commit later.
>
> [Sometimes it's good to be forced to look at old code again and rethink
> if everything is already/still perfect...]
The new version is online:
http://svn.gna.org/viewcvs/xenomai?rev=2902&view=rev
As you are currently deep into the code as well, please keep me informed
about potential quirks you spot and/or continue to ask about how things
are supposed to work. This driver is clearly "under-commented"...
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
prev parent reply other threads:[~2007-08-09 13:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-09 11:34 [Xenomai-help] Sourcecode 16550A.c Axel Beierlein
2007-08-09 12:24 ` Jan Kiszka
2007-08-09 13:11 ` Jan Kiszka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46BB128C.4030608@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=Xenomai-help@domain.hid \
--cc=belatronix@domain.hid \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.