+++ /dev/null
-diff -Nur comedi-cvs/comedi/Makefile comedi/comedi/Makefile
---- comedi-cvs/comedi/Makefile Tue Jan 16 20:26:13 2001
-+++ comedi/comedi/Makefile Fri Mar 2 00:17:56 2001
-@@ -1,7 +1,7 @@
-
-
- SUB_DIRS := drivers
--ALL_SUB_DIRS := kcomedilib drivers realtime
-+ALL_SUB_DIRS := kcomedilib drivers realtime rt_pend_tq
- MOD_SUB_DIRS := drivers
- MOD_IN_SUB_DIRS :=
-
-@@ -13,8 +13,8 @@
- endif
-
- ifeq ($(CONFIG_COMEDI_RT),y)
-- MOD_SUB_DIRS += realtime
-- SUB_DIRS += realtime
-+ MOD_SUB_DIRS += realtime rt_pend_tq
-+ SUB_DIRS += realtime rt_pend_tq
- endif
-
- MOD_LIST_NAME := MISC_MODULES
-diff -Nur comedi-cvs/comedi/rt.c comedi/comedi/rt.c
---- comedi-cvs/comedi/rt.c Mon Feb 5 03:06:46 2001
-+++ comedi/comedi/rt.c Fri Mar 2 00:52:35 2001
-@@ -36,6 +36,8 @@
- #include <linux/irq.h>
- #include <asm/io.h>
-
-+#include "rt_pend_tq.h"
-+
- #ifdef CONFIG_COMEDI_RTAI
- #include <rtai/rtai.h>
-
-@@ -152,17 +154,19 @@
- RT_spin_unlock_irq(&dev->spinlock);
- }
-
--void comedi_rt_pend_wakeup(wait_queue_head_t *q)
--{
--
--}
--
- #ifdef HAVE_RT_PEND_TQ
- void wake_up_int_handler(int arg1, void * arg2)
- {
- wake_up_interruptible((wait_queue_head_t*)arg2);
- }
- #endif
-+
-+void comedi_rt_pend_wakeup(wait_queue_head_t *q)
-+{
-+#ifdef HAVE_RT_PEND_TQ
-+ rt_pend_call(wake_up_int_handler,0,q);
-+#endif
-+}
-
-
- /* RTAI section */
-diff -Nur comedi-cvs/comedi/rt_pend_tq/Makefile comedi/comedi/rt_pend_tq/Makefile
---- comedi-cvs/comedi/rt_pend_tq/Makefile Thu Jan 1 01:00:00 1970
-+++ comedi/comedi/rt_pend_tq/Makefile Fri Mar 2 00:37:55 2001
-@@ -0,0 +1,42 @@
-+
-+ALL_SUB_DIRS :=
-+MOD_SUB_DIRS :=
-+SUB_DIRS :=
-+MOD_LIST_NAME := MISC_MODULES
-+
-+EXTRA_CFLAGS := -I ../
-+
-+export-objs :=
-+
-+obj-y :=
-+obj-m :=
-+obj-n :=
-+obj- :=
-+
-+obj-$(CONFIG_COMEDI_RT) += rt_pend_tq.o
-+
-+obj-m += $(obj-y)
-+
-+#L_OBJS := $(sort $(filter-out $(export-objs), $(obj-y)))
-+#LX_OBJS := $(sort $(filter $(export-objs), $(obj-y)))
-+#MI_OBJS := $(sort $(filter-out $(export-objs), $(obj-y)))
-+#MIX_OBJS := $(sort $(filter $(export-objs), $(obj-y)))
-+M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
-+MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
-+
-+
-+
-+include $(TOPDIR)/Rules.make
-+
-+ifdef CONFIG_COMEDI_RTL
-+rt_pend_tq.o : rt_pend_tq_rtl.c
-+
-+endif
-+
-+ifdef CONFIG_COMEDI_RTAI
-+rt_pend_tq.o : rt_pend_tq_rtai.c
-+
-+endif
-+
-+
-+
-diff -Nur comedi-cvs/comedi/rt_pend_tq/rt_pend_tq.c comedi/comedi/rt_pend_tq/rt_pend_tq.c
---- comedi-cvs/comedi/rt_pend_tq/rt_pend_tq.c Thu Jan 1 01:00:00 1970
-+++ comedi/comedi/rt_pend_tq/rt_pend_tq.c Fri Mar 2 00:19:06 2001
-@@ -0,0 +1,9 @@
-+#include <linux/comedidev.h>
-+
-+#ifdef CONFIG_COMEDI_RTAI
-+#include "rt_pend_tq_rtai.c"
-+#else
-+#ifdef CONFIG_COMEDI_RTL
-+#include "rt_pend_tq_rtl.c"
-+#endif
-+#endif
-diff -Nur comedi-cvs/comedi/rt_pend_tq/rt_pend_tq.h comedi/comedi/rt_pend_tq/rt_pend_tq.h
---- comedi-cvs/comedi/rt_pend_tq/rt_pend_tq.h Thu Jan 1 01:00:00 1970
-+++ comedi/comedi/rt_pend_tq/rt_pend_tq.h Thu Jan 25 16:09:29 2001
-@@ -0,0 +1,9 @@
-+#define RT_PEND_TQ_SIZE 16
-+struct rt_pend_tq {
-+ void (*func)(int arg1, void * arg2);
-+ int arg1;
-+ void *arg2;
-+} ;
-+extern int rt_pend_call(void (*func)(int arg1, void * arg2), int arg1, void * arg2);
-+extern int rt_pend_tq_init(void);
-+extern void rt_pend_tq_cleanup(void);
-diff -Nur comedi-cvs/comedi/rt_pend_tq/rt_pend_tq_rtai.c comedi/comedi/rt_pend_tq/rt_pend_tq_rtai.c
---- comedi-cvs/comedi/rt_pend_tq/rt_pend_tq_rtai.c Thu Jan 1 01:00:00 1970
-+++ comedi/comedi/rt_pend_tq/rt_pend_tq_rtai.c Thu Jan 25 16:09:29 2001
-@@ -0,0 +1,51 @@
-+#include <linux/errno.h>
-+#include <linux/stddef.h>
-+#include "rt_pend_tq.h"
-+#include <rtai.h>
-+
-+volatile static struct rt_pend_tq rt_pend_tq[RT_PEND_TQ_SIZE];
-+volatile static struct rt_pend_tq * volatile rt_pend_head= rt_pend_tq,
-+ * volatile rt_pend_tail = rt_pend_tq;
-+int rt_pend_tq_irq=0;
-+
-+// WARNING: following code not checked against race conditions yet.
-+#define INC_CIRCULAR_PTR(ptr,begin,size) do {if(++(ptr)>=(begin)+(size)) (ptr)=(begin); } while(0)
-+#define DEC_CIRCULAR_PTR(ptr,begin,size) do {if(--(ptr)<(begin)) (ptr)=(begin)+(size)-1; } while(0)
-+
-+int rt_pend_call(void (*func)(int arg1, void * arg2), int arg1, void * arg2)
-+{
-+ if(func==NULL)
-+ return -EINVAL;
-+ if(rt_pend_tq_irq<=0)
-+ return -ENODEV;
-+ INC_CIRCULAR_PTR(rt_pend_head,rt_pend_tq,RT_PEND_TQ_SIZE);
-+ if(rt_pend_head==rt_pend_tail) {
-+ // overflow, we just refuse to take this request
-+ DEC_CIRCULAR_PTR(rt_pend_head,rt_pend_tq,RT_PEND_TQ_SIZE);
-+ return -EAGAIN;
-+ }
-+ rt_pend_head->func=func;
-+ rt_pend_head->arg1=arg1;
-+ rt_pend_head->arg2=arg2;
-+ rt_pend_linux_srq(rt_pend_tq_irq);
-+ return 0;
-+}
-+
-+void rt_pend_irq_handler()
-+{
-+ while(rt_pend_head!=rt_pend_tail) {
-+ INC_CIRCULAR_PTR(rt_pend_tail,rt_pend_tq,RT_PEND_TQ_SIZE);
-+ rt_pend_tail->func(rt_pend_tail->arg1,rt_pend_tail->arg2);
-+ }
-+}
-+
-+int rt_pend_tq_init()
-+{
-+ rt_pend_head=rt_pend_tail=rt_pend_tq;
-+ return rt_pend_tq_irq=rt_request_srq(0,rt_pend_irq_handler,NULL);
-+}
-+
-+void rt_pend_tq_cleanup()
-+{
-+ free_irq(rt_pend_tq_irq,NULL);
-+}
-diff -Nur comedi-cvs/comedi/rt_pend_tq/rt_pend_tq_rtl.c comedi/comedi/rt_pend_tq/rt_pend_tq_rtl.c
---- comedi-cvs/comedi/rt_pend_tq/rt_pend_tq_rtl.c Thu Jan 1 01:00:00 1970
-+++ comedi/comedi/rt_pend_tq/rt_pend_tq_rtl.c Fri Mar 2 00:54:09 2001
-@@ -0,0 +1,61 @@
-+#include <linux/module.h>
-+#include <linux/errno.h>
-+#include <linux/sched.h>
-+#include "rt_pend_tq.h"
-+#include <linux/rtl.h>
-+
-+volatile static struct rt_pend_tq rt_pend_tq[RT_PEND_TQ_SIZE];
-+volatile static struct rt_pend_tq * volatile rt_pend_head= rt_pend_tq,
-+ * volatile rt_pend_tail = rt_pend_tq;
-+int rt_pend_tq_irq=0;
-+
-+// WARNING: following code not checked against race conditions yet.
-+#define INC_CIRCULAR_PTR(ptr,begin,size) do {if(++(ptr)>=(begin)+(size)) (ptr)=(begin); } while(0)
-+#define DEC_CIRCULAR_PTR(ptr,begin,size) do {if(--(ptr)<(begin)) (ptr)=(begin)+(size)-1; } while(0)
-+
-+int rt_pend_call(void (*func)(int arg1, void * arg2), int arg1, void * arg2)
-+{
-+ if(func==NULL)
-+ return -EINVAL;
-+ if(rt_pend_tq_irq<=0)
-+ return -ENODEV;
-+// FIXME: grab RT spinlock/cli
-+ INC_CIRCULAR_PTR(rt_pend_head,rt_pend_tq,RT_PEND_TQ_SIZE);
-+ if(rt_pend_head==rt_pend_tail) {
-+ // overflow, we just refuse to take this request
-+ DEC_CIRCULAR_PTR(rt_pend_head,rt_pend_tq,RT_PEND_TQ_SIZE);
-+// FIXME: release RT spinlock/restore
-+ return -EAGAIN;
-+ }
-+// FIXME: release RT spinlock/restore
-+ rt_pend_head->func=func;
-+ rt_pend_head->arg1=arg1;
-+ rt_pend_head->arg2=arg2;
-+ rtl_global_pend_irq(rt_pend_tq_irq);
-+ return 0;
-+}
-+
-+void rt_pend_irq_handler(int irq, void *dev, struct pt_regs * regs)
-+{
-+ while(rt_pend_head!=rt_pend_tail) {
-+ INC_CIRCULAR_PTR(rt_pend_tail,rt_pend_tq,RT_PEND_TQ_SIZE);
-+ rt_pend_tail->func(rt_pend_tail->arg1,rt_pend_tail->arg2);
-+ }
-+}
-+
-+int init_module(void)
-+{
-+ rt_pend_head=rt_pend_tail=rt_pend_tq;
-+ rt_pend_tq_irq=rtl_get_soft_irq(rt_pend_irq_handler,"rt_pend_irq");
-+ if(rt_pend_tq_irq>0)
-+ printk("rt_pend_tq: RT bottom half scheduler initialized OK\n");
-+ else
-+ printk("rt_pend_tq: rtl_get_soft_irq failed\n");
-+ return 0;
-+}
-+
-+void cleanup_module(void)
-+{
-+ printk("rt_pend_tq: unloading\n");
-+ free_irq(rt_pend_tq_irq,NULL);
-+}
-diff -Nur comedi-cvs/include/linux/rtl.h comedi/include/linux/rtl.h
---- comedi-cvs/include/linux/rtl.h Thu Jan 1 01:00:00 1970
-+++ comedi/include/linux/rtl.h Fri Mar 2 00:23:59 2001
-@@ -0,0 +1,14 @@
-+/*
-+ * linux/rtl.h compatibility header
-+ */
-+
-+#ifndef _COMPAT_RTL_H
-+#define _COMPAT_RTL_H
-+
-+#include_next <rtl.h>
-+
-+#endif /* _COMPAT_RTL_H */
-+
-+
-+
-+
+++ /dev/null
-/*
- module/pcmad
- hardware driver for Winsystems PCM-A/D12 and PCM-A/D16
-
- COMEDI - Linux Control and Measurement Device Interface
- Copyright (C) 2000 David A. Schleef <ds@stm.lbl.gov>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/malloc.h>
-#include <linux/errno.h>
-#include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/timex.h>
-#include <linux/timer.h>
-#include <asm/io.h>
-#include <comedi_module.h>
-
-
-#define PCMAD_SIZE 4
-
-#define PCMAD_STATUS 0
-#define PCMAD_LSB 1
-#define PCMAD_MSB 2
-#define PCMAD_CONVERT 1
-
-static int pcmad_attach(comedi_device *dev,comedi_devconfig *it);
-static int pcmad_detach(comedi_device *dev);
-static int pcmad_recognize(char *name);
-comedi_driver driver_pcmad={
- driver_name: "pcmad",
- module: THIS_MODULE,
- attach: pcmad_attach,
- detach: pcmad_detach,
- recognize: pcmad_recognize,
-};
-
-struct pcmad_board_struct{
- char *name;
- int n_ai_bits;
-};
-struct pcmad_board_struct pcmad_boards[]={
- {
- name: "pcmad12",
- n_ai_bits: 12,
- },
- {
- name: "pcmad16",
- n_ai_bits: 16,
- },
-};
-#define this_board ((struct pcmad_board_struct *)(dev->board_ptr))
-static int n_pcmad_boards=(sizeof(pcmad_boards)/sizeof(pcmad_boards[0]));
-
-struct pcmad_priv_struct{
- int differential;
- int twos_comp;
-};
-#define devpriv ((struct pcmad_priv_struct *)dev->private)
-
-
-#define TIMEOUT 100
-
-static int pcmad_ai_mode0(comedi_device *dev,comedi_subdevice *s,comedi_trig *it)
-{
- int i,msb,lsb;
- int chan;
- int data;
-
- chan=CR_CHAN(it->chanlist[0]);
-
- outb(chan,dev->iobase+PCMAD_CONVERT);
-
- for(i=0;i<TIMEOUT;i++){
- if((inb(dev->iobase+PCMAD_STATUS)&0x3) == 0x3)
- break;
- }
- lsb=inb(dev->iobase+PCMAD_LSB);
- msb=inb(dev->iobase+PCMAD_MSB);
-
- data=(msb<<8)|(lsb);
-
- if(devpriv->twos_comp){
- data ^= (1<<(this_board->n_ai_bits-1));
- }
- it->data[0]=data;
-
- return 1;
-}
-
-static int pcmad_recognize(char *name)
-{
- int i;
-
- for(i=0;i<n_pcmad_boards;i++){
- if(!strcmp(pcmad_boards[i].name,name))
- return i;
- }
-
- return -1;
-}
-
-/*
- * options:
- * 0 i/o base
- * 1 unused
- * 2 0=single ended 1=differential
- * 3 0=straight binary 1=two's comp
- */
-static int pcmad_attach(comedi_device *dev,comedi_devconfig *it)
-{
- int ret;
- comedi_subdevice *s;
-
- dev->iobase=it->options[0];
- printk("comedi%d: pcmad: 0x%04x ",dev->minor,dev->iobase);
- if(check_region(dev->iobase,PCMAD_SIZE)<0){
- printk("I/O port conflict\n");
- return -EIO;
- }
- request_region(dev->iobase,PCMAD_SIZE,"pcmad");
- dev->iobase=dev->iobase;
- dev->iosize=PCMAD_SIZE;
-
- dev->n_subdevices=1;
- if((ret=alloc_subdevices(dev))<0)
- return ret;
- if((ret=alloc_private(dev,sizeof(struct pcmad_priv_struct)))<0)
- return ret;
-
- dev->board_ptr = pcmad_boards+dev->board;
-
- s=dev->subdevices+0;
- s->type=COMEDI_SUBD_AI;
- s->subdev_flags=SDF_READABLE;
- s->n_chan=16; /* XXX */
- s->len_chanlist=1;
- s->trig[0]=pcmad_ai_mode0;
- s->maxdata=(1<<this_board->n_ai_bits)-1;
- s->range_table=&range_unknown;
-
- return 0;
-}
-
-
-static int pcmad_detach(comedi_device *dev)
-{
- printk("comedi%d: pcmad: remove\n",dev->minor);
-
- if(dev->irq){
- free_irq(dev->irq,dev);
- }
- release_region(dev->iobase,dev->iosize);
-
- return 0;
-}
-
-
-COMEDI_INITCLEANUP(driver_pcmad);
-