implementation of device driver interface for LLC for kernel .2.6x. More...
#include "local.h"
#include <assert.h>
#include "llif.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "acq32ioctl.h"
Go to the source code of this file.
Data Structures | |
struct | MU |
struct | SegmentMap |
struct | DmaBuffer |
Defines | |
#define | dbg(level, fmt, arg...) fprintf(stderr, fmt, ## arg) |
#define | FNAME_FMT "/dev/acq32/acq32.%d." |
#define | FNAME_FMT_MBOX FNAME_FMT "raw" |
#define | FNAME_FMT_DMABUF FNAME_FMT "01" |
#define | FNAME_FMT_HOST FNAME_FMT "host" |
#define | FMT_SYS_PARAMS "/sys/module/acq200_hostdrv/parameters/" |
#define | FMT_SYS_SLOTS FMT_SYS_PARAMS "slots" |
#define | FMT_SYS_DEV "/sys/class/acqX00/acq200.%d/device/" |
#define | FMT_SYS_DEV_HOST_PA FMT_SYS_DEV "host_pa" |
#define | FMT_SYS_DEV_HOST_LEN FMT_SYS_DEV "host_len" |
#define | MAX_MAPPING 0x00100000 |
#define | MAX_SEG 0x00020000 |
#define | MAX_SEGMENTS (MAX_MAPPING/MAX_SEG) |
#define | FN "mmapDmaBuffer() " |
#define | INITBUF_MARKER 0x1100c0de |
Typedefs | |
typedef volatile u32 | r32 |
Functions | |
static int | lookup_device_index (int slot) |
static unsigned | host_len (int iboard) |
static unsigned | host_pa (int iboard) |
int | setMbox (struct MU *m, int ibox, u32 value) |
set a mail mbox register: ibox [0-3]. | |
void | showLastWrites (struct MU *m) |
int | setMboxBits (struct MU *m, int ibox, u32 bits_to_set) |
just set these bits. | |
int | clrMboxBits (struct MU *m, int ibox, u32 bits_to_clr) |
just clr these bits. | |
int | setMboxField (struct MU *m, int ibox, u32 field_mask, u32 field_value) |
set the field in the register only. | |
u32 | getMbox (struct MU *m, int ibox) |
get contents of mailbox register: ibox [0-3] | |
u32 | getMboxShadow (struct MU *m, int ibox) |
get last contents of mailbox register: ibox [0-3] | |
u32 | pollMboxBits (struct MU *m, int ibox, u32 mask, u32 goal) |
return when any of the bits become true. | |
void | setMboxPollcount (struct MU *m, int poll_count) |
int | getMboxPollcount (struct MU *m) |
struct MU * | mmapMbox (int iboard) |
iboard [1-3]. | |
int | getDmaBufferLen (struct DmaBuffer *buffer) |
struct DmaBuffer * | mmapDmaBuffer (int iboard, unsigned nbytes) |
u32 | getBusAddr (struct DmaBuffer *d, u32 offset) |
u32 * | getVaddr (struct DmaBuffer *db, u32 offset) |
void | acq32_enableInts (struct MU *mbx, unsigned mask) |
void | acq32_maskInts (struct MU *mbx, unsigned mask) |
struct DmaBuffer * | mmapBigBuffer (int iboard, unsigned nbytes) |
void | mmapValidateDmaBuffer (struct MU *m, int nsamples) |
static void | udelay (int usecs) |
void | hbPrimeBuffer (struct DmaBuffer *buf) |
void | hbPrimePoll (struct DmaBuffer *buf, int offset, int sample_len) |
int | hbPoll (struct DmaBuffer *buf, int offset, int sample_len, volatile int *user_abort) |
MFA | mu_reserveOutbound (struct MU *mu) |
I2O Q ports: OUTBOUND: host reserves free MFA, puts MFA as command INBOUND: host gets message MFA, replaces MFA when done. | |
int | mu_putOutbound (struct MU *mu, MFA mfa) |
MFA | mu_getInbound (struct MU *mu) |
int | mu_returnInbound (struct MU *mu, MFA mfa) |
implementation of device driver interface for LLC for kernel .2.6x.
Definition in file llif26.c.
#define dbg | ( | level, | ||
fmt, | ||||
arg... | ||||
) | fprintf(stderr, fmt, ## arg) |
#define FMT_SYS_DEV_HOST_LEN FMT_SYS_DEV "host_len" |
Definition at line 92 of file llif26.c.
Referenced by host_len().
#define FMT_SYS_DEV_HOST_PA FMT_SYS_DEV "host_pa" |
#define FMT_SYS_PARAMS "/sys/module/acq200_hostdrv/parameters/" |
#define FMT_SYS_SLOTS FMT_SYS_PARAMS "slots" |
Definition at line 88 of file llif26.c.
Referenced by lookup_device_index().
#define FN "mmapDmaBuffer() " |
#define FNAME_FMT_DMABUF FNAME_FMT "01" |
Definition at line 83 of file llif26.c.
Referenced by mmapDmaBuffer().
#define FNAME_FMT_HOST FNAME_FMT "host" |
Definition at line 85 of file llif26.c.
Referenced by mmapBigBuffer().
#define FNAME_FMT_MBOX FNAME_FMT "raw" |
Definition at line 82 of file llif26.c.
Referenced by mmapMbox().
#define INITBUF_MARKER 0x1100c0de |
Definition at line 564 of file llif26.c.
Referenced by hbPoll(), and hbPrimeBuffer().
void acq32_enableInts | ( | struct MU * | mbx, | |
unsigned | mask | |||
) |
Definition at line 482 of file llif26.c.
References ACQ32_IOS_INTS_ENABLE, and MU::fd.
void acq32_maskInts | ( | struct MU * | mbx, | |
unsigned | mask | |||
) |
Definition at line 489 of file llif26.c.
References ACQ32_IOS_INTS_DISABLE, and MU::fd.
just clr these bits.
Definition at line 207 of file llif26.c.
References IN_RANGE, MU::mailboxes, and MU::mailboxes_shadow.
Definition at line 452 of file llif26.c.
References SegmentMap::length, SegmentMap::offset, SegmentMap::physaddr, and DmaBuffer::seg_map.
int getDmaBufferLen | ( | struct DmaBuffer * | buffer | ) |
Definition at line 371 of file llif26.c.
References DmaBuffer::nbytes.
get contents of mailbox register: ibox [0-3]
Definition at line 226 of file llif26.c.
References ACQ32_IOGMBX, MU::fd, IN_RANGE, MU::mailboxes, MU::mailboxes_shadow, and PRINTF.
int getMboxPollcount | ( | struct MU * | m | ) |
Definition at line 273 of file llif26.c.
References MU::poll_count.
get last contents of mailbox register: ibox [0-3]
Definition at line 245 of file llif26.c.
References IN_RANGE, and MU::mailboxes_shadow.
Definition at line 470 of file llif26.c.
References DmaBuffer::nbytes, PRINTF, and DmaBuffer::vaddr.
int hbPoll | ( | struct DmaBuffer * | buf, | |
int | offset, | |||
int | sample_len, | |||
volatile int * | user_abort | |||
) |
Definition at line 600 of file llif26.c.
References INITBUF_MARKER, marker, PRINTF, udelay(), and DmaBuffer::vaddr.
void hbPrimeBuffer | ( | struct DmaBuffer * | buf | ) |
Definition at line 582 of file llif26.c.
References INITBUF_MARKER, len, memset32(), DmaBuffer::nbytes, and DmaBuffer::vaddr.
void hbPrimePoll | ( | struct DmaBuffer * | buf, | |
int | offset, | |||
int | sample_len | |||
) |
Definition at line 592 of file llif26.c.
References marker, and DmaBuffer::vaddr.
static unsigned host_len | ( | int | iboard | ) | [static] |
Definition at line 139 of file llif26.c.
References FMT_SYS_DEV_HOST_LEN, fname, len, and lookup_device_index().
Referenced by mmapBigBuffer().
static unsigned host_pa | ( | int | iboard | ) | [static] |
Definition at line 157 of file llif26.c.
References FMT_SYS_DEV_HOST_PA, fname, and lookup_device_index().
Referenced by mmapBigBuffer().
static int lookup_device_index | ( | int | slot | ) | [static] |
Definition at line 95 of file llif26.c.
References FMT_SYS_SLOTS, and IN_RANGE.
Referenced by host_len(), and host_pa().
struct DmaBuffer* mmapBigBuffer | ( | int | iboard, | |
unsigned | nbytes | |||
) | [read] |
Definition at line 499 of file llif26.c.
References acq196_get_physical(), ACQ32_BIG_BUF_LEN, fd_in, FN, fname, FNAME_FMT_HOST, getBigBufPrams(), host_len(), host_pa(), SegmentMap::length, MIN, DmaBuffer::nbytes, SegmentMap::offset, SegmentMap::physaddr, PRINTF, DmaBuffer::seg_map, and DmaBuffer::vaddr.
struct DmaBuffer* mmapDmaBuffer | ( | int | iboard, | |
unsigned | nbytes | |||
) | [read] |
Definition at line 376 of file llif26.c.
References ACQ32_IOREAD_GETPHYSICAL, fd_in, fname, FNAME_FMT_DMABUF, SegmentMap::length, DmaBuffer::nbytes, SegmentMap::offset, SegmentMap::physaddr, PRINTF, DmaBuffer::seg_map, and DmaBuffer::vaddr.
struct MU* mmapMbox | ( | int | iboard | ) | [read] |
iboard [1-3].
return mapping on success.
Definition at line 279 of file llif26.c.
References ACQ32_IOG_PCIREGS_OFFSET, dbg, MU::fd, fname, FNAME_FMT_MBOX, getMbox(), IN_RANGE, MU::inbound_q_port, MU::mailboxes, MU::outbound_q_port, PRINTF, and USE_IOCTL_DOC.
void mmapValidateDmaBuffer | ( | struct MU * | m, | |
int | nsamples | |||
) |
Definition at line 559 of file llif26.c.
References ACQ32_IOS_VALIDATE_BIGBUF, and MU::fd.
Definition at line 637 of file llif26.c.
References MU::outbound_q_port.
Definition at line 629 of file llif26.c.
References MU::inbound_q_port.
I2O Q ports: OUTBOUND: host reserves free MFA, puts MFA as command INBOUND: host gets message MFA, replaces MFA when done.
NB: direction with respect to HOST!
Definition at line 625 of file llif26.c.
References MU::inbound_q_port.
Definition at line 641 of file llif26.c.
References MU::outbound_q_port.
set a mail mbox register: ibox [0-3].
return 0 on success
Definition at line 176 of file llif26.c.
References ACQ32_IOSMBX, MU::fd, IN_RANGE, MU::mailboxes, MU::mailboxes_lastwrite, MU::mailboxes_shadow, and PRINTF.
just set these bits.
Definition at line 199 of file llif26.c.
References IN_RANGE, MU::mailboxes, and MU::mailboxes_shadow.
set the field in the register only.
Definition at line 215 of file llif26.c.
References IN_RANGE, MU::mailboxes, and MU::mailboxes_shadow.
void setMboxPollcount | ( | struct MU * | m, | |
int | poll_count | |||
) |
Definition at line 269 of file llif26.c.
References MU::poll_count.
void showLastWrites | ( | struct MU * | m | ) |
Definition at line 190 of file llif26.c.
References MU::mailboxes_lastwrite.