nidas v1.2.3
|
#include <linux/types.h>
#include <linux/module.h>
#include <linux/version.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 "gpio_mm.h"
#include <nidas/linux/ver_macros.h>
#include <nidas/linux/klog.h>
#include <nidas/linux/util.h>
#include <nidas/linux/isa_bus.h>
#include <nidas/linux/Revision.h>
Macros | |
#define | IRQF_SHARED SA_SHIRQ |
#define | REPO_REVISION "unknown" |
#define | BUFFER_POLL |
#define | BUFFER_POLL |
Functions | |
module_param_array (ioports_dio, uint, numboards_dio, 0) | |
module_param_array (ioports, uint, numboards, 0) | |
module_param_array (irqa, int, numirqa, 0) | |
module_param_array (irqb, int, numirqb, 0) | |
module_param (clockHZ, int, 0) | |
MODULE_AUTHOR ("Gordon Maclean <maclean@ucar.edu>") | |
MODULE_LICENSE ("Dual BSD/GPL") | |
MODULE_DESCRIPTION ("Driver for Diamond GPIO card") | |
MODULE_VERSION (REPO_REVISION) | |
static int | gcd (unsigned int a, unsigned int b) |
static void | gpio_mm_set_master_mode (struct GPIO_MM *brd, int chip) |
static void | gpio_mm_setup_counter (struct GPIO_MM *brd, int icntr, unsigned char lmode, unsigned char hmode) |
static void | gpio_mm_cmd_counter (struct GPIO_MM *brd, int icntr, unsigned char cmd) |
static void | gpio_mm_cmd_counters (struct GPIO_MM *brd, int icntr1, int icntr2, unsigned char cmd) |
static void | gpio_mm_arm_counter (struct GPIO_MM *brd, int icntr) |
static void | gpio_mm_arm_counters (struct GPIO_MM *brd, int icntr1, int icntr2) |
static void | gpio_mm_load_counter (struct GPIO_MM *brd, int icntr) |
static void | gpio_mm_load_arm_counter (struct GPIO_MM *brd, int icntr) |
static void | gpio_mm_load_arm_counters (struct GPIO_MM *brd, int icntr1, int icntr2) |
static void | gpio_mm_disarm_counter (struct GPIO_MM *brd, int icntr) |
static void | gpio_mm_disarm_counters (struct GPIO_MM *brd, int icntr1, int icntr2) |
static void | gpio_mm_disarm_save_counter (struct GPIO_MM *brd, int icntr) |
static void | gpio_mm_disarm_save_counters (struct GPIO_MM *brd, int icntr1, int icntr2) |
static void | gpio_mm_set_reg (struct GPIO_MM *brd, int icntr, unsigned short val, unsigned char reg) |
static unsigned short | gpio_mm_get_reg (struct GPIO_MM *brd, int icntr, unsigned char reg) |
static void | gpio_mm_set_load_reg (struct GPIO_MM *brd, int icntr, unsigned short val) |
static void | gpio_mm_set_hold_reg (struct GPIO_MM *brd, int icntr, unsigned short val) |
static unsigned short | gpio_mm_get_hold_reg (struct GPIO_MM *brd, int icntr) |
static void | gpio_mm_set_toggle_out (struct GPIO_MM *brd, int icntr) |
static void | gpio_mm_clear_toggle_out (struct GPIO_MM *brd, int icntr) |
static unsigned char | gpio_mm_get_output_status (struct GPIO_MM *brd, int icntr) |
static int | compute_timer_ticks (struct list_head *cblist, unsigned int *maxUsecsp) |
static int | check_timer_interval (struct GPIO_MM *brd, unsigned int usecs) |
static void | set_ticks (struct GPIO_MM_timer *timer, unsigned int usecs, unsigned int maxUsecs, unsigned short *initial_ticsp) |
static void | start_gpio_timer (struct GPIO_MM_timer *timer, unsigned int usecs, unsigned int maxUsecs) |
static void | stop_gpio_timer (struct GPIO_MM_timer *timer) |
static void | handlePendingCallbacks (struct GPIO_MM_timer *timer) |
static void | free_timer_callbacks (struct GPIO_MM_timer *timer) |
static void | gpio_mm_timer_bottom_half (unsigned long dev) |
static irqreturn_t | gpio_mm_timer_irq_handler (int irq, void *dev_id) |
static irqreturn_t | gpio_mm_event_irq_handler (int irq, void *dev_id) |
static int | gpio_mm_set_irq_user (struct GPIO_MM *brd, int irq_ab, irq_handler_t handler) |
static int | gpio_mm_remove_irq_user (struct GPIO_MM *brd, int irq_ab) |
static int | gpio_mm_set_timer_irq_user (struct GPIO_MM *brd) |
static int | gpio_mm_remove_timer_irq_user (struct GPIO_MM *brd) |
static int | gpio_mm_reserve_cntrs (struct GPIO_MM *brd, int ic1, int icn) |
static int | gpio_mm_free_cntrs (struct GPIO_MM *brd, int ic0, int icn) |
static int | get_pulse_counter (struct GPIO_MM_fcntr *fcntr) |
static int | gpio_mm_setup_fcntr (struct GPIO_MM_fcntr *fcntr) |
static int | gpio_mm_stop_fcntr (struct GPIO_MM_fcntr *fcntr) |
static void | fcntr_timer_callback_func (void *privateData) |
static int | start_fcntr (struct GPIO_MM_fcntr *fcntr, struct GPIO_MM_fcntr_config *cfg) |
static int | stop_fcntr (struct GPIO_MM_fcntr *fcntr) |
static int | gpio_mm_open_fcntr (struct inode *inode, struct file *filp) |
static int | gpio_mm_release_fcntr (struct inode *inode, struct file *filp) |
static ssize_t | gpio_mm_read_fcntr (struct file *filp, char __user *buf, size_t count, loff_t *f_pos) |
static long | gpio_mm_ioctl_fcntr (struct file *filp, unsigned int cmd, unsigned long arg) |
unsigned int | gpio_mm_poll_fcntr (struct file *filp, poll_table *wait) |
static int | gpio_mm_setup_event (struct GPIO_MM_event *event) |
static int | gpio_mm_stop_event (struct GPIO_MM_event *event) |
static int | start_event (struct GPIO_MM_event *event, struct GPIO_MM_event_config *cfg) |
static int | stop_event (struct GPIO_MM_event *event) |
static int | gpio_mm_open_event (struct inode *inode, struct file *filp) |
static int | gpio_mm_release_event (struct inode *inode, struct file *filp) |
static ssize_t | gpio_mm_read_event (struct file *filp, char __user *buf, size_t count, loff_t *f_pos) |
static long | gpio_mm_ioctl_event (struct file *filp, unsigned int cmd, unsigned long arg) |
unsigned int | gpio_mm_poll_event (struct file *filp, poll_table *wait) |
static int | cleanup_fcntrs (struct GPIO_MM *brd) |
static int | init_fcntrs (struct GPIO_MM *brd) |
static int | cleanup_event (struct GPIO_MM *brd) |
static int | init_event (struct GPIO_MM *brd) |
static struct gpio_timer_callback * | register_gpio_timer_callback_priv (struct GPIO_MM_timer *timer, gpio_timer_callback_func_t callback, unsigned int usecs, void *privateData, int *errp) |
static long | unregister_gpio_timer_callback_priv (struct GPIO_MM_timer *timer, struct gpio_timer_callback *cb, int wait) |
struct gpio_timer_callback * | register_gpio_timer_callback (gpio_timer_callback_func_t callback, unsigned int usecs, void *privateData, int *errp) |
EXPORT_SYMBOL (register_gpio_timer_callback) | |
long | unregister_gpio_timer_callback (struct gpio_timer_callback *cb, int wait) |
EXPORT_SYMBOL (unregister_gpio_timer_callback) | |
static void | cleanup_gpio_timer (struct GPIO_MM_timer *timer) |
static struct GPIO_MM_timer * | init_gpio_timer (struct GPIO_MM *brd) |
static void | gpio_mm_cleanup (void) |
static int __init | gpio_mm_init (void) |
module_init (gpio_mm_init) | |
module_exit (gpio_mm_cleanup) | |
Variables | |
static const char * | driver_name = "gpio_mm" |
static unsigned int | ioports [MAX_GPIO_MM_BOARDS] ={ 0x080, 0, 0, 0 , 0} |
static unsigned int | ioports_dio [MAX_GPIO_MM_BOARDS] = { 0x040, 0, 0, 0, 0 } |
static int | numboards = 0 |
static int | numboards_alloc = 0 |
static int | numboards_dio = 0 |
static int | irqa [MAX_GPIO_MM_BOARDS] = { 3, 0, 0, 0, 0 } |
static int | irqb [MAX_GPIO_MM_BOARDS] = { 0, 0, 0, 0, 0 } |
static int | numirqa = 0 |
static int | numirqb = 0 |
static int | clockHZ = GPIO_MM_CT_CLOCK_HZ |
static dev_t | gpio_mm_device = MKDEV(0,0) |
static struct GPIO_MM * | board = 0 |
static struct class * | gpio_mm_class |
static struct file_operations | fcntr_fops |
static struct file_operations | event_fops |
#define BUFFER_POLL |
#define BUFFER_POLL |
#define IRQF_SHARED SA_SHIRQ |
Referenced by gpio_mm_set_irq_user().
#define REPO_REVISION "unknown" |
Referenced by gpio_mm_init().
|
static |
References clockHZ, GPIO_MM_CT_CLOCK_HZ, and USECS_PER_SEC.
Referenced by register_gpio_timer_callback_priv().
|
static |
References free_dsm_circ_buf(), gpio_mm_class, and stop_event().
Referenced by gpio_mm_cleanup().
|
static |
References free_dsm_circ_buf(), gpio_mm_class, and stop_fcntr().
Referenced by gpio_mm_cleanup().
|
static |
References free_timer_callbacks(), gpio_mm_remove_timer_irq_user(), and stop_gpio_timer().
Referenced by gpio_mm_cleanup().
|
static |
References gcd().
Referenced by handlePendingCallbacks().
EXPORT_SYMBOL | ( | register_gpio_timer_callback | ) |
EXPORT_SYMBOL | ( | unregister_gpio_timer_callback | ) |
|
static |
|
static |
Referenced by cleanup_gpio_timer().
|
static |
References gcd().
Referenced by compute_timer_ticks(), and gcd().
|
static |
Referenced by fcntr_timer_callback_func(), gpio_mm_setup_fcntr(), and gpio_mm_stop_fcntr().
|
inlinestatic |
References CTS9513_ARM, and gpio_mm_cmd_counter().
Referenced by start_gpio_timer().
|
inlinestatic |
References CTS9513_ARM, and gpio_mm_cmd_counters().
|
static |
References board, cleanup_event(), cleanup_fcntrs(), cleanup_gpio_timer(), gpio_mm_class, gpio_mm_device, GPIO_MM_RESET_ID, numboards, numboards_alloc, and unregister_gpio_timer_callback().
Referenced by gpio_mm_init().
|
static |
References CTS9513_CLEAR_TOGGLE_OUT, GPIO_MM_9513_PTR, and GPIO_MM_CNTR_PER_CHIP.
|
static |
References GPIO_MM_9513_PTR, and GPIO_MM_CNTR_PER_CHIP.
Referenced by gpio_mm_arm_counter(), gpio_mm_disarm_counter(), gpio_mm_disarm_save_counter(), gpio_mm_load_arm_counter(), and gpio_mm_load_counter().
|
static |
References GPIO_MM_9513_PTR, and GPIO_MM_CNTR_PER_CHIP.
Referenced by gpio_mm_arm_counters(), gpio_mm_disarm_counters(), gpio_mm_disarm_save_counters(), and gpio_mm_load_arm_counters().
|
inlinestatic |
References CTS9513_DISARM, and gpio_mm_cmd_counter().
Referenced by gpio_mm_stop_fcntr(), and stop_gpio_timer().
|
inlinestatic |
References CTS9513_DISARM, and gpio_mm_cmd_counters().
Referenced by gpio_mm_stop_fcntr().
|
static |
References CTS9513_DISARM_SAVE, and gpio_mm_cmd_counter().
Referenced by fcntr_timer_callback_func().
|
inlinestatic |
References CTS9513_DISARM_SAVE, and gpio_mm_cmd_counters().
Referenced by fcntr_timer_callback_func().
|
static |
References GPIO_MM_IRQ_CTL_STATUS.
Referenced by gpio_mm_setup_event().
|
static |
Referenced by gpio_mm_stop_fcntr().
|
inlinestatic |
References CTS9513_DPTR_CNTR1_HOLD, and gpio_mm_get_reg().
Referenced by fcntr_timer_callback_func().
|
static |
References CTS9513_DPTR_STATUS, GPIO_MM_9513_DATA, GPIO_MM_9513_PTR, and GPIO_MM_CNTR_PER_CHIP.
Referenced by fcntr_timer_callback_func().
|
static |
References GPIO_MM_9513_DATA, GPIO_MM_9513_PTR, and GPIO_MM_CNTR_PER_CHIP.
Referenced by gpio_mm_get_hold_reg().
|
static |
References board, clockHZ, CTS9513_MMH_BCD, CTS9513_MMH_DP_ENABLE, CTS9513_MMH_FOUT_DIV1, CTS9513_MMH_FOUT_ON, CTS9513_MMH_WIDTH_8, CTS9513_MML_FOUT_G2, CTS9513_MML_NO_COMP, driver_name, err, gpio_mm_class, gpio_mm_cleanup(), GPIO_MM_CT_CLOCK_HZ, gpio_mm_device, GPIO_MM_FPGA_REV, GPIO_MM_IRQ_CTL_STATUS, gpio_mm_reserve_cntrs(), GPIO_MM_RESET_ID, gpio_mm_set_master_mode(), init_event(), init_fcntrs(), init_gpio_timer(), ioports, ioports_dio, irqa, irqb, numboards, numboards_alloc, numboards_dio, register_gpio_timer_callback(), REPO_REVISION, and USECS_PER_SEC.
|
static |
References err, GPIO_MM_EVENT_GET_STATUS, GPIO_MM_EVENT_START, GPIO_MM_IOC_MAGIC, GPIO_MM_IOC_MAXNR, and start_event().
|
static |
References err, GPIO_MM_FCNTR_GET_STATUS, GPIO_MM_FCNTR_START, GPIO_MM_IOC_MAGIC, GPIO_MM_IOC_MAXNR, and start_fcntr().
|
inlinestatic |
References CTS9513_LOAD_ARM, and gpio_mm_cmd_counter().
Referenced by fcntr_timer_callback_func(), and gpio_mm_setup_fcntr().
|
inlinestatic |
References CTS9513_LOAD_ARM, and gpio_mm_cmd_counters().
Referenced by fcntr_timer_callback_func(), and gpio_mm_setup_fcntr().
|
static |
References CTS9513_LOAD, and gpio_mm_cmd_counter().
Referenced by start_gpio_timer().
|
static |
|
static |
unsigned int gpio_mm_poll_event | ( | struct file * | filp, |
poll_table * | wait ) |
unsigned int gpio_mm_poll_fcntr | ( | struct file * | filp, |
poll_table * | wait ) |
|
static |
References nidas_circbuf_read().
|
static |
References nidas_circbuf_read().
|
static |
References board, numboards, and stop_event().
|
static |
References board, numboards, and stop_fcntr().
|
static |
Referenced by gpio_mm_remove_timer_irq_user(), and gpio_mm_stop_event().
|
static |
References gpio_mm_remove_irq_user().
Referenced by cleanup_gpio_timer().
|
static |
Referenced by gpio_mm_init(), and gpio_mm_setup_fcntr().
|
inlinestatic |
References CTS9513_DPTR_CNTR1_HOLD, and gpio_mm_set_reg().
Referenced by fcntr_timer_callback_func(), and gpio_mm_setup_fcntr().
|
static |
References driver_name, and IRQF_SHARED.
Referenced by gpio_mm_set_timer_irq_user(), and gpio_mm_setup_event().
|
inlinestatic |
References CTS9513_DPTR_CNTR1_LOAD, and gpio_mm_set_reg().
Referenced by gpio_mm_setup_fcntr(), and start_gpio_timer().
|
static |
References CTS9513_DPTR_MASTER_MODE, GPIO_MM_9513_DATA, and GPIO_MM_9513_PTR.
Referenced by gpio_mm_init().
|
static |
References GPIO_MM_9513_DATA, GPIO_MM_9513_PTR, and GPIO_MM_CNTR_PER_CHIP.
Referenced by gpio_mm_set_hold_reg(), and gpio_mm_set_load_reg().
|
static |
References gpio_mm_set_irq_user(), and gpio_mm_timer_irq_handler().
Referenced by init_gpio_timer().
|
static |
References CTS9513_SET_TOGGLE_OUT, GPIO_MM_9513_PTR, and GPIO_MM_CNTR_PER_CHIP.
Referenced by fcntr_timer_callback_func(), and gpio_mm_setup_fcntr().
|
static |
References CTS9513_DPTR_CNTR1_MODE, GPIO_MM_9513_DATA, GPIO_MM_9513_PTR, GPIO_MM_CNTR_PER_BOARD, and GPIO_MM_CNTR_PER_CHIP.
Referenced by gpio_mm_setup_fcntr(), and start_gpio_timer().
|
static |
References gpio_mm_event_irq_handler(), GPIO_MM_IRQ_CTL_STATUS, GPIO_MM_IRQ_SRC, and gpio_mm_set_irq_user().
Referenced by start_event().
|
static |
References CTS9513_CMH_EDGE_RISING, CTS9513_CMH_GATE_LO_GN, CTS9513_CMH_NO_GATE, CTS9513_CMH_SRC_F1, CTS9513_CMH_SRC_S1, CTS9513_CMH_SRC_TCNM1, CTS9513_CML_CNT_BIN, CTS9513_CML_CNT_DN, CTS9513_CML_CNT_UP, CTS9513_CML_GATE_NORETRIG, CTS9513_CML_ONCE, CTS9513_CML_OUT_HIGH_ON_TC, CTS9513_CML_OUT_LOW, CTS9513_CML_OUT_TC_TOGGLE, CTS9513_CML_RELOAD_BOTH, CTS9513_CML_RELOAD_LOAD, CTS9513_CML_REPEAT, get_pulse_counter(), GPIO_MM_CNTR_PER_CHIP, gpio_mm_load_arm_counter(), gpio_mm_load_arm_counters(), gpio_mm_reserve_cntrs(), gpio_mm_set_hold_reg(), gpio_mm_set_load_reg(), gpio_mm_set_toggle_out(), and gpio_mm_setup_counter().
Referenced by start_fcntr().
|
static |
References GPIO_MM_IRQ_CTL_STATUS, and gpio_mm_remove_irq_user().
Referenced by stop_event().
|
static |
References get_pulse_counter(), gpio_mm_disarm_counter(), gpio_mm_disarm_counters(), and gpio_mm_free_cntrs().
Referenced by stop_fcntr().
|
static |
References handlePendingCallbacks().
Referenced by init_gpio_timer().
|
static |
References GPIO_MM_IRQ_CTL_STATUS.
Referenced by gpio_mm_set_timer_irq_user().
|
static |
References compute_timer_ticks(), set_ticks(), start_gpio_timer(), and stop_gpio_timer().
|
static |
References alloc_dsm_circ_buf(), event_fops, gpio_mm_class, and gpio_mm_device.
Referenced by gpio_mm_init().
|
static |
References alloc_dsm_circ_buf(), fcntr_fops, gpio_mm_class, and gpio_mm_device.
Referenced by gpio_mm_init().
|
static |
References CALLBACK_POOL_SIZE, gpio_mm_set_timer_irq_user(), and gpio_mm_timer_bottom_half().
Referenced by gpio_mm_init().
MODULE_AUTHOR | ( | "Gordon Maclean <maclean@ucar.edu>" | ) |
MODULE_DESCRIPTION | ( | "Driver for Diamond GPIO card" | ) |
module_exit | ( | gpio_mm_cleanup | ) |
module_init | ( | gpio_mm_init | ) |
MODULE_LICENSE | ( | "Dual BSD/GPL" | ) |
module_param | ( | clockHZ | , |
int | , | ||
0 | ) |
module_param_array | ( | ioports_dio | , |
uint | , | ||
numboards_dio | , | ||
0 | ) |
MODULE_VERSION | ( | REPO_REVISION | ) |
struct gpio_timer_callback * register_gpio_timer_callback | ( | gpio_timer_callback_func_t | callback, |
unsigned int | usecs, | ||
void * | privateData, | ||
int * | errp ) |
References board, and register_gpio_timer_callback_priv().
Referenced by gpio_mm_init(), and start_fcntr().
|
static |
References check_timer_interval(), and start_gpio_timer().
Referenced by register_gpio_timer_callback(), and start_fcntr().
|
static |
References clockHZ, NSECS_PER_USEC, and USECS_PER_SEC.
Referenced by handlePendingCallbacks(), and start_gpio_timer().
|
static |
References gpio_mm_setup_event(), GPIO_MM_event_config::latencyUsecs, and USECS_PER_SEC.
Referenced by gpio_mm_ioctl_event().
|
static |
|
static |
References clockHZ, CTS9513_CMH_EDGE_RISING, CTS9513_CMH_NO_GATE, CTS9513_CMH_SRC_F1, CTS9513_CML_CNT_BIN, CTS9513_CML_CNT_DN, CTS9513_CML_GATE_NORETRIG, CTS9513_CML_OUT_HIGH_ON_TC, CTS9513_CML_RELOAD_LOAD, CTS9513_CML_REPEAT, gpio_mm_arm_counter(), GPIO_MM_IRQ_CTL_STATUS, GPIO_MM_IRQ_SRC, gpio_mm_load_counter(), gpio_mm_set_load_reg(), gpio_mm_setup_counter(), set_ticks(), and USECS_PER_SEC.
Referenced by handlePendingCallbacks(), and register_gpio_timer_callback_priv().
|
static |
References gpio_mm_stop_event().
Referenced by cleanup_event(), and gpio_mm_release_event().
|
static |
References gpio_mm_stop_fcntr(), unregister_gpio_timer_callback(), and unregister_gpio_timer_callback_priv().
Referenced by cleanup_fcntrs(), and gpio_mm_release_fcntr().
|
static |
References gpio_mm_disarm_counter(), and GPIO_MM_IRQ_CTL_STATUS.
Referenced by cleanup_gpio_timer(), and handlePendingCallbacks().
long unregister_gpio_timer_callback | ( | struct gpio_timer_callback * | cb, |
int | wait ) |
References board, and unregister_gpio_timer_callback_priv().
Referenced by gpio_mm_cleanup(), and stop_fcntr().
|
static |
Referenced by stop_fcntr(), and unregister_gpio_timer_callback().
|
static |
|
static |
Referenced by check_timer_interval(), gpio_mm_init(), set_ticks(), and start_gpio_timer().
|
static |
Referenced by gpio_mm_init(), and gpio_mm_set_irq_user().
|
static |
Referenced by init_event().
|
static |
Referenced by init_fcntrs().
|
static |
Referenced by cleanup_event(), cleanup_fcntrs(), gpio_mm_cleanup(), gpio_mm_init(), init_event(), and init_fcntrs().
|
static |
Referenced by gpio_mm_cleanup(), gpio_mm_init(), init_event(), and init_fcntrs().
|
static |
Referenced by gpio_mm_init().
|
static |
Referenced by gpio_mm_init().
|
static |
Referenced by gpio_mm_init().
|
static |
Referenced by gpio_mm_init().
|
static |
|
static |
Referenced by gpio_mm_cleanup(), and gpio_mm_init().
|
static |
Referenced by gpio_mm_init().
|
static |
|
static |