mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Patrick Jennings <jennings@red-river.com>
To: LKML <linux-kernel@vger.kernel.org>
Subject: Userland ISRs
Date: Wed, 16 Oct 2002 11:41:22 -0500	[thread overview]
Message-ID: <NFBBJBMDCLFFHHFEAKNAMEDJCCAA.jennings@red-river.com> (raw)

Hello All:

I am writing a device driver for a pci card.  We have to have "userland
isrs" in that we need to allow the top level user to run a thread that
responds to differnent isr bits n our card (a digital transever)

The approch i have been using is to create an ioctl that sleeps on interupt,
then waked up and notifies the user land program when and isr is triggired.

So the ioctl part:

	//Enable interupt
			*(redriver_device_data.bar0ptr+0x584/4) = intr_wait.interrupt;

			if(intr_wait.timeout != 0)
			{
				*(redriver_device_data.bar0ptr+0x584/4) = intr_wait.interrupt;
				timeout = interruptible_sleep_on_timeout(&waiter->wq, intr_wait.timeout
* HZ / 1000);

				if(timeout == 0)
				{
					intr_wait.result = RRENG_WAIT_TIMEOUT;
					printk("<1> ISR Timeout\n");
				}
				else
				{
					intr_wait.result = RRENG_WAIT_SUCCESS | waiter->status;
					printk("Timed ISR OK\n");
				}
			}
			else
			{
				interruptible_sleep_on(&waiter->wq);
				intr_wait.result = RRENG_WAIT_SUCCESS | waiter->status;
				printk("<1>Untimed ISR ok\n");
			}

and the isr part

for(i=0; i<RRENG_MAX_INTR_WAITERS; i++)
		{
			waiter = card->waiters[i];
			printk("<1>Comparing %x and %x on waiter %d\n", statusisr, waiter.mask,
i);
			printk("<1>Flagval is %d\n", waiter.flagval);
			if(waiter.mask & statusisr)
			{
				*(card->bar0ptr+enableregadr/4) = 0x0;  //Diable;
				printk("<1>Waking up waiter %d with mask 0x%x\n",i , waiter.mask);

				wake_up = (waiter.status) ? FALSE : TRUE;
				waiter.status |= status;

				if(wake_up)
					wake_up_interruptible(&waiter.wq);
			}
		}


This all works well and good, execpt when the isr bit is already true when
isrs are enabled.  Then as soon as they are enabled the isr routine gets
called, before the sleep has got a chance to get set up.  Any ideas around
this?

/patrick

+========================================================+
Patrick Jennings       | jennings@red-river.com
Red River              | Direct Phone   (972) 671-9636
Radio Products Group   | Main Phone     (972) 671-9570
797 North Grove Road   | Fax            (972) 671-9572
Suite 101              | www.red-river.com
Richardson,TX  75081   |


             reply	other threads:[~2002-10-16 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-16 16:41 Patrick Jennings [this message]
2002-10-17 14:19 Heater, Daniel (IndSys, GEFanuc, VMIC)

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=NFBBJBMDCLFFHHFEAKNAMEDJCCAA.jennings@red-river.com \
    --to=jennings@red-river.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®