#include <linux/module.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/comedi/comedi_pci.h>
#include <linux/comedi/comedi_8255.h>
#include <linux/comedi/comedi_8254.h>
#define PCI_DEVICE_ID_PCI230 …
#define PCI_DEVICE_ID_PCI260 …
#define PCI230_PPI_X_BASE …
#define PCI230_PPI_X_A …
#define PCI230_PPI_X_B …
#define PCI230_PPI_X_C …
#define PCI230_PPI_X_CMD …
#define PCI230_Z2_CT_BASE …
#define PCI230_ZCLK_SCE …
#define PCI230_ZGAT_SCE …
#define PCI230_INT_SCE …
#define PCI230_INT_STAT …
#define PCI230_DACCON …
#define PCI230_DACOUT1 …
#define PCI230_DACOUT2 …
#define PCI230_ADCDATA …
#define PCI230_ADCSWTRIG …
#define PCI230_ADCCON …
#define PCI230_ADCEN …
#define PCI230_ADCG …
#define PCI230P_ADCTRIG …
#define PCI230P_ADCTH …
#define PCI230P_ADCFFTH …
#define PCI230P_ADCFFLEV …
#define PCI230P_ADCPTSC …
#define PCI230P_ADCHYST …
#define PCI230P_EXTFUNC …
#define PCI230P_HWVER …
#define PCI230P2_DACDATA …
#define PCI230P2_DACSWTRIG …
#define PCI230P2_DACEN …
#define PCI230_DAC_OR(x) …
#define PCI230_DAC_OR_UNI …
#define PCI230_DAC_OR_BIP …
#define PCI230_DAC_OR_MASK …
#define PCI230P2_DAC_FIFO_EN …
#define PCI230P2_DAC_TRIG(x) …
#define PCI230P2_DAC_TRIG_NONE …
#define PCI230P2_DAC_TRIG_SW …
#define PCI230P2_DAC_TRIG_EXTP …
#define PCI230P2_DAC_TRIG_EXTN …
#define PCI230P2_DAC_TRIG_Z2CT0 …
#define PCI230P2_DAC_TRIG_Z2CT1 …
#define PCI230P2_DAC_TRIG_Z2CT2 …
#define PCI230P2_DAC_TRIG_MASK …
#define PCI230P2_DAC_FIFO_WRAP …
#define PCI230P2_DAC_INT_FIFO(x) …
#define PCI230P2_DAC_INT_FIFO_EMPTY …
#define PCI230P2_DAC_INT_FIFO_NEMPTY …
#define PCI230P2_DAC_INT_FIFO_NHALF …
#define PCI230P2_DAC_INT_FIFO_HALF …
#define PCI230P2_DAC_INT_FIFO_NFULL …
#define PCI230P2_DAC_INT_FIFO_FULL …
#define PCI230P2_DAC_INT_FIFO_MASK …
#define PCI230_DAC_BUSY …
#define PCI230P2_DAC_FIFO_UNDERRUN_LATCHED …
#define PCI230P2_DAC_FIFO_EMPTY …
#define PCI230P2_DAC_FIFO_FULL …
#define PCI230P2_DAC_FIFO_HALF …
#define PCI230P2_DAC_FIFO_UNDERRUN_CLEAR …
#define PCI230P2_DAC_FIFO_RESET …
#define PCI230P2_DAC_FIFOLEVEL_HALF …
#define PCI230P2_DAC_FIFOLEVEL_FULL …
#define PCI230P2_DAC_FIFOROOM_EMPTY …
#define PCI230P2_DAC_FIFOROOM_ONETOHALF …
#define PCI230P2_DAC_FIFOROOM_HALFTOFULL …
#define PCI230P2_DAC_FIFOROOM_FULL …
#define PCI230_ADC_TRIG(x) …
#define PCI230_ADC_TRIG_NONE …
#define PCI230_ADC_TRIG_SW …
#define PCI230_ADC_TRIG_EXTP …
#define PCI230_ADC_TRIG_EXTN …
#define PCI230_ADC_TRIG_Z2CT0 …
#define PCI230_ADC_TRIG_Z2CT1 …
#define PCI230_ADC_TRIG_Z2CT2 …
#define PCI230_ADC_TRIG_MASK …
#define PCI230_ADC_IR(x) …
#define PCI230_ADC_IR_UNI …
#define PCI230_ADC_IR_BIP …
#define PCI230_ADC_IR_MASK …
#define PCI230_ADC_IM(x) …
#define PCI230_ADC_IM_SE …
#define PCI230_ADC_IM_DIF …
#define PCI230_ADC_IM_MASK …
#define PCI230_ADC_FIFO_EN …
#define PCI230_ADC_INT_FIFO(x) …
#define PCI230_ADC_INT_FIFO_EMPTY …
#define PCI230_ADC_INT_FIFO_NEMPTY …
#define PCI230_ADC_INT_FIFO_NHALF …
#define PCI230_ADC_INT_FIFO_HALF …
#define PCI230_ADC_INT_FIFO_NFULL …
#define PCI230_ADC_INT_FIFO_FULL …
#define PCI230P_ADC_INT_FIFO_THRESH …
#define PCI230_ADC_INT_FIFO_MASK …
#define PCI230_ADC_FIFO_RESET …
#define PCI230_ADC_GLOB_RESET …
#define PCI230_ADC_BUSY …
#define PCI230_ADC_FIFO_EMPTY …
#define PCI230_ADC_FIFO_FULL …
#define PCI230_ADC_FIFO_HALF …
#define PCI230_ADC_FIFO_FULL_LATCHED …
#define PCI230_ADC_FIFOLEVEL_HALFFULL …
#define PCI230_ADC_FIFOLEVEL_FULL …
#define PCI230P_EXTFUNC_GAT_EXTTRIG …
#define PCI230P2_EXTFUNC_DACFIFO …
#define CLK_CLK …
#define CLK_10MHZ …
#define CLK_1MHZ …
#define CLK_100KHZ …
#define CLK_10KHZ …
#define CLK_1KHZ …
#define CLK_OUTNM1 …
#define CLK_EXT …
static unsigned int pci230_clk_config(unsigned int chan, unsigned int src)
{ … }
#define GAT_VCC …
#define GAT_GND …
#define GAT_EXT …
#define GAT_NOUTNM2 …
static unsigned int pci230_gat_config(unsigned int chan, unsigned int src)
{ … }
#define PCI230_INT_DISABLE …
#define PCI230_INT_PPI_C0 …
#define PCI230_INT_PPI_C3 …
#define PCI230_INT_ADC …
#define PCI230_INT_ZCLK_CT1 …
#define PCI230P2_INT_DAC …
enum { … };
enum { … };
#define COMBINE(old, new, mask) …
#define THISCPU …
struct pci230_board { … };
static const struct pci230_board pci230_boards[] = …;
struct pci230_private { … };
static const unsigned int pci230_timebase[8] = …;
static const struct comedi_lrange pci230_ai_range = …;
static const unsigned char pci230_ai_gain[7] = …;
static const struct comedi_lrange pci230_ao_range = …;
static unsigned short pci230_ai_read(struct comedi_device *dev)
{ … }
static unsigned short pci230_ao_mangle_datum(struct comedi_device *dev,
unsigned short datum)
{ … }
static void pci230_ao_write_nofifo(struct comedi_device *dev,
unsigned short datum, unsigned int chan)
{ … }
static void pci230_ao_write_fifo(struct comedi_device *dev,
unsigned short datum, unsigned int chan)
{ … }
static bool pci230_claim_shared(struct comedi_device *dev,
unsigned char res_mask, unsigned int owner)
{ … }
static void pci230_release_shared(struct comedi_device *dev,
unsigned char res_mask, unsigned int owner)
{ … }
static void pci230_release_all_resources(struct comedi_device *dev,
unsigned int owner)
{ … }
static unsigned int pci230_divide_ns(u64 ns, unsigned int timebase,
unsigned int flags)
{ … }
static unsigned int pci230_choose_clk_count(u64 ns, unsigned int *count,
unsigned int flags)
{ … }
static void pci230_ns_to_single_timer(unsigned int *ns, unsigned int flags)
{ … }
static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct,
unsigned int mode, u64 ns,
unsigned int flags)
{ … }
static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct)
{ … }
static int pci230_ai_eoc(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned long context)
{ … }
static int pci230_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{ … }
static int pci230_ao_insn_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{ … }
static int pci230_ao_check_chanlist(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{ … }
static int pci230_ao_cmdtest(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_cmd *cmd)
{ … }
static void pci230_ao_stop(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static void pci230_handle_ao_nofifo(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static bool pci230_handle_ao_fifo(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static int pci230_ao_inttrig_scan_begin(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int trig_num)
{ … }
static void pci230_ao_start(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static int pci230_ao_inttrig_start(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int trig_num)
{ … }
static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{ … }
static int pci230_ao_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static int pci230_ai_check_scan_period(struct comedi_cmd *cmd)
{ … }
static int pci230_ai_check_chanlist(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{ … }
static int pci230_ai_cmdtest(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_cmd *cmd)
{ … }
static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static int pci230_ai_inttrig_convert(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int trig_num)
{ … }
static int pci230_ai_inttrig_scan_begin(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int trig_num)
{ … }
static void pci230_ai_stop(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static void pci230_ai_start(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static int pci230_ai_inttrig_start(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int trig_num)
{ … }
static void pci230_handle_ai(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{ … }
static int pci230_ai_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{ … }
static irqreturn_t pci230_interrupt(int irq, void *d)
{ … }
static bool pci230_match_pci_board(const struct pci230_board *board,
struct pci_dev *pci_dev)
{ … }
static const struct pci230_board *pci230_find_pci_board(struct pci_dev *pci_dev)
{ … }
static int pci230_auto_attach(struct comedi_device *dev,
unsigned long context_unused)
{ … }
static struct comedi_driver amplc_pci230_driver = …;
static int amplc_pci230_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{ … }
static const struct pci_device_id amplc_pci230_pci_table[] = …;
MODULE_DEVICE_TABLE(pci, amplc_pci230_pci_table);
static struct pci_driver amplc_pci230_pci_driver = …;
module_comedi_pci_driver(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;