Data Structures | Defines | Typedefs | Functions | Variables

llif.c File Reference

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 MUmmapMbox (int iboard)
 iboard [1-3].
int getDmaBufferLen (struct DmaBuffer *buffer)
struct DmaBuffermmapDmaBuffer (int iboard, unsigned nbytes)
u32 getBusAddr (struct DmaBuffer *d, u32 offset)
u32getVaddr (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 DmaBuffermmapBigBuffer (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

Detailed Description

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 Documentation

#define ACQ32_BIG_BUF_BASE   acq32_big_buf_base

Definition at line 560 of file llif.c.

#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   "/dev/acq32/acq32.%d."

Definition at line 200 of file llif.c.

#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 MAX_MAPPING   0x00100000

Definition at line 404 of file llif.c.

#define MAX_SEG   0x00020000

Definition at line 405 of file llif.c.

#define MAX_SEGMENTS   (MAX_MAPPING/MAX_SEG)

Definition at line 407 of file llif.c.

#define USE_IOCTL_DOC   "NOT USE_IOCTL memory mapped - x86 only FAST"

Definition at line 179 of file llif.c.

Referenced by mmapMbox().


Typedef Documentation

typedef volatile u32 r32

Definition at line 187 of file llif.c.


Function Documentation

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().

int clrMboxBits ( struct MU m,
int  ibox,
u32  bits_to_clr 
)

just clr these bits.

Definition at line 250 of file llif.c.

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().

u32 getBusAddr ( struct DmaBuffer d,
u32  offset 
)
int getDmaBufferLen ( struct DmaBuffer buffer  ) 

Definition at line 423 of file llif.c.

u32 getMbox ( struct MU m,
int  ibox 
)

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().

u32 getMboxShadow ( struct MU m,
int  ibox 
)

get last contents of mailbox register: ibox [0-3]

Definition at line 298 of file llif.c.

Referenced by llWaitDmaDone().

u32* getVaddr ( struct DmaBuffer db,
u32  offset 
)
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]

Definition at line 428 of file llif.c.

Referenced by main().

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 694 of file llif.c.

Referenced by main().

MFA mu_getInbound ( struct MU mu  ) 

Definition at line 774 of file llif.c.

int mu_putOutbound ( struct MU mu,
MFA  mfa 
)

Definition at line 766 of file llif.c.

Referenced by do_run(), and llSetDacs().

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.

NB: direction with respect to HOST!

Definition at line 762 of file llif.c.

Referenced by do_run(), and llSetDacs().

int mu_returnInbound ( struct MU mu,
MFA  mfa 
)

Definition at line 778 of file llif.c.

u32 pollMboxBits ( struct MU m,
int  ibox,
u32  mask,
u32  goal 
)

return when any of the bits become true.

Definition at line 304 of file llif.c.

Referenced by enterLLC(), and llPollSack().

int setMbox ( struct MU m,
int  ibox,
u32  value 
)

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().

int setMboxBits ( struct MU m,
int  ibox,
u32  bits_to_set 
)

just set these bits.

Definition at line 242 of file llif.c.

int setMboxField ( struct MU m,
int  ibox,
u32  field_mask,
u32  field_value 
)

set the field in the register only.

Definition at line 258 of file llif.c.

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]

Definition at line 706 of file llif.c.

Referenced by hbPoll().


Variable Documentation

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().