All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] adding PCI support to 16550A.c
@ 2007-09-10 13:14 Bachman Kharazmi
  2007-09-10 18:24 ` Jan Kiszka
  0 siblings, 1 reply; 24+ messages in thread
From: Bachman Kharazmi @ 2007-09-10 13:14 UTC (permalink / raw)
  To: xenomai

I've tried to make the pci serial controller visable to the 16550
driver by adding:
## FROM 16550A.c
static int rt_16550_interrupt(rtdm_irq_t * irq_context)
{
	struct rt_16550_context *ctx;
	unsigned long base;
	int mode;
	int iir;
	uint64_t timestamp = rtdm_clock_read();
	int rbytes = 0;
	int events = 0;
	int modem;
	int ret = RTDM_IRQ_NONE;
// TEST
struct pci_dev *pdev = NULL;  // from
http://bachman.tor.lindesign.se/tmp/driver/sunix/snx_golden.c
pdev = pci_get_device(0, 0, pdev); // from
http://bachman.tor.lindesign.se/tmp/driver/sunix/snx_golden.c
//
	ctx = rtdm_irq_get_arg(irq_context, struct rt_16550_context);
	base = ctx->base_addr;
	mode = rt_16550_io_mode_from_ctx(ctx);

	rtdm_lock_get(&ctx->lock);

	while (1) {
		iir = rt_16550_reg_in(mode, base, IIR) & IIR_MASK;
		if (testbits(iir, IIR_PIRQ))
			break;


Loading module:
insmod ./xeno_16550A.ko io=0x3f8,0xbc00 irq=4,3 tx_fifo=10,20 start_index=0

running crosslink test:
sandbox:/usr/src/xenomai/examples/rtdm/profiles/serial# ./cross-link
main : write-file opened
main : write-config written
main : read-file opened
main : read-config written
main : write-task created
main : read-task created
main : starting write-task
main : starting read-task
 Nr |   write->irq    |    irq->read    |   write->read   |
-----------------------------------------------------------
read_task: error on RTSER_RTIOC_WAIT_EVENT, Connection timed out
read_task: error on RTSER_RTIOC_WAIT_EVENT, Connection timed out

any ideas?
regards /Bachman

On 09/09/2007, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> > Are there any chance that modifications in the source will get it going?
>
> Maybe we are just lacking some pci_enable_device() on the right pci_dev.
> That would mean extending xeno_16550A to deal with PCI devices. Surely
> feasible, but it takes time and hardware to test - I'm lacking both.
>
> Are you willing to play a bit with it? Then, as a prototype, you could
> pick up the lookup and enabling code from the snx driver and hack it
> into xeno_16550A. If that works, we could discuss how to establish
> something generic for PCI-based adapters.
>
> Note that I haven't read through that driver in details. There is a
> slight risk that some more bits are different. On the other hand, the
> 16650 UART that seems to be on that card is advertised as
> 16550-compatible, thus it /should/ work...
>
> Jan
>
>
>


^ permalink raw reply	[flat|nested] 24+ messages in thread
* [Xenomai-help] adding PCI support to 16550A.c
@ 2007-09-10 13:14 Bachman Kharazmi
  0 siblings, 0 replies; 24+ messages in thread
From: Bachman Kharazmi @ 2007-09-10 13:14 UTC (permalink / raw)
  To: xenomai

I've tried to make the pci serial controller visable to the 16550
driver by adding:
## FROM 16550A.c
static int rt_16550_interrupt(rtdm_irq_t * irq_context)
{
	struct rt_16550_context *ctx;
	unsigned long base;
	int mode;
	int iir;
	uint64_t timestamp = rtdm_clock_read();
	int rbytes = 0;
	int events = 0;
	int modem;
	int ret = RTDM_IRQ_NONE;
// TEST
struct pci_dev *pdev = NULL;  // from
http://bachman.tor.lindesign.se/tmp/driver/sunix/snx_golden.c
pdev = pci_get_device(0, 0, pdev); // from
http://bachman.tor.lindesign.se/tmp/driver/sunix/snx_golden.c
//
	ctx = rtdm_irq_get_arg(irq_context, struct rt_16550_context);
	base = ctx->base_addr;
	mode = rt_16550_io_mode_from_ctx(ctx);

	rtdm_lock_get(&ctx->lock);

	while (1) {
		iir = rt_16550_reg_in(mode, base, IIR) & IIR_MASK;
		if (testbits(iir, IIR_PIRQ))
			break;


Loading module:
insmod ./xeno_16550A.ko io=0x3f8,0xbc00 irq=4,3 tx_fifo=10,20 start_index=0

running crosslink test:
sandbox:/usr/src/xenomai/examples/rtdm/profiles/serial# ./cross-link
main : write-file opened
main : write-config written
main : read-file opened
main : read-config written
main : write-task created
main : read-task created
main : starting write-task
main : starting read-task
 Nr |   write->irq    |    irq->read    |   write->read   |
-----------------------------------------------------------
read_task: error on RTSER_RTIOC_WAIT_EVENT, Connection timed out
read_task: error on RTSER_RTIOC_WAIT_EVENT, Connection timed out

any ideas?
regards /Bachman

On 09/09/2007, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> > Are there any chance that modifications in the source will get it going?
>
> Maybe we are just lacking some pci_enable_device() on the right pci_dev.
> That would mean extending xeno_16550A to deal with PCI devices. Surely
> feasible, but it takes time and hardware to test - I'm lacking both.
>
> Are you willing to play a bit with it? Then, as a prototype, you could
> pick up the lookup and enabling code from the snx driver and hack it
> into xeno_16550A. If that works, we could discuss how to establish
> something generic for PCI-based adapters.
>
> Note that I haven't read through that driver in details. There is a
> slight risk that some more bits are different. On the other hand, the
> 16650 UART that seems to be on that card is advertised as
> 16550-compatible, thus it /should/ work...
>
> Jan
>
>
>


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2007-09-13 12:48 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-10 13:14 [Xenomai-help] adding PCI support to 16550A.c Bachman Kharazmi
2007-09-10 18:24 ` Jan Kiszka
2007-09-10 18:42   ` Bachman Kharazmi
2007-09-10 18:51     ` Jan Kiszka
2007-09-11 15:37       ` Bachman Kharazmi
2007-09-11 19:54         ` Jan Kiszka
2007-09-12 14:02           ` Bachman Kharazmi
2007-09-12 16:22             ` Bachman Kharazmi
2007-09-12 16:33               ` Gilles Chanteperdrix
2007-09-12 16:43                 ` Gilles Chanteperdrix
2007-09-12 19:30                   ` Bachman Kharazmi
2007-09-12 22:50                     ` Gilles Chanteperdrix
2007-09-12 16:32             ` Gilles Chanteperdrix
2007-09-12 19:17               ` Bachman Kharazmi
2007-09-12 23:25             ` Jan Kiszka
2007-09-13  6:14               ` Jan Kiszka
2007-09-13  9:38                 ` Bachman Kharazmi
2007-09-13  9:45                   ` Gilles Chanteperdrix
2007-09-13  9:51                     ` Bachman Kharazmi
2007-09-13  9:56                       ` Gilles Chanteperdrix
     [not found]                         ` <1ce16a2c0709130307k5e1955d4na694e90503084d0d@domain.hid>
2007-09-13 12:18                           ` Gilles Chanteperdrix
2007-09-13 12:41                             ` Bachman Kharazmi
2007-09-13 12:48                               ` Gilles Chanteperdrix
  -- strict thread matches above, loose matches on Subject: below --
2007-09-10 13:14 Bachman Kharazmi

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.