nidas v1.2.3
Macros | Functions | Variables
dmd_mmat.c File Reference
#include "dmd_mmat.h"
#include <linux/types.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/workqueue.h>
#include <linux/poll.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <asm/io.h>
#include <nidas/linux/Revision.h>
#include <nidas/linux/ver_macros.h>
#include <nidas/linux/klog.h>
#include <nidas/linux/isa_bus.h>
#include <nidas/linux/filters/short_filters_kernel.h>

Macros

#define IRQF_SHARED   SA_SHIRQ
 
#define REPO_REVISION   "unknown"
 
#define REPORT_UNDER_OVERFLOWS
 

Functions

 module_param_array (ioports, int, numboards, 0)
 
 module_param_array (irqs, int, numirqs, 0)
 
 module_param_array (types, int, numtypes, 0)
 
 module_param_array (d2aconfig, int, numd2aconfig, 0)
 
 MODULE_AUTHOR ("Gordon Maclean <maclean@ucar.edu>")
 
 MODULE_LICENSE ("Dual BSD/GPL")
 
 MODULE_DESCRIPTION ("Driver for Diamond DMM analog cards")
 
 MODULE_VERSION (REPO_REVISION)
 
static void setTimerClock (struct DMMAT *brd, int clock, int mode, unsigned short val)
 Set counter value in a 82C54 clock.
 
static unsigned int readLatchedTimer (struct DMMAT *brd, int clock)
 Read counter value in a 82C54 clock.
 
static int div_10 (unsigned int x, unsigned int y, int prec, int *fp)
 
static int setClock1InputRate_MM16AT (struct DMMAT *brd, int rate)
 
static int setClock1InputRate_MM32AT (struct DMMAT *brd, int rate)
 
static int setupClock12 (struct DMMAT *brd, int inputRate, int outputRate)
 
static void releaseClock12 (struct DMMAT *brd)
 
const char * getA2DDeviceName (struct DMMAT_A2D *a2d)
 
static int getNumA2DChannelsMM16AT (struct DMMAT_A2D *a2d)
 Determine number of available channels - depends on single-ended vs differential jumpering.
 
static int getNumA2DChannelsMM32XAT (struct DMMAT_A2D *a2d)
 Determine number of available channels - depends on single-ended vs differential jumpering.
 
static int selectA2DChannelsMM16AT (struct DMMAT_A2D *a2d)
 returns: 0: ok, -EINVAL: channels out of range.
 
static int selectA2DChannelsMM32XAT (struct DMMAT_A2D *a2d)
 returns: 0: ok, -EINVAL: channels out of range.
 
static int getConvRateMM16AT (struct DMMAT_A2D *a2d, unsigned char *val)
 
static int getConvRateMM32XAT (struct DMMAT_A2D *a2d, unsigned char *val)
 
static int getGainSettingMM16AT (struct DMMAT_A2D *a2d, int gain, int bipolar, unsigned char *val)
 
static int getGainSettingMM32XAT (struct DMMAT_A2D *a2d, int gain, int bipolar, unsigned char *val)
 
static int getFifoLevelMM16AT (struct DMMAT_A2D *a2d)
 
static int getFifoLevelMM32XAT (struct DMMAT_A2D *a2d)
 
static void resetFifoMM16AT (struct DMMAT_A2D *a2d)
 
static void resetFifoMM32XAT (struct DMMAT_A2D *a2d)
 
static void waitForA2DSettleMM16AT (struct DMMAT_A2D *a2d)
 
static void waitForA2DSettleMM32XAT (struct DMMAT_A2D *a2d)
 
static void freeA2DFilters (struct DMMAT_A2D *a2d)
 
static void resetA2D_processing (struct DMMAT_A2D *a2d)
 Reset state of data processing.
 
static int configA2D (struct DMMAT_A2D *a2d, struct nidas_a2d_config *cfg)
 
static int addA2DSampleConfig (struct DMMAT_A2D *a2d, struct nidas_a2d_sample_config *cfg)
 
static irqreturn_t dmmat_a2d_handler (struct DMMAT_A2D *a2d)
 
static irqreturn_t dmmat_cntr_handler (struct DMMAT_CNTR *cntr)
 
static irqreturn_t dmmat_irq_handler (int irq, void *dev_id)
 
static int dmd_mmat_add_irq_user (struct DMMAT *brd, int user_type)
 
static int dmd_mmat_remove_irq_user (struct DMMAT *brd, int user_type)
 
static void stopA2D_MM16AT (struct DMMAT_A2D *a2d)
 
static void stopA2D_MM32XAT (struct DMMAT_A2D *a2d)
 
static void stopA2D (struct DMMAT_A2D *a2d)
 General function to stop the A2D.
 
static int getA2DThreshold_MM16AT (struct DMMAT_A2D *a2d)
 
static int getA2DThreshold_MM32XAT (struct DMMAT_A2D *a2d)
 
static void startA2D_MM16AT (struct DMMAT_A2D *a2d)
 
static void startA2D_MM32XAT (struct DMMAT_A2D *a2d)
 
static int startA2D (struct DMMAT_A2D *a2d)
 
static int startAutoCal_MM32XAT (struct DMMAT_A2D *a2d)
 
static void stopCntr_MM16AT (struct DMMAT_CNTR *cntr)
 
static void stopCntr_MM32AT (struct DMMAT_CNTR *cntr)
 
static int stopCNTR (struct DMMAT_CNTR *cntr)
 General function to stop a counter.
 
static int startCntr_MM16AT (struct DMMAT_CNTR *cntr)
 
static int startCntr_MM32AT (struct DMMAT_CNTR *cntr)
 
static int startCNTR (struct DMMAT_CNTR *cntr, struct DMMAT_CNTR_Config *cfg)
 General function to start a counter.
 
static void do_filters (struct DMMAT_A2D *a2d, dsm_sample_time_t tt, const short *dp)
 Invoke filters.
 
static void dmmat_a2d_bottom_half (struct work_struct *work)
 Worker function that invokes filters on the data in a fifo sample.
 
static void dmmat_a2d_bottom_half_fast (struct work_struct *work)
 Worker function that invokes filters on the data in a fifo sample.
 
static void dmmat_a2d_waveform_bh (struct work_struct *work)
 Worker function for forming samples when operating in waveform mode.
 
static int setD2A_MM16AT (struct DMMAT_D2A *d2a, struct DMMAT_D2A_Outputs *outputs, int iout)
 
static int setD2A_MM32AT (struct DMMAT_D2A *d2a, struct DMMAT_D2A_Outputs *outputs, int iout)
 
static int setD2A_MM32DXAT (struct DMMAT_D2A *d2a, struct DMMAT_D2A_Outputs *outputs, int iout)
 
static int setD2A_mult (struct DMMAT_D2A *d2a, struct DMMAT_D2A_Outputs *outputs)
 
static void getD2A_mult (struct DMMAT_D2A *d2a, struct DMMAT_D2A_Outputs *outputs)
 
static void getD2A_conv (struct DMMAT_D2A *d2a, struct DMMAT_D2A_Conversion *conv)
 
static int addWaveform_MM16AT (struct DMMAT_D2A *d2a, struct D2A_Waveform *wave)
 
static int addWaveform_MM32XAT (struct DMMAT_D2A *d2a, struct D2A_Waveform *wave)
 
static int loadWaveforms_MM16AT (struct DMMAT_D2A *d2a)
 
static int loadWaveforms_MM32XAT (struct DMMAT_D2A *d2a)
 
static void stopWaveforms_MM16AT (struct DMMAT_D2A *d2a)
 
static void stopWaveforms_MM32XAT (struct DMMAT_D2A *d2a)
 
static void stopWaveforms (struct DMMAT_D2A *d2a)
 General function to stop the D2A waveform.
 
static void startWaveforms_MM16AT (struct DMMAT_D2A *d2a)
 
static void startWaveforms_MM32XAT (struct DMMAT_D2A *d2a)
 
static int startWaveforms (struct DMMAT_D2A *d2a)
 
static void startD2D_MM16AT (struct DMMAT_D2D *d2d)
 
static void startD2D_MM32XAT (struct DMMAT_D2D *d2d)
 
static int startD2D (struct DMMAT_D2D *d2d)
 
static void stopD2D_MM16AT (struct DMMAT_D2D *d2d)
 
static void stopD2D_MM32XAT (struct DMMAT_D2D *d2d)
 
static int stopD2D (struct DMMAT_D2D *d2d)
 
static int dmmat_open_a2d (struct inode *inode, struct file *filp)
 
static int dmmat_release_a2d (struct inode *inode, struct file *filp)
 
static unsigned int dmmat_poll_a2d (struct file *filp, poll_table *wait)
 
static ssize_t dmmat_read_a2d (struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
 
static long dmmat_ioctl_a2d (struct file *filp, unsigned int cmd, unsigned long arg)
 
static int dmmat_open_cntr (struct inode *inode, struct file *filp)
 
static int dmmat_release_cntr (struct inode *inode, struct file *filp)
 
static ssize_t dmmat_read_cntr (struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
 
static long dmmat_ioctl_cntr (struct file *filp, unsigned int cmd, unsigned long arg)
 
unsigned int dmmat_poll_cntr (struct file *filp, poll_table *wait)
 
static int dmmat_open_d2a (struct inode *inode, struct file *filp)
 
static int dmmat_release_d2a (struct inode *inode, struct file *filp)
 
static long dmmat_ioctl_d2a (struct file *filp, unsigned int cmd, unsigned long arg)
 
static int dmmat_open_d2d (struct inode *inode, struct file *filp)
 
static int dmmat_release_d2d (struct inode *inode, struct file *filp)
 
static unsigned int dmmat_poll_d2d (struct file *filp, poll_table *wait)
 
static ssize_t dmmat_read_d2d (struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
 
static long dmmat_ioctl_d2d (struct file *filp, unsigned int cmd, unsigned long arg)
 
static int init_a2d (struct DMMAT *brd)
 
static void freeFilters (struct DMMAT_A2D *a2d)
 
static void cleanup_a2d (struct DMMAT *brd)
 
static void cntr_timer_fn (struct timer_list *tlist)
 Timer function which fetches the current counter value, makes a timetagged sample out of it, puts it in the circular buffer for the read method and wakens the read queue.
 
static int __init init_cntr (struct DMMAT *brd)
 
static void cleanup_cntr (struct DMMAT *brd)
 
static int checkD2A_MM32DXAT (struct DMMAT_D2A *d2a)
 
static int __init init_d2a (struct DMMAT *brd)
 
static void cleanup_d2a (struct DMMAT *brd)
 
static int __init init_d2d (struct DMMAT *brd)
 
static void cleanup_d2d (struct DMMAT *brd)
 
static void dmd_mmat_cleanup (void)
 
static int __init dmd_mmat_init (void)
 
 module_init (dmd_mmat_init)
 
 module_exit (dmd_mmat_cleanup)
 

Variables

static unsigned int ioports [MAX_DMMAT_BOARDS] = { 0x380, 0, 0, 0 }
 
static int numboards = 0
 
static int numActualBoards = 0
 
static int irqs [MAX_DMMAT_BOARDS] = { 12, 0, 0, 0 }
 
static int numirqs = 0
 
static int types [MAX_DMMAT_BOARDS] = { DMM32DXAT_BOARD, 0, 0, 0 }
 
static int numtypes = 0
 
static const char * BOARD_TYPE_STRS []
 
static int d2aconfig [MAX_DMMAT_BOARDS] = { DMMAT_D2A_UNI_5, 0, 0, 0 }
 
static int numd2aconfig = 0
 
static dev_t dmmat_device = MKDEV(0,0)
 
static struct class * dmmat_class
 
static struct DMMAT * board = 0
 
static struct workqueue_struct * work_queue = 0
 
static struct file_operations a2d_fops
 
static struct file_operations cntr_fops
 
static struct file_operations d2a_fops
 
static struct file_operations d2d_fops
 

Macro Definition Documentation

◆ IRQF_SHARED

#define IRQF_SHARED   SA_SHIRQ

Referenced by dmd_mmat_add_irq_user().

◆ REPO_REVISION

#define REPO_REVISION   "unknown"

Referenced by dmd_mmat_init().

◆ REPORT_UNDER_OVERFLOWS

#define REPORT_UNDER_OVERFLOWS

Function Documentation

◆ addA2DSampleConfig()

static int addA2DSampleConfig ( struct DMMAT_A2D * a2d,
struct nidas_a2d_sample_config * cfg )
static

◆ addWaveform_MM16AT()

static int addWaveform_MM16AT ( struct DMMAT_D2A * d2a,
struct D2A_Waveform * wave )
static

Referenced by init_d2a().

◆ addWaveform_MM32XAT()

static int addWaveform_MM32XAT ( struct DMMAT_D2A * d2a,
struct D2A_Waveform * wave )
static

References DMMAT_D2A_OUTPUTS_PER_BRD.

Referenced by init_d2a().

◆ checkD2A_MM32DXAT()

static int checkD2A_MM32DXAT ( struct DMMAT_D2A * d2a)
static

Referenced by init_d2a().

◆ cleanup_a2d()

static void cleanup_a2d ( struct DMMAT * brd)
static

◆ cleanup_cntr()

static void cleanup_cntr ( struct DMMAT * brd)
static

References dmmat_class, and free_dsm_circ_buf().

Referenced by dmd_mmat_cleanup().

◆ cleanup_d2a()

static void cleanup_d2a ( struct DMMAT * brd)
static

References dmmat_class.

Referenced by dmd_mmat_cleanup().

◆ cleanup_d2d()

static void cleanup_d2d ( struct DMMAT * brd)
static

References dmmat_class.

Referenced by dmd_mmat_cleanup().

◆ cntr_timer_fn()

static void cntr_timer_fn ( struct timer_list * tlist)
static

Timer function which fetches the current counter value, makes a timetagged sample out of it, puts it in the circular buffer for the read method and wakens the read queue.

This timer function is called at the rate requested by the user.

References readLatchedTimer().

Referenced by init_cntr().

◆ configA2D()

static int configA2D ( struct DMMAT_A2D * a2d,
struct nidas_a2d_config * cfg )
static

◆ div_10()

static int div_10 ( unsigned int x,
unsigned int y,
int prec,
int * fp )
static

References fp.

Referenced by setupClock12().

◆ dmd_mmat_add_irq_user()

static int dmd_mmat_add_irq_user ( struct DMMAT * brd,
int user_type )
static

References DMM16AT_BOARD, dmmat_irq_handler(), IRQF_SHARED, and irqs.

Referenced by startA2D(), and startCNTR().

◆ dmd_mmat_cleanup()

static void dmd_mmat_cleanup ( void )
static

◆ dmd_mmat_init()

static int __init dmd_mmat_init ( void )
static

◆ dmd_mmat_remove_irq_user()

static int dmd_mmat_remove_irq_user ( struct DMMAT * brd,
int user_type )
static

Referenced by startA2D(), stopA2D(), and stopCNTR().

◆ dmmat_a2d_bottom_half()

static void dmmat_a2d_bottom_half ( struct work_struct * work)
static

Worker function that invokes filters on the data in a fifo sample.

The contents of the fifo sample is not necessarily a multiple of the number of channels scanned.

References do_filters(), getA2DDeviceName(), dsm_sample::length, screen_timetag(), and TMSECS_PER_SEC.

Referenced by init_a2d().

◆ dmmat_a2d_bottom_half_fast()

static void dmmat_a2d_bottom_half_fast ( struct work_struct * work)
static

Worker function that invokes filters on the data in a fifo sample.

The contents of the fifo sample must be a multiple of the number of channels scanned.

References do_filters(), getA2DDeviceName(), screen_timetag(), and TMSECS_PER_SEC.

Referenced by init_a2d().

◆ dmmat_a2d_handler()

static irqreturn_t dmmat_a2d_handler ( struct DMMAT_A2D * a2d)
static

References getA2DDeviceName(), and work_queue.

Referenced by dmmat_irq_handler().

◆ dmmat_a2d_waveform_bh()

static void dmmat_a2d_waveform_bh ( struct work_struct * work)
static

Worker function for forming samples when operating in waveform mode.

References getA2DDeviceName().

Referenced by init_a2d().

◆ dmmat_cntr_handler()

static irqreturn_t dmmat_cntr_handler ( struct DMMAT_CNTR * cntr)
static

Referenced by dmmat_irq_handler().

◆ dmmat_ioctl_a2d()

static long dmmat_ioctl_a2d ( struct file * filp,
unsigned int cmd,
unsigned long arg )
static

◆ dmmat_ioctl_cntr()

static long dmmat_ioctl_cntr ( struct file * filp,
unsigned int cmd,
unsigned long arg )
static

◆ dmmat_ioctl_d2a()

static long dmmat_ioctl_d2a ( struct file * filp,
unsigned int cmd,
unsigned long arg )
static

◆ dmmat_ioctl_d2d()

static long dmmat_ioctl_d2d ( struct file * filp,
unsigned int cmd,
unsigned long arg )
static

◆ dmmat_irq_handler()

static irqreturn_t dmmat_irq_handler ( int irq,
void * dev_id )
static

◆ dmmat_open_a2d()

static int dmmat_open_a2d ( struct inode * inode,
struct file * filp )
static

References board, and numActualBoards.

◆ dmmat_open_cntr()

static int dmmat_open_cntr ( struct inode * inode,
struct file * filp )
static

References board, and numActualBoards.

◆ dmmat_open_d2a()

static int dmmat_open_d2a ( struct inode * inode,
struct file * filp )
static

References board, and numActualBoards.

◆ dmmat_open_d2d()

static int dmmat_open_d2d ( struct inode * inode,
struct file * filp )
static

References board, and numActualBoards.

◆ dmmat_poll_a2d()

static unsigned int dmmat_poll_a2d ( struct file * filp,
poll_table * wait )
static

◆ dmmat_poll_cntr()

unsigned int dmmat_poll_cntr ( struct file * filp,
poll_table * wait )

◆ dmmat_poll_d2d()

static unsigned int dmmat_poll_d2d ( struct file * filp,
poll_table * wait )
static

◆ dmmat_read_a2d()

static ssize_t dmmat_read_a2d ( struct file * filp,
char __user * buf,
size_t count,
loff_t * f_pos )
static

References nidas_circbuf_read().

◆ dmmat_read_cntr()

static ssize_t dmmat_read_cntr ( struct file * filp,
char __user * buf,
size_t count,
loff_t * f_pos )
static

References nidas_circbuf_read().

◆ dmmat_read_d2d()

static ssize_t dmmat_read_d2d ( struct file * filp,
char __user * buf,
size_t count,
loff_t * f_pos )
static

References nidas_circbuf_read().

◆ dmmat_release_a2d()

static int dmmat_release_a2d ( struct inode * inode,
struct file * filp )
static

References board, numActualBoards, and stopA2D().

◆ dmmat_release_cntr()

static int dmmat_release_cntr ( struct inode * inode,
struct file * filp )
static

References board, numActualBoards, and stopCNTR().

◆ dmmat_release_d2a()

static int dmmat_release_d2a ( struct inode * inode,
struct file * filp )
static

◆ dmmat_release_d2d()

static int dmmat_release_d2d ( struct inode * inode,
struct file * filp )
static

References board, numActualBoards, and stopD2D().

◆ do_filters()

static void do_filters ( struct DMMAT_A2D * a2d,
dsm_sample_time_t tt,
const short * dp )
static

Invoke filters.

References getA2DDeviceName(), and a2d_sample::id.

Referenced by dmmat_a2d_bottom_half(), and dmmat_a2d_bottom_half_fast().

◆ freeA2DFilters()

static void freeA2DFilters ( struct DMMAT_A2D * a2d)
static

Referenced by resetA2D_processing().

◆ freeFilters()

static void freeFilters ( struct DMMAT_A2D * a2d)
static

Referenced by cleanup_a2d().

◆ getA2DDeviceName()

const char * getA2DDeviceName ( struct DMMAT_A2D * a2d)

◆ getA2DThreshold_MM16AT()

static int getA2DThreshold_MM16AT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

◆ getA2DThreshold_MM32XAT()

static int getA2DThreshold_MM32XAT ( struct DMMAT_A2D * a2d)
static

References DMM32AT_BOARD, getA2DDeviceName(), and MSECS_PER_SEC.

Referenced by init_a2d().

◆ getConvRateMM16AT()

static int getConvRateMM16AT ( struct DMMAT_A2D * a2d,
unsigned char * val )
static

Referenced by init_a2d().

◆ getConvRateMM32XAT()

static int getConvRateMM32XAT ( struct DMMAT_A2D * a2d,
unsigned char * val )
static

Referenced by init_a2d().

◆ getD2A_conv()

static void getD2A_conv ( struct DMMAT_D2A * d2a,
struct DMMAT_D2A_Conversion * conv )
static

◆ getD2A_mult()

static void getD2A_mult ( struct DMMAT_D2A * d2a,
struct DMMAT_D2A_Outputs * outputs )
static

◆ getFifoLevelMM16AT()

static int getFifoLevelMM16AT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

◆ getFifoLevelMM32XAT()

static int getFifoLevelMM32XAT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

◆ getGainSettingMM16AT()

static int getGainSettingMM16AT ( struct DMMAT_A2D * a2d,
int gain,
int bipolar,
unsigned char * val )
static

References getA2DDeviceName().

Referenced by init_a2d().

◆ getGainSettingMM32XAT()

static int getGainSettingMM32XAT ( struct DMMAT_A2D * a2d,
int gain,
int bipolar,
unsigned char * val )
static

References getA2DDeviceName().

Referenced by init_a2d().

◆ getNumA2DChannelsMM16AT()

static int getNumA2DChannelsMM16AT ( struct DMMAT_A2D * a2d)
static

Determine number of available channels - depends on single-ended vs differential jumpering.

Referenced by init_a2d().

◆ getNumA2DChannelsMM32XAT()

static int getNumA2DChannelsMM32XAT ( struct DMMAT_A2D * a2d)
static

Determine number of available channels - depends on single-ended vs differential jumpering.

Referenced by init_a2d().

◆ init_a2d()

static int init_a2d ( struct DMMAT * brd)
static

◆ init_cntr()

static int __init init_cntr ( struct DMMAT * brd)
static

◆ init_d2a()

static int __init init_d2a ( struct DMMAT * brd)
static

◆ init_d2d()

static int __init init_d2d ( struct DMMAT * brd)
static

◆ loadWaveforms_MM16AT()

static int loadWaveforms_MM16AT ( struct DMMAT_D2A * d2a)
static

Referenced by init_d2a().

◆ loadWaveforms_MM32XAT()

static int loadWaveforms_MM32XAT ( struct DMMAT_D2A * d2a)
static

References DMMAT_D2A_OUTPUTS_PER_BRD.

Referenced by init_d2a().

◆ MODULE_AUTHOR()

MODULE_AUTHOR ( "Gordon Maclean <maclean@ucar.edu>" )

◆ MODULE_DESCRIPTION()

MODULE_DESCRIPTION ( "Driver for Diamond DMM analog cards" )

◆ module_exit()

module_exit ( dmd_mmat_cleanup )

◆ module_init()

module_init ( dmd_mmat_init )

◆ MODULE_LICENSE()

MODULE_LICENSE ( "Dual BSD/GPL" )

◆ module_param_array() [1/4]

module_param_array ( d2aconfig ,
int ,
numd2aconfig ,
0  )

◆ module_param_array() [2/4]

module_param_array ( ioports ,
int ,
numboards ,
0  )

◆ module_param_array() [3/4]

module_param_array ( irqs ,
int ,
numirqs ,
0  )

◆ module_param_array() [4/4]

module_param_array ( types ,
int ,
numtypes ,
0  )

◆ MODULE_VERSION()

MODULE_VERSION ( REPO_REVISION )

◆ readLatchedTimer()

static unsigned int readLatchedTimer ( struct DMMAT * brd,
int clock )
static

Read counter value in a 82C54 clock.

Works on both MM16AT and MM32XAT, assuming both have set page bit(s) to 0: MM16AT: bit 6 in base+10 is the page bit MM32XAT: bits 0-2 in base+8 are page bits

Referenced by cntr_timer_fn().

◆ releaseClock12()

static void releaseClock12 ( struct DMMAT * brd)
static

Referenced by stopA2D(), and stopWaveforms().

◆ resetA2D_processing()

static void resetA2D_processing ( struct DMMAT_A2D * a2d)
static

Reset state of data processing.

References free_dsm_circ_buf(), freeA2DFilters(), MAX_DMMAT_A2D_CHANNELS, and work_queue.

Referenced by configA2D(), and stopA2D().

◆ resetFifoMM16AT()

static void resetFifoMM16AT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

◆ resetFifoMM32XAT()

static void resetFifoMM32XAT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

◆ selectA2DChannelsMM16AT()

static int selectA2DChannelsMM16AT ( struct DMMAT_A2D * a2d)
static

returns: 0: ok, -EINVAL: channels out of range.

Referenced by init_a2d().

◆ selectA2DChannelsMM32XAT()

static int selectA2DChannelsMM32XAT ( struct DMMAT_A2D * a2d)
static

returns: 0: ok, -EINVAL: channels out of range.

Referenced by init_a2d().

◆ setClock1InputRate_MM16AT()

static int setClock1InputRate_MM16AT ( struct DMMAT * brd,
int rate )
static

References rate.

Referenced by dmd_mmat_init().

◆ setClock1InputRate_MM32AT()

static int setClock1InputRate_MM32AT ( struct DMMAT * brd,
int rate )
static

References rate.

Referenced by dmd_mmat_init().

◆ setD2A_MM16AT()

static int setD2A_MM16AT ( struct DMMAT_D2A * d2a,
struct DMMAT_D2A_Outputs * outputs,
int iout )
static

References DMMAT_D2A_OUTPUTS_PER_BRD.

Referenced by init_d2a().

◆ setD2A_MM32AT()

static int setD2A_MM32AT ( struct DMMAT_D2A * d2a,
struct DMMAT_D2A_Outputs * outputs,
int iout )
static

References DMMAT_D2A_OUTPUTS_PER_BRD.

Referenced by init_d2a().

◆ setD2A_MM32DXAT()

static int setD2A_MM32DXAT ( struct DMMAT_D2A * d2a,
struct DMMAT_D2A_Outputs * outputs,
int iout )
static

References DMMAT_D2A_OUTPUTS_PER_BRD.

Referenced by init_d2a().

◆ setD2A_mult()

static int setD2A_mult ( struct DMMAT_D2A * d2a,
struct DMMAT_D2A_Outputs * outputs )
static

◆ setTimerClock()

static void setTimerClock ( struct DMMAT * brd,
int clock,
int mode,
unsigned short val )
static

Set counter value in a 82C54 clock.

Works on both MM16AT and MM32XAT, assuming both have set page bit(s) to 0: MM16AT: bit 6 in base+10 is the page bit MM32XAT: bits 0-2 in base+8 are page bits Does not hold a spin_lock.

Referenced by setupClock12(), startCntr_MM16AT(), and startCntr_MM32AT().

◆ setupClock12()

static int setupClock12 ( struct DMMAT * brd,
int inputRate,
int outputRate )
static

References div_10(), and setTimerClock().

Referenced by startA2D(), and startWaveforms().

◆ startA2D()

static int startA2D ( struct DMMAT_A2D * a2d)
static

◆ startA2D_MM16AT()

static void startA2D_MM16AT ( struct DMMAT_A2D * a2d)
static

◆ startA2D_MM32XAT()

static void startA2D_MM32XAT ( struct DMMAT_A2D * a2d)
static

◆ startAutoCal_MM32XAT()

static int startAutoCal_MM32XAT ( struct DMMAT_A2D * a2d)
static

Referenced by dmmat_ioctl_a2d().

◆ startCNTR()

static int startCNTR ( struct DMMAT_CNTR * cntr,
struct DMMAT_CNTR_Config * cfg )
static

General function to start a counter.

Calls the board specific method.

References dmd_mmat_add_irq_user(), DMMAT_CNTR_Config::msecPeriod, MSECS_PER_SEC, and stopCNTR().

Referenced by dmmat_ioctl_cntr().

◆ startCntr_MM16AT()

static int startCntr_MM16AT ( struct DMMAT_CNTR * cntr)
static

References setTimerClock().

Referenced by init_cntr().

◆ startCntr_MM32AT()

static int startCntr_MM32AT ( struct DMMAT_CNTR * cntr)
static

References setTimerClock().

Referenced by init_cntr().

◆ startD2D()

static int startD2D ( struct DMMAT_D2D * d2d)
static

◆ startD2D_MM16AT()

static void startD2D_MM16AT ( struct DMMAT_D2D * d2d)
static

Referenced by init_d2d().

◆ startD2D_MM32XAT()

static void startD2D_MM32XAT ( struct DMMAT_D2D * d2d)
static

Referenced by init_d2d().

◆ startWaveforms()

static int startWaveforms ( struct DMMAT_D2A * d2a)
static

References setupClock12().

Referenced by dmmat_ioctl_d2a(), and startD2D().

◆ startWaveforms_MM16AT()

static void startWaveforms_MM16AT ( struct DMMAT_D2A * d2a)
static

Referenced by init_d2a().

◆ startWaveforms_MM32XAT()

static void startWaveforms_MM32XAT ( struct DMMAT_D2A * d2a)
static

Referenced by init_d2a().

◆ stopA2D()

static void stopA2D ( struct DMMAT_A2D * a2d)
static

General function to stop the A2D.

Calls the board specific method. a2d->mutex should be locked, so that a2d->running reflects the current state of the A2D.

References dmd_mmat_remove_irq_user(), getA2DDeviceName(), releaseClock12(), and resetA2D_processing().

Referenced by dmmat_ioctl_a2d(), dmmat_release_a2d(), and stopD2D().

◆ stopA2D_MM16AT()

static void stopA2D_MM16AT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

◆ stopA2D_MM32XAT()

static void stopA2D_MM32XAT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

◆ stopCNTR()

static int stopCNTR ( struct DMMAT_CNTR * cntr)
static

General function to stop a counter.

Calls the board specific method.

References dmd_mmat_remove_irq_user().

Referenced by dmmat_ioctl_cntr(), dmmat_release_cntr(), and startCNTR().

◆ stopCntr_MM16AT()

static void stopCntr_MM16AT ( struct DMMAT_CNTR * cntr)
static

Referenced by init_cntr().

◆ stopCntr_MM32AT()

static void stopCntr_MM32AT ( struct DMMAT_CNTR * cntr)
static

Referenced by init_cntr().

◆ stopD2D()

static int stopD2D ( struct DMMAT_D2D * d2d)
static

References stopA2D(), and stopWaveforms().

Referenced by dmmat_ioctl_d2d(), and dmmat_release_d2d().

◆ stopD2D_MM16AT()

static void stopD2D_MM16AT ( struct DMMAT_D2D * d2d)
static

Referenced by init_d2d().

◆ stopD2D_MM32XAT()

static void stopD2D_MM32XAT ( struct DMMAT_D2D * d2d)
static

Referenced by init_d2d().

◆ stopWaveforms()

static void stopWaveforms ( struct DMMAT_D2A * d2a)
static

General function to stop the D2A waveform.

Calls the board specific method. d2da>waveform_mutex should be locked, so that d2a->waveform_running reflects the current state of the A2D.

References DMMAT_D2A_OUTPUTS_PER_BRD, and releaseClock12().

Referenced by dmmat_ioctl_d2a(), dmmat_release_d2a(), and stopD2D().

◆ stopWaveforms_MM16AT()

static void stopWaveforms_MM16AT ( struct DMMAT_D2A * d2a)
static

Referenced by init_d2a().

◆ stopWaveforms_MM32XAT()

static void stopWaveforms_MM32XAT ( struct DMMAT_D2A * d2a)
static

Referenced by init_d2a().

◆ waitForA2DSettleMM16AT()

static void waitForA2DSettleMM16AT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

◆ waitForA2DSettleMM32XAT()

static void waitForA2DSettleMM32XAT ( struct DMMAT_A2D * a2d)
static

Referenced by init_a2d().

Variable Documentation

◆ a2d_fops

struct file_operations a2d_fops
static
Initial value:
= {
.owner = THIS_MODULE,
.read = dmmat_read_a2d,
.poll = dmmat_poll_a2d,
.open = dmmat_open_a2d,
.unlocked_ioctl = dmmat_ioctl_a2d,
.release = dmmat_release_a2d,
.llseek = no_llseek,
}
static int dmmat_release_a2d(struct inode *inode, struct file *filp)
Definition dmd_mmat.c:2878
static unsigned int dmmat_poll_a2d(struct file *filp, poll_table *wait)
Definition dmd_mmat.c:2916
static ssize_t dmmat_read_a2d(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
Definition dmd_mmat.c:2930
static long dmmat_ioctl_a2d(struct file *filp, unsigned int cmd, unsigned long arg)
Definition dmd_mmat.c:2938
static int dmmat_open_a2d(struct inode *inode, struct file *filp)
Definition dmd_mmat.c:2846

Referenced by init_a2d().

◆ board

struct DMMAT* board = 0
static

◆ BOARD_TYPE_STRS

const char* BOARD_TYPE_STRS[]
static
Initial value:
= {
"DMM16AT", "DMM32AT", "DMM32XAT", "DMM32DXAT"}

Referenced by dmd_mmat_init().

◆ cntr_fops

struct file_operations cntr_fops
static
Initial value:
= {
.owner = THIS_MODULE,
.read = dmmat_read_cntr,
.poll = dmmat_poll_cntr,
.open = dmmat_open_cntr,
.unlocked_ioctl = dmmat_ioctl_cntr,
.release = dmmat_release_cntr,
.llseek = no_llseek,
}
static long dmmat_ioctl_cntr(struct file *filp, unsigned int cmd, unsigned long arg)
Definition dmd_mmat.c:3167
unsigned int dmmat_poll_cntr(struct file *filp, poll_table *wait)
Definition dmd_mmat.c:3244
static int dmmat_open_cntr(struct inode *inode, struct file *filp)
Definition dmd_mmat.c:3099
static int dmmat_release_cntr(struct inode *inode, struct file *filp)
Definition dmd_mmat.c:3130
static ssize_t dmmat_read_cntr(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
Definition dmd_mmat.c:3158

Referenced by init_cntr().

◆ d2a_fops

struct file_operations d2a_fops
static
Initial value:
= {
.owner = THIS_MODULE,
.open = dmmat_open_d2a,
.unlocked_ioctl = dmmat_ioctl_d2a,
.release = dmmat_release_d2a,
.llseek = no_llseek,
}
static long dmmat_ioctl_d2a(struct file *filp, unsigned int cmd, unsigned long arg)
Definition dmd_mmat.c:3324
static int dmmat_open_d2a(struct inode *inode, struct file *filp)
Definition dmd_mmat.c:3265
static int dmmat_release_d2a(struct inode *inode, struct file *filp)
Definition dmd_mmat.c:3293

Referenced by init_d2a().

◆ d2aconfig

int d2aconfig[MAX_DMMAT_BOARDS] = { DMMAT_D2A_UNI_5, 0, 0, 0 }
static

Referenced by init_d2a().

◆ d2d_fops

struct file_operations d2d_fops
static
Initial value:
= {
.owner = THIS_MODULE,
.read = dmmat_read_d2d,
.poll = dmmat_poll_d2d,
.open = dmmat_open_d2d,
.unlocked_ioctl = dmmat_ioctl_d2d,
.release = dmmat_release_d2d,
.llseek = no_llseek,
}
static ssize_t dmmat_read_d2d(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
Definition dmd_mmat.c:3564
static int dmmat_open_d2d(struct inode *inode, struct file *filp)
Definition dmd_mmat.c:3472
static long dmmat_ioctl_d2d(struct file *filp, unsigned int cmd, unsigned long arg)
Definition dmd_mmat.c:3574
static unsigned int dmmat_poll_d2d(struct file *filp, poll_table *wait)
Definition dmd_mmat.c:3547
static int dmmat_release_d2d(struct inode *inode, struct file *filp)
Definition dmd_mmat.c:3510

Referenced by init_d2d().

◆ dmmat_class

struct class* dmmat_class
static

◆ dmmat_device

dev_t dmmat_device = MKDEV(0,0)
static

◆ ioports

unsigned int ioports[MAX_DMMAT_BOARDS] = { 0x380, 0, 0, 0 }
static

Referenced by dmd_mmat_init().

◆ irqs

int irqs[MAX_DMMAT_BOARDS] = { 12, 0, 0, 0 }
static

◆ numActualBoards

int numActualBoards = 0
static

◆ numboards

int numboards = 0
static

Referenced by dmd_mmat_cleanup(), and dmd_mmat_init().

◆ numd2aconfig

int numd2aconfig = 0
static

◆ numirqs

int numirqs = 0
static

◆ numtypes

int numtypes = 0
static

◆ types

int types[MAX_DMMAT_BOARDS] = { DMM32DXAT_BOARD, 0, 0, 0 }
static

Referenced by dmd_mmat_init().

◆ work_queue

struct workqueue_struct* work_queue = 0
static