93 #ifndef NIDAS_DIAMOND_GPIO_MM_H
94 #define NIDAS_DIAMOND_GPIO_MM_H
100 #include <sys/ioctl.h>
101 #include <sys/types.h>
141 #define GPIO_MM_IOC_MAGIC 'g'
149 #define GPIO_MM_FCNTR_START \
150 _IOW(GPIO_MM_IOC_MAGIC,0,struct GPIO_MM_fcntr_config)
151 #define GPIO_MM_FCNTR_GET_STATUS \
152 _IOR(GPIO_MM_IOC_MAGIC,1,struct GPIO_MM_fcntr_status)
154 #define GPIO_MM_EVENT_START \
155 _IOW(GPIO_MM_IOC_MAGIC,2,struct GPIO_MM_event_config)
156 #define GPIO_MM_EVENT_GET_STATUS \
157 _IOR(GPIO_MM_IOC_MAGIC,3,struct GPIO_MM_event_status)
160 #define GPIO_MM_IOC_MAXNR 3
162 #define GPIO_MM_CT_CLOCK_HZ 20000000
167 #include <linux/cdev.h>
168 #include <linux/device.h>
172 typedef void (*gpio_timer_callback_func_t) (
void* privateData);
179 struct gpio_timer_callback
181 struct list_head list;
182 gpio_timer_callback_func_t callbackFunc;
185 unsigned int tickModulus;
203 gpio_timer_callback_func_t callback,
unsigned int usecs,
204 void *privateData,
int *errp);
236 #define GPIO_MM_DIO_IOPORT_WIDTH 8
237 #define GPIO_MM_CT_IOPORT_WIDTH 16
239 #define MAX_GPIO_MM_BOARDS 5 // number of boards supported by driver
242 #define GPIO_MM_MINORS_PER_BOARD 14
245 #define GPIO_MM_CNTR_PER_FCNTR 3
248 #define GPIO_MM_FCNTR_PER_BOARD (GPIO_MM_CNTR_PER_BOARD/GPIO_MM_CNTR_PER_FCNTR)
250 #define GPIO_MM_FCNTR_SAMPLE_QUEUE_SIZE 16
252 #define GPIO_MM_EVENT_SAMPLE_QUEUE_SIZE 16
255 #define GPIO_MM_TIMER_COUNTER 9
257 #define CALLBACK_POOL_SIZE 64
278 unsigned int nevents;
308 int outputPeriodUsec;
312 struct gpio_timer_callback* timer_callback;
314 struct dsm_sample_circ_buf samples;
319 wait_queue_head_t rwaitq;
321 struct sample_read_state read_state;
331 unsigned long lastWakeup;
352 struct dsm_sample_circ_buf samples;
357 wait_queue_head_t rwaitq;
359 struct sample_read_state read_state;
369 unsigned long lastWakeup;
383 struct list_head callbackList;
388 struct list_head callbackPool;
393 struct list_head pendingAdds;
406 spinlock_t callbackLock;
415 unsigned int irqsReceived;
425 unsigned int tickLimit;
432 struct tasklet_struct tasklet;
438 int callbacksChanged;
444 wait_queue_head_t callbackWaitQ;
454 unsigned int ioport_dio;
455 unsigned long dio_addr;
457 unsigned int ioport_ct;
458 unsigned long ct_addr;
468 unsigned char mmode_lsb[2];
469 unsigned char mmode_msb[2];
471 struct GPIO_MM_timer* timer;
476 struct GPIO_MM_fcntr* fcntrs;
481 struct GPIO_MM_event* event;
489 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
490 struct mutex brd_mutex;
492 struct semaphore brd_mutex;
unsigned int lostSamples
Definition: gpio_mm.h:132
static string device
Definition: sing.cc:60
Definition: gpio_mm.h:129
struct gpio_timer_callback * register_gpio_timer_callback(gpio_timer_callback_func_t callback, unsigned int usecs, void *privateData, int *errp)
Definition: gpio_mm.c:2000
int outputPeriodUsec
Definition: gpio_mm.h:111
unsigned int nevents
Definition: gpio_mm.h:131
#define GPIO_MM_CNTR_PER_BOARD
Definition: gpio_mm_regs.h:39
unsigned int badGateWarning
Definition: gpio_mm.h:120
unsigned int pulseUnderflow
Definition: gpio_mm.h:119
unsigned int lostSamples
Definition: gpio_mm.h:118
#define CALLBACK_POOL_SIZE
Definition: pc104sg.c:190
int dsm_sample_time_t
Depending on the module, either tenths of milliseconds, or milliseconds since 00:00 UTC today...
Definition: types.h:48
long unregister_gpio_timer_callback(struct gpio_timer_callback *cb, int wait)
Definition: gpio_mm.c:2010
static int irqs[MAX_DMMAT_BOARDS]
Definition: dmd_mmat.c:73
unsigned int badStatusWarning
Definition: gpio_mm.h:121
int latencyUsecs
Definition: gpio_mm.h:126
int numPulses
Definition: gpio_mm.h:112
Definition: gpio_mm.h:116
int latencyUsecs
Definition: gpio_mm.h:113
unsigned int dsm_sample_length_t
length of data portion of sample.
Definition: types.h:51
Definition: gpio_mm.h:124
Definition: gpio_mm.h:109