AFHBA404
AFHBA404 connects ACQ2106 to PCI-Express
|
#include <linux/module.h>
#include "acq-fiber-hba.h"
#include "afhba_stream_drv.h"
#include <linux/poll.h>
#include <linux/version.h>
Go to the source code of this file.
Macros | |
#define | EXPORT_SYMTAB |
#define | REVID "R1072" |
#define | DEF_BUFFER_LEN 0x100000 |
#define | COPY_FROM_USER(to, from, len) if (copy_from_user(to, from, len)) { return -EFAULT; } |
#define | COPY_TO_USER(to, from, len) if (copy_to_user(to, from, len)) { return -EFAULT; } |
#define | LL_MAX_CNT 16 |
#define | LL_BLOCK 64 |
#define | LL_NB(cnt) ((cnt)-1) |
#define | LL_MAX_LEN (LL_MAX_CNT*LL_BLOCK) |
#define | MSLEEP_TO 10 |
#define | ZI_FMT "[%d] Z_IDENT 1:0x%08x 2:0x%08x %s" |
#define | CHANGE_STATE(s) state = (s); ticks_in_state = 0; continue |
#define | RTDMAC_DATA_FIFO_CNT 0x1000 |
#define | RTDMAC_DESC_FIFO_CNT 0x1000 |
#define | DATA_FIFO_SZ (RTDMAC_DATA_FIFO_CNT*sizeof(unsigned)) |
#define | DESC_FIFO_SZ (RTDMAC_DESC_FIFO_CNT*sizeof(unsigned)) |
#define | RATE *rate |
#define | OLD *old |
#define | NEW *new |
Functions | |
module_param (RX_TO, int, 0644) | |
MODULE_PARM_DESC (RX_TO, "RX timeout (jiffies) [0.1Hz]") | |
module_param (WORK_TO, int, 0644) | |
MODULE_PARM_DESC (WORK_TO, "WORK timeout (jiffies) [50Hz] - decrease for hi fifo stat poll rate") | |
module_param (amon_jiffies, int, 0644) | |
MODULE_PARM_DESC (amon_jiffies, "aurora monitor poll rate") | |
module_param (SMOO, int, 0644) | |
MODULE_PARM_DESC (SMOO, "rate smoothing factor 0..9 none..smooth") | |
module_param (stalls, int, 0644) | |
MODULE_PARM_DESC (stalls, "number of times ISR ran with no buffers to queue") | |
module_param (buffer_debug, int, 0644) | |
module_param (nbuffers, int, 0444) | |
MODULE_PARM_DESC (nbuffers, "number of host-side buffers") | |
module_param (buffer_len, int, 0644) | |
MODULE_PARM_DESC (buffer_len, "length of each buffer in bytes") | |
module_param (stop_on_skipped_buffer, int, 0644) | |
module_param (transfer_buffers, int, 0664) | |
MODULE_PARM_DESC (transfer_buffers, "number of buffers to transfer") | |
module_param (aurora_to_ms, int, 0644) | |
MODULE_PARM_DESC (aurora_to_ms, "timeout on aurora connect") | |
module_param (aurora_monitor, int, 0644) | |
MODULE_PARM_DESC (aurora_monitor, "enable to check cable state in run loop, disable for debug") | |
module_param (eot_interrupt, int, 0644) | |
MODULE_PARM_DESC (eot_interrupt, "1: interrupt every, 0: interrupt none, N: interrupt interval") | |
module_param (cos_interrupt_ok, int, 0644) | |
MODULE_PARM_DESC (cos_interrupt_ok, "1: interrupt every, 0: interrupt none, N: interrupt interval") | |
module_param (aurora_status_read_count, int, 0644) | |
MODULE_PARM_DESC (aurora_status_read_count, "number of amon polls") | |
module_param (dma_descriptor_ram, int, 0644) | |
MODULE_PARM_DESC (dma_descriptor_ram, "descriptors in RAM not FIFO >1 :: validate on load") | |
module_param (assume_stuck_buffers_are_ok, int, 0644) | |
MODULE_PARM_DESC (assume_stuck_buffers_are_ok, "assume that stuck buffers are ok to release into the wild") | |
module_param (max_dma_load_retry, int, 0644) | |
MODULE_PARM_DESC (max_dma_load_retry, "number of times to retry loading descriptors. HACK: once should be enough") | |
module_param (max_empty_backlog_check, int, 0644) | |
MODULE_PARM_DESC (max_empty_backlog_check, "set to one to look only at top of deck, set to two to check skips") | |
module_param (use_llc_multi, int, 0644) | |
MODULE_PARM_DESC (use_llc_multi, "use LLC for multi descriptor transfer") | |
void | init_descriptors_ht (struct AFHBA_STREAM_DEV *sdev) |
u32 | _afs_read_zynqreg (struct AFHBA_DEV *adev, int regoff) |
void | _afs_write_comreg (struct AFHBA_DEV *adev, int regoff, u32 value) |
void | _afs_write_dmareg (struct AFHBA_DEV *adev, int regoff, u32 value) |
u32 | _afs_read_dmareg (struct AFHBA_DEV *adev, int regoff) |
void | _afs_write_pcireg (struct AFHBA_DEV *adev, int regoff, u32 value) |
u32 | _afs_read_pcireg (struct AFHBA_DEV *adev, int regoff) |
void | afs_load_pull_descriptor (struct AFHBA_DEV *adev, int idesc) |
void | __afs_dma_reset (struct AFHBA_DEV *adev, u32 dma_sel) |
void | __afs_stop_dma (struct AFHBA_DEV *adev, u32 dma_sel) |
void | __afs_start_dma (struct AFHBA_DEV *adev, u32 dma_sel) |
int | afs_comms_init (struct AFHBA_DEV *adev) |
int | afs_comms_ready (struct AFHBA_DEV *adev) |
struct HostBuffer * | hb_from_descr (struct AFHBA_DEV *adev, u32 inflight_descr) |
int | afs_init_buffers (struct AFHBA_DEV *adev) |
int | job_is_go (struct JOB *job) |
int | load_buffers (struct AFHBA_DEV *adev) |
int | start_job (struct AFHBA_DEV *adev) |
ssize_t | afs_histo_read (struct file *file, char *buf, size_t count, loff_t *f_pos) |
int | afs_histo_open (struct inode *inode, struct file *file, unsigned *histo, int hcount) |
int | afs_reset_buffers (struct AFHBA_DEV *adev) |
void | afs_stop_llc_push (struct AFHBA_DEV *adev) |
void | afs_stop_llc_pull (struct AFHBA_DEV *adev) |
void | afs_stop_stream_push (struct AFHBA_DEV *adev) |
void | afs_stop_stream_pull (struct AFHBA_DEV *adev) |
int | push_dma_timeout (struct AFHBA_DEV *adev) |
long | afs_start_ai_llc (struct AFHBA_DEV *adev, struct XLLC_DEF *xllc_def) |
long | afs_start_ao_llc (struct AFHBA_DEV *adev, struct XLLC_DEF *xllc_def) |
int | afs_dma_open (struct inode *inode, struct file *file) |
int | afs_dma_release (struct inode *inode, struct file *file) |
ssize_t | afs_dma_read (struct file *file, char __user *buf, size_t count, loff_t *f_pos) |
ssize_t | afs_dma_read_poll (struct file *file, char __user *buf, size_t count, loff_t *f_pos) |
ssize_t | afs_dma_write (struct file *file, const char *buf, size_t count, loff_t *f_pos) |
int | fix_dma_buff_size (struct AB *ab, struct XLLC_DEF *xdef) |
long | afs_start_AI_AB (struct AFHBA_DEV *adev, struct AB *ab) |
long | afs_start_ABN (struct AFHBA_DEV *adev, struct ABN *abn, enum DMA_SEL dma_sel) |
long | afs_dma_ioctl (struct file *file, unsigned int cmd, unsigned long arg) |
int | afs_mmap_host (struct file *file, struct vm_area_struct *vma) |
mmap the host buffer. More... | |
int | afs_open (struct inode *inode, struct file *file) |
void | afs_create_sysfs (struct AFHBA_DEV *adev) |
int | afhba_stream_drv_init (struct AFHBA_DEV *adev) |
int | afhba_stream_drv_del (struct AFHBA_DEV *adev) |
Variables | |
int | RX_TO = 1*HZ |
int | WORK_TO = HZ/100 |
int | amon_jiffies = HZ/3 |
int | SMOO = 7 |
int | stalls = 0 |
int | buffer_debug = 0 |
int | nbuffers = NBUFFERS |
int | buffer_len = DEF_BUFFER_LEN |
int | stop_on_skipped_buffer = 0 |
int | transfer_buffers = 0x7fffffff |
int | aurora_to_ms = 1000 |
int | aurora_monitor = 0 |
int | eot_interrupt = 0 |
int | cos_interrupt_ok = 0 |
int | aurora_status_read_count = 0 |
int | dma_descriptor_ram = 1 |
int | assume_stuck_buffers_are_ok = 1 |
int | max_dma_load_retry = 2 |
int | max_empty_backlog_check = 2 |
int | use_llc_multi = 0 |
#define CHANGE_STATE | ( | s | ) | state = (s); ticks_in_state = 0; continue |
#define COPY_FROM_USER | ( | to, | |
from, | |||
len | |||
) | if (copy_from_user(to, from, len)) { return -EFAULT; } |
Definition at line 194 of file afhba_stream_drv.c.
#define COPY_TO_USER | ( | to, | |
from, | |||
len | |||
) | if (copy_to_user(to, from, len)) { return -EFAULT; } |
Definition at line 197 of file afhba_stream_drv.c.
#define DATA_FIFO_SZ (RTDMAC_DATA_FIFO_CNT*sizeof(unsigned)) |
Definition at line 784 of file afhba_stream_drv.c.
#define DEF_BUFFER_LEN 0x100000 |
Definition at line 47 of file afhba_stream_drv.c.
#define DESC_FIFO_SZ (RTDMAC_DESC_FIFO_CNT*sizeof(unsigned)) |
Definition at line 785 of file afhba_stream_drv.c.
#define EXPORT_SYMTAB |
Definition at line 34 of file afhba_stream_drv.c.
#define LL_BLOCK 64 |
Definition at line 469 of file afhba_stream_drv.c.
#define LL_MAX_CNT 16 |
Definition at line 468 of file afhba_stream_drv.c.
#define LL_MAX_LEN (LL_MAX_CNT*LL_BLOCK) |
Definition at line 471 of file afhba_stream_drv.c.
#define LL_NB | ( | cnt | ) | ((cnt)-1) |
Definition at line 470 of file afhba_stream_drv.c.
#define MSLEEP_TO 10 |
Definition at line 636 of file afhba_stream_drv.c.
#define NEW *new |
#define OLD *old |
#define RATE *rate |
#define REVID "R1072" |
Definition at line 45 of file afhba_stream_drv.c.
#define RTDMAC_DATA_FIFO_CNT 0x1000 |
Definition at line 781 of file afhba_stream_drv.c.
#define RTDMAC_DESC_FIFO_CNT 0x1000 |
Definition at line 782 of file afhba_stream_drv.c.
#define ZI_FMT "[%d] Z_IDENT 1:0x%08x 2:0x%08x %s" |
Definition at line 555 of file afhba_stream_drv.c.
Definition at line 570 of file afhba_stream_drv.c.
Definition at line 563 of file afhba_stream_drv.c.
Definition at line 313 of file afhba_stream_drv.c.
Definition at line 332 of file afhba_stream_drv.c.
Definition at line 287 of file afhba_stream_drv.c.
Definition at line 296 of file afhba_stream_drv.c.
Definition at line 304 of file afhba_stream_drv.c.
Definition at line 322 of file afhba_stream_drv.c.
int afhba_stream_drv_del | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 2246 of file afhba_stream_drv.c.
int afhba_stream_drv_init | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 2229 of file afhba_stream_drv.c.
int afs_comms_init | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 749 of file afhba_stream_drv.c.
int afs_comms_ready | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 773 of file afhba_stream_drv.c.
void afs_create_sysfs | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 2213 of file afhba_stream_drv.c.
long afs_dma_ioctl | ( | struct file * | file, |
unsigned int | cmd, | ||
unsigned long | arg | ||
) |
Definition at line 1944 of file afhba_stream_drv.c.
int afs_dma_open | ( | struct inode * | inode, |
struct file * | file | ||
) |
@todo protect with lock ?
Definition at line 1505 of file afhba_stream_drv.c.
ssize_t afs_dma_read | ( | struct file * | file, |
char __user * | buf, | ||
size_t | count, | ||
loff_t * | f_pos | ||
) |
Definition at line 1592 of file afhba_stream_drv.c.
ssize_t afs_dma_read_poll | ( | struct file * | file, |
char __user * | buf, | ||
size_t | count, | ||
loff_t * | f_pos | ||
) |
Definition at line 1694 of file afhba_stream_drv.c.
int afs_dma_release | ( | struct inode * | inode, |
struct file * | file | ||
) |
Definition at line 1545 of file afhba_stream_drv.c.
ssize_t afs_dma_write | ( | struct file * | file, |
const char * | buf, | ||
size_t | count, | ||
loff_t * | f_pos | ||
) |
Definition at line 1759 of file afhba_stream_drv.c.
int afs_histo_open | ( | struct inode * | inode, |
struct file * | file, | ||
unsigned * | histo, | ||
int | hcount | ||
) |
Definition at line 1382 of file afhba_stream_drv.c.
ssize_t afs_histo_read | ( | struct file * | file, |
char * | buf, | ||
size_t | count, | ||
loff_t * | f_pos | ||
) |
Definition at line 1327 of file afhba_stream_drv.c.
int afs_init_buffers | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1001 of file afhba_stream_drv.c.
void afs_load_pull_descriptor | ( | struct AFHBA_DEV * | adev, |
int | idesc | ||
) |
Definition at line 353 of file afhba_stream_drv.c.
int afs_mmap_host | ( | struct file * | file, |
struct vm_area_struct * | vma | ||
) |
mmap the host buffer.
Definition at line 2025 of file afhba_stream_drv.c.
int afs_open | ( | struct inode * | inode, |
struct file * | file | ||
) |
Definition at line 2075 of file afhba_stream_drv.c.
int afs_reset_buffers | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1390 of file afhba_stream_drv.c.
Definition at line 1896 of file afhba_stream_drv.c.
Definition at line 1860 of file afhba_stream_drv.c.
Definition at line 1468 of file afhba_stream_drv.c.
Definition at line 1490 of file afhba_stream_drv.c.
void afs_stop_llc_pull | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1432 of file afhba_stream_drv.c.
void afs_stop_llc_push | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1423 of file afhba_stream_drv.c.
void afs_stop_stream_pull | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1444 of file afhba_stream_drv.c.
void afs_stop_stream_push | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1438 of file afhba_stream_drv.c.
Definition at line 1834 of file afhba_stream_drv.c.
struct HostBuffer* hb_from_descr | ( | struct AFHBA_DEV * | adev, |
u32 | inflight_descr | ||
) |
Definition at line 853 of file afhba_stream_drv.c.
void init_descriptors_ht | ( | struct AFHBA_STREAM_DEV * | sdev | ) |
Definition at line 156 of file afhba_stream_drv.c.
int job_is_go | ( | struct JOB * | job | ) |
Definition at line 1169 of file afhba_stream_drv.c.
int load_buffers | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1175 of file afhba_stream_drv.c.
module_param | ( | amon_jiffies | , |
int | , | ||
0644 | |||
) |
module_param | ( | assume_stuck_buffers_are_ok | , |
int | , | ||
0644 | |||
) |
module_param | ( | aurora_monitor | , |
int | , | ||
0644 | |||
) |
module_param | ( | aurora_status_read_count | , |
int | , | ||
0644 | |||
) |
module_param | ( | aurora_to_ms | , |
int | , | ||
0644 | |||
) |
module_param | ( | buffer_debug | , |
int | , | ||
0644 | |||
) |
module_param | ( | buffer_len | , |
int | , | ||
0644 | |||
) |
module_param | ( | cos_interrupt_ok | , |
int | , | ||
0644 | |||
) |
module_param | ( | dma_descriptor_ram | , |
int | , | ||
0644 | |||
) |
module_param | ( | eot_interrupt | , |
int | , | ||
0644 | |||
) |
module_param | ( | max_dma_load_retry | , |
int | , | ||
0644 | |||
) |
module_param | ( | max_empty_backlog_check | , |
int | , | ||
0644 | |||
) |
module_param | ( | nbuffers | , |
int | , | ||
0444 | |||
) |
module_param | ( | RX_TO | , |
int | , | ||
0644 | |||
) |
module_param | ( | SMOO | , |
int | , | ||
0644 | |||
) |
module_param | ( | stalls | , |
int | , | ||
0644 | |||
) |
module_param | ( | stop_on_skipped_buffer | , |
int | , | ||
0644 | |||
) |
module_param | ( | transfer_buffers | , |
int | , | ||
0664 | |||
) |
module_param | ( | use_llc_multi | , |
int | , | ||
0644 | |||
) |
module_param | ( | WORK_TO | , |
int | , | ||
0644 | |||
) |
MODULE_PARM_DESC | ( | amon_jiffies | , |
"aurora monitor poll rate" | |||
) |
MODULE_PARM_DESC | ( | assume_stuck_buffers_are_ok | , |
"assume that stuck buffers are ok to release into the wild" | |||
) |
MODULE_PARM_DESC | ( | aurora_monitor | , |
"enable to check cable state in run | loop, | ||
disable for debug" | |||
) |
MODULE_PARM_DESC | ( | aurora_status_read_count | , |
"number of amon polls" | |||
) |
MODULE_PARM_DESC | ( | aurora_to_ms | , |
"timeout on aurora connect" | |||
) |
MODULE_PARM_DESC | ( | buffer_len | , |
"length of each buffer in bytes" | |||
) |
MODULE_PARM_DESC | ( | cos_interrupt_ok | , |
"1: interrupt | every, | ||
0:interrupt | none, | ||
N:interrupt interval" | |||
) |
MODULE_PARM_DESC | ( | dma_descriptor_ram | , |
"descriptors in RAM not | FIFO, | ||
1 ::validate on load" | |||
) |
MODULE_PARM_DESC | ( | eot_interrupt | , |
"1: interrupt | every, | ||
0:interrupt | none, | ||
N:interrupt interval" | |||
) |
MODULE_PARM_DESC | ( | max_dma_load_retry | , |
"number of times to retry loading descriptors. HACK: once should be enough" | |||
) |
MODULE_PARM_DESC | ( | max_empty_backlog_check | , |
"set to one to look only at top of | deck, | ||
set to two to check skips" | |||
) |
MODULE_PARM_DESC | ( | nbuffers | , |
"number of host-side buffers" | |||
) |
MODULE_PARM_DESC | ( | RX_TO | , |
"RX timeout (jiffies) " | [0.1Hz] | ||
) |
MODULE_PARM_DESC | ( | SMOO | , |
"rate smoothing factor 0..9 none..smooth" | |||
) |
MODULE_PARM_DESC | ( | stalls | , |
"number of times ISR ran with no buffers to queue" | |||
) |
MODULE_PARM_DESC | ( | transfer_buffers | , |
"number of buffers to transfer" | |||
) |
MODULE_PARM_DESC | ( | use_llc_multi | , |
"use LLC for multi descriptor transfer" | |||
) |
MODULE_PARM_DESC | ( | WORK_TO | , |
"WORK timeout (jiffies) - decrease for hi fifo stat poll rate" | [50Hz] | ||
) |
int push_dma_timeout | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1450 of file afhba_stream_drv.c.
int start_job | ( | struct AFHBA_DEV * | adev | ) |
Definition at line 1190 of file afhba_stream_drv.c.
int amon_jiffies = HZ/3 |
Definition at line 57 of file afhba_stream_drv.c.
int assume_stuck_buffers_are_ok = 1 |
Definition at line 113 of file afhba_stream_drv.c.
int aurora_monitor = 0 |
Definition at line 93 of file afhba_stream_drv.c.
int aurora_status_read_count = 0 |
Definition at line 105 of file afhba_stream_drv.c.
int aurora_to_ms = 1000 |
Definition at line 89 of file afhba_stream_drv.c.
int buffer_debug = 0 |
Definition at line 69 of file afhba_stream_drv.c.
int buffer_len = DEF_BUFFER_LEN |
Definition at line 77 of file afhba_stream_drv.c.
int cos_interrupt_ok = 0 |
Definition at line 101 of file afhba_stream_drv.c.
int dma_descriptor_ram = 1 |
Definition at line 109 of file afhba_stream_drv.c.
int eot_interrupt = 0 |
Definition at line 97 of file afhba_stream_drv.c.
int max_dma_load_retry = 2 |
Definition at line 117 of file afhba_stream_drv.c.
int max_empty_backlog_check = 2 |
Definition at line 124 of file afhba_stream_drv.c.
int nbuffers = NBUFFERS |
Definition at line 73 of file afhba_stream_drv.c.
int RX_TO = 1*HZ |
Definition at line 48 of file afhba_stream_drv.c.
int SMOO = 7 |
Definition at line 61 of file afhba_stream_drv.c.
int stalls = 0 |
Definition at line 65 of file afhba_stream_drv.c.
int stop_on_skipped_buffer = 0 |
Definition at line 82 of file afhba_stream_drv.c.
int transfer_buffers = 0x7fffffff |
Definition at line 85 of file afhba_stream_drv.c.
int use_llc_multi = 0 |
Definition at line 130 of file afhba_stream_drv.c.
int WORK_TO = HZ/100 |
Definition at line 52 of file afhba_stream_drv.c.