nidas  v1.2-1520
Macros | Functions | Variables
usbtwod.c File Reference
#include "usbtwod.h"
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/poll.h>
#include <linux/timer.h>
#include <linux/moduleparam.h>
#include <nidas/linux/klog.h>
#include <nidas/linux/Revision.h>

Macros

#define REPO_REVISION   "unknown"
 
#define NCAR_VENDOR_ID   0x2D2D
 
#define USB2D_64_PRODUCT_ID   0x2D00
 
#define USB2D_32_PRODUCT_ID   0x2D01
 
#define USB2D_64_V3_PRODUCT_ID   0x2D03
 
#define TWOD_MUTEX_LOCK(d)   mutex_lock(d);
 
#define TWOD_MUTEX_UNLOCK(d)   mutex_unlock(d);
 

Functions

 MODULE_DEVICE_TABLE (usb, twod_table)
 
static DEFINE_MUTEX (twod_open_lock)
 
 MODULE_PARM_DESC (throttleRate,"desired sampling rate (image/sec). 100/N or 100*N where N is integer, or 0 to sample as fast as possible")
 
 module_param (throttleRate, uint, 0)
 
static void twod_dev_free (struct usb_twod *dev)
 
static void twod_dev_delete (struct kref *kref)
 
static void twod_tas_tx_bulk_callback (struct urb *urb)
 
static struct urb * twod_make_tas_urb (struct usb_twod *dev)
 
static int write_tas (struct usb_twod *dev)
 
static void send_tas_timer_func (struct timer_list *tlist)
 
static int twod_set_sor_rate (struct usb_twod *dev, int rate)
 
static int usb_twod_submit_img_urb (struct usb_twod *dev, struct urb *urb)
 
static int usb_twod_submit_sor_urb (struct usb_twod *dev, struct urb *urb)
 
static void urb_throttle_func (struct timer_list *tlist)
 
static void twod_img_rx_bulk_callback (struct urb *urb)
 
static struct urb * twod_make_img_urb (struct usb_twod *dev)
 
static void twod_sor_rx_bulk_callback (struct urb *urb)
 
static struct urb * twod_make_sor_urb (struct usb_twod *dev)
 
static int twod_open (struct inode *inode, struct file *file)
 
static int twod_release (struct inode *inode, struct file *file)
 
static unsigned int twod_poll (struct file *file, poll_table *wait)
 
static ssize_t twod_read (struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 
static long twod_ioctl (struct file *file, unsigned int cmd, unsigned long arg)
 
static int twod_probe (struct usb_interface *interface, const struct usb_device_id *id)
 
static void twod_disconnect (struct usb_interface *interface)
 
static int __init usb_twod_init (void)
 
static void __exit usb_twod_exit (void)
 
 module_init (usb_twod_init)
 
 module_exit (usb_twod_exit)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Chris Webster <cjw@ucar.edu>")
 
 MODULE_DESCRIPTION ("USB PMS-2D Probe Driver")
 
 MODULE_VERSION (REPO_REVISION)
 

Variables

static struct usb_device_id twod_table []
 
static unsigned int throttleRate = 0
 
static struct usb_driver twod_driver
 
static struct file_operations twod_fops
 
static struct usb_class_driver usbtwod_64
 
static struct usb_class_driver usbtwod_32
 

Macro Definition Documentation

#define NCAR_VENDOR_ID   0x2D2D
#define REPO_REVISION   "unknown"

Referenced by usb_twod_init().

#define TWOD_MUTEX_LOCK (   d)    mutex_lock(d);

Referenced by twod_disconnect(), and twod_open().

#define TWOD_MUTEX_UNLOCK (   d)    mutex_unlock(d);

Referenced by twod_disconnect(), and twod_open().

#define USB2D_32_PRODUCT_ID   0x2D01
#define USB2D_64_PRODUCT_ID   0x2D00
#define USB2D_64_V3_PRODUCT_ID   0x2D03

Referenced by twod_probe().

Function Documentation

static DEFINE_MUTEX ( twod_open_lock  )
static
MODULE_AUTHOR ( "Chris Webster <cjw@ucar.edu>"  )
MODULE_DESCRIPTION ( "USB PMS-2D Probe Driver"  )
MODULE_DEVICE_TABLE ( usb  ,
twod_table   
)
module_exit ( usb_twod_exit  )
module_init ( usb_twod_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( throttleRate  ,
uint  ,
 
)
MODULE_PARM_DESC ( throttleRate  ,
"desired sampling rate (image/sec). 100/N or 100*N where N is  integer,
or 0 to sample as fast as possible"   
)
MODULE_VERSION ( REPO_REVISION  )
static void send_tas_timer_func ( struct timer_list *  tlist)
static

References write_tas().

Referenced by twod_open().

static void twod_dev_delete ( struct kref *  kref)
static
static void twod_dev_free ( struct usb_twod *  dev)
static

Referenced by twod_dev_delete(), and twod_release().

static void twod_disconnect ( struct usb_interface *  interface)
static
static void twod_img_rx_bulk_callback ( struct urb *  urb)
static
static long twod_ioctl ( struct file *  file,
unsigned int  cmd,
unsigned long  arg 
)
static
static struct urb* twod_make_img_urb ( struct usb_twod *  dev)
static

References twod_img_rx_bulk_callback().

Referenced by twod_open().

static struct urb* twod_make_sor_urb ( struct usb_twod *  dev)
static

References twod_sor_rx_bulk_callback().

Referenced by twod_open().

static struct urb* twod_make_tas_urb ( struct usb_twod *  dev)
static

References twod_tas_tx_bulk_callback().

Referenced by twod_open().

static int twod_open ( struct inode *  inode,
struct file *  file 
)
static
static unsigned int twod_poll ( struct file *  file,
poll_table *  wait 
)
static
static int twod_probe ( struct usb_interface *  interface,
const struct usb_device_id *  id 
)
static
static ssize_t twod_read ( struct file *  file,
char __user *  buffer,
size_t  count,
loff_t *  ppos 
)
static
static int twod_release ( struct inode *  inode,
struct file *  file 
)
static
static int twod_set_sor_rate ( struct usb_twod *  dev,
int  rate 
)
static

References rate, and TMSECS_PER_SEC.

Referenced by twod_ioctl(), and twod_release().

static void twod_sor_rx_bulk_callback ( struct urb *  urb)
static
static void twod_tas_tx_bulk_callback ( struct urb *  urb)
static

Referenced by twod_make_tas_urb().

static void urb_throttle_func ( struct timer_list *  tlist)
static

Referenced by twod_open().

static void __exit usb_twod_exit ( void  )
static
static int __init usb_twod_init ( void  )
static

References REPO_REVISION.

static int usb_twod_submit_img_urb ( struct usb_twod *  dev,
struct urb *  urb 
)
static
static int usb_twod_submit_sor_urb ( struct usb_twod *  dev,
struct urb *  urb 
)
static
static int write_tas ( struct usb_twod *  dev)
static

Referenced by send_tas_timer_func().

Variable Documentation

unsigned int throttleRate = 0
static
static struct usb_driver twod_driver
static
Initial value:
= {
.name = "usbtwod",
.id_table = twod_table,
.probe = twod_probe,
.disconnect = twod_disconnect,
}
static int twod_probe(struct usb_interface *interface, const struct usb_device_id *id)
Definition: usbtwod.c:1353
static struct usb_device_id twod_table[]
Definition: usbtwod.c:82
static void twod_disconnect(struct usb_interface *interface)
Definition: usbtwod.c:1500

Referenced by twod_open().

struct file_operations twod_fops
static
Initial value:
= {
.owner = THIS_MODULE,
.read = twod_read,
.poll = twod_poll,
.unlocked_ioctl = twod_ioctl,
.open = twod_open,
.release = twod_release,
.llseek = no_llseek,
}
static int twod_open(struct inode *inode, struct file *file)
Definition: usbtwod.c:888
static unsigned int twod_poll(struct file *file, poll_table *wait)
Definition: usbtwod.c:1160
static long twod_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
Definition: usbtwod.c:1263
static int twod_release(struct inode *inode, struct file *file)
Definition: usbtwod.c:1093
static ssize_t twod_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
Definition: usbtwod.c:1173
struct usb_device_id twod_table[]
static
Initial value:
= {
{}
}
#define USB2D_32_PRODUCT_ID
Definition: usbtwod.c:73
#define NCAR_VENDOR_ID
Definition: usbtwod.c:71
#define USB2D_64_PRODUCT_ID
Definition: usbtwod.c:72
#define USB2D_64_V3_PRODUCT_ID
Definition: usbtwod.c:74
struct usb_class_driver usbtwod_32
static
Initial value:
= {
.name = "usbtwod_32_%d",
.fops = &twod_fops,
.minor_base = USB_TWOD_32_MINOR_BASE,
}
static struct file_operations twod_fops
Definition: usbtwod.c:1323
struct usb_class_driver usbtwod_64
static
Initial value:
= {
.name = "usbtwod_64_%d",
.fops = &twod_fops,
.minor_base = USB_TWOD_64_MINOR_BASE,
}
static struct file_operations twod_fops
Definition: usbtwod.c:1323