implementation of device driver interface for LLC. 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 | USE_IOCTL_DOC "NOT USE_IOCTL memory mapped - x86 only FAST" |
#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 | MAX_MAPPING 0x00100000 |
#define | MAX_SEG 0x00020000 |
#define | MAX_SEGMENTS (MAX_MAPPING/MAX_SEG) |
#define | ACQ32_BIG_BUF_BASE acq32_big_buf_base |
#define | ACQ32_BIG_BUF_LEN acq32_big_buf_len |
#define | FN "mmapDmaBuffer() " |
#define | INITBUF_MARKER 0x1100c0de |
Typedefs | |
typedef volatile u32 | r32 |
Functions | |
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) |
static void | _getBigBufPrams () |
static void | getBigBufPrams () |
static void | acq196_get_physical (int fd, struct DmaBuffer *d) |
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) |
Variables | |
static int | acq32_big_buf_base |
static int | acq32_big_buf_len |
implementation of device driver interface for LLC.
define USE_IOCTL to use ioctls to access mbox. this is slow, but guaranteed portable
if undefined, memory mapped accesss is used - much faster, but x86 only
Definition in file llif.c.
#define ACQ32_BIG_BUF_BASE acq32_big_buf_base |
#define ACQ32_BIG_BUF_LEN acq32_big_buf_len |
Definition at line 561 of file llif.c.
Referenced by mmapBigBuffer().
#define dbg | ( | level, | ||
fmt, | ||||
arg... | ||||
) | fprintf(stderr, fmt, ## arg) |
Definition at line 184 of file llif.c.
Referenced by mmapMbox().
#define FN "mmapDmaBuffer() " |
Referenced by mmapBigBuffer().
#define FNAME_FMT_DMABUF FNAME_FMT "01" |
Definition at line 202 of file llif.c.
Referenced by mmapDmaBuffer().
#define FNAME_FMT_HOST FNAME_FMT "host" |
Definition at line 204 of file llif.c.
Referenced by mmapBigBuffer().
#define FNAME_FMT_MBOX FNAME_FMT "raw" |
Definition at line 201 of file llif.c.
Referenced by mmapMbox().
#define INITBUF_MARKER 0x1100c0de |
Definition at line 702 of file llif.c.
Referenced by hbPoll(), and hbPrimeBuffer().
#define USE_IOCTL_DOC "NOT USE_IOCTL memory mapped - x86 only FAST" |
Definition at line 179 of file llif.c.
Referenced by mmapMbox().
static void _getBigBufPrams | ( | ) | [static] |
Definition at line 566 of file llif.c.
References acq32_big_buf_base, acq32_big_buf_len, and PRINTF.
Referenced by getBigBufPrams().
static void acq196_get_physical | ( | int | fd, | |
struct DmaBuffer * | d | |||
) | [static] |
Definition at line 608 of file llif.c.
References fclose(), SegmentMap::length, SegmentMap::physaddr, and DmaBuffer::seg_map.
Referenced by mmapBigBuffer().
void acq32_enableInts | ( | struct MU * | mbx, | |
unsigned | mask | |||
) |
Definition at line 532 of file llif.c.
Referenced by measureBridgeStats(), and runTest().
void acq32_maskInts | ( | struct MU * | mbx, | |
unsigned | mask | |||
) |
Definition at line 539 of file llif.c.
Referenced by measureBridgeStats(), and runTest().
static void getBigBufPrams | ( | ) | [static] |
Definition at line 587 of file llif.c.
References _getBigBufPrams(), acq32_big_buf_base, acq32_big_buf_len, and len.
Referenced by mmapBigBuffer().
Definition at line 502 of file llif.c.
Referenced by appEnterLLC_SYNC_2V(), appEnterLLC_SYNC_2VAO32(), appEnterLLC_SYNC_ECM(), initV2Stats(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_ECM(), and updateTargetAddr().
get contents of mailbox register: ibox [0-3]
Definition at line 269 of file llif.c.
Referenced by llGetCsr(), llGetTinst(), llGetTlatch(), measureBridge(), measureBridgeStats(), mmapMbox(), monitor_handler(), pollAck(), pollMboxBits(), and quit_handler().
int getMboxPollcount | ( | struct MU * | m | ) |
Definition at line 326 of file llif.c.
Referenced by do_run(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_2VRFM(), and runSYNC_ECM().
get last contents of mailbox register: ibox [0-3]
Definition at line 298 of file llif.c.
Referenced by llWaitDmaDone().
Definition at line 520 of file llif.c.
Referenced by appEnterLLC_SYNC_2V(), appEnterLLC_SYNC_2VAO32(), appEnterLLC_SYNC_ECM(), card_sync_2v_WaitDmaDone(), card_v2_WaitDmaDone(), do_run(), doApplicationWork(), doApplicationWork216(), doDmaBufDataOutput(), initV2Stats(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_ECM(), sync_2v_updateTstats(), and v2_updateTstats().
int hbPoll | ( | struct DmaBuffer * | buf, | |
int | offset, | |||
int | sample_len, | |||
volatile int * | user_abort | |||
) |
Definition at line 737 of file llif.c.
Referenced by do_run(), and runSCM216().
void hbPrimeBuffer | ( | struct DmaBuffer * | buf | ) |
Definition at line 720 of file llif.c.
Referenced by initCardResource().
void hbPrimePoll | ( | struct DmaBuffer * | buf, | |
int | offset, | |||
int | sample_len | |||
) |
Definition at line 729 of file llif.c.
Referenced by do_run(), and runSCM216().
struct DmaBuffer* mmapBigBuffer | ( | int | iboard, | |
unsigned | nbytes | |||
) | [read] |
Definition at line 631 of file llif.c.
Referenced by initCardResource(), and main().
struct DmaBuffer* mmapDmaBuffer | ( | int | iboard, | |
unsigned | nbytes | |||
) | [read] |
struct MU* mmapMbox | ( | int | iboard | ) | [read] |
iboard [1-3].
return mapping on success.
Definition at line 332 of file llif.c.
Referenced by initCardResource().
void mmapValidateDmaBuffer | ( | struct MU * | m, | |
int | nsamples | |||
) |
Definition at line 766 of file llif.c.
Referenced by do_run(), and llSetDacs().
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 762 of file llif.c.
Referenced by do_run(), and llSetDacs().
return when any of the bits become true.
Definition at line 304 of file llif.c.
Referenced by enterLLC(), and llPollSack().
set a mail mbox register: ibox [0-3].
return 0 on success
Definition at line 206 of file llif.c.
Referenced by enterLLC(), enterLLC_SYNC_ECM(), llSetAddr(), llSetCmd(), llSetTlatch(), and runSCM216().
void setMboxPollcount | ( | struct MU * | m, | |
int | poll_count | |||
) |
Definition at line 322 of file llif.c.
Referenced by llv2WaitDmaDone(), llv2WaitDmaDone_2v(), and llWaitDmaDone().
void showLastWrites | ( | struct MU * | m | ) |
Definition at line 233 of file llif.c.
Referenced by quit_handler().
static void udelay | ( | int | usecs | ) | [static] |
int acq32_big_buf_base [static] |
Definition at line 563 of file llif.c.
Referenced by _getBigBufPrams(), and getBigBufPrams().
int acq32_big_buf_len [static] |
Definition at line 564 of file llif.c.
Referenced by _getBigBufPrams(), and getBigBufPrams().