LLC2_API
Classes | Defines | Typedefs | Functions | Variables
llif26.cpp File Reference
#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 "acq200_ioctl.h"

Go to the source code of this file.

Classes

struct  MU
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_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 FMT_IMASK   "/dev/acq200/acq200.%d.imask"
#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 MUmmapMbox (int iboard)
 iboard [1-3].
int getDmaBufferLen (struct DmaBuffer *buffer)
u32 getBusAddr (struct DmaBuffer *d, u32 offset_bytes)
u32getVaddr (struct DmaBuffer *db, u32 offset_bytes)
void acq32_enableInts (struct MU *mbx, unsigned mask)
void acq32_maskInts (struct MU *mbx, unsigned mask)
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)
void setPathCleanup (struct MU *m, unsigned cmd)
 set a deferred action to take place on path close/
void acq200_setImask (int slot, const char *mask)
void acq200_setImask (int slot, u32 *mask)

Variables

int verbose

Define Documentation

#define dbg (   level,
  fmt,
  arg... 
)    fprintf(stderr, fmt, ## arg)

Definition at line 64 of file llif26.cpp.

#define FMT_IMASK   "/dev/acq200/acq200.%d.imask"

Definition at line 89 of file llif26.cpp.

Referenced by acq200_setImask().

#define FMT_SYS_DEV   "/sys/class/acqX00/acq200.%d/device/"

Definition at line 85 of file llif26.cpp.

#define FMT_SYS_DEV_HOST_LEN   FMT_SYS_DEV "host_len"

Definition at line 87 of file llif26.cpp.

Referenced by host_len().

#define FMT_SYS_DEV_HOST_PA   FMT_SYS_DEV "host_pa"

Definition at line 86 of file llif26.cpp.

Referenced by host_pa().

#define FMT_SYS_PARAMS   "/sys/module/acq200_hostdrv/parameters/"

Definition at line 82 of file llif26.cpp.

#define FMT_SYS_SLOTS   FMT_SYS_PARAMS "slots"

Definition at line 83 of file llif26.cpp.

Referenced by lookup_device_index().

#define FN   "mmapDmaBuffer() "

Referenced by mmapBigBuffer().

#define FNAME_FMT   "/dev/acq32/acq32.%d."

Definition at line 77 of file llif26.cpp.

#define FNAME_FMT_HOST   FNAME_FMT "host"

Definition at line 80 of file llif26.cpp.

Referenced by mmapBigBuffer().

#define FNAME_FMT_MBOX   FNAME_FMT "raw"

Definition at line 78 of file llif26.cpp.

Referenced by mmapMbox().

#define INITBUF_MARKER   0x1100c0de

Definition at line 460 of file llif26.cpp.

Referenced by hbPoll(), hbPrimeBuffer(), and hbPrimePoll().


Typedef Documentation

typedef volatile u32 r32

Definition at line 67 of file llif26.cpp.


Function Documentation

void acq200_setImask ( int  slot,
const char *  mask 
)

Definition at line 536 of file llif26.cpp.

References FMT_IMASK.

Referenced by LL_ControlSystemI::Arm(), measureBridgeStats(), and LL_ControlSystemI::Stop().

void acq200_setImask ( int  slot,
u32 mask 
)

Definition at line 551 of file llif26.cpp.

References FMT_IMASK.

void acq32_enableInts ( struct MU mbx,
unsigned  mask 
)

Definition at line 371 of file llif26.cpp.

References ACQ32_IOS_INTS_ENABLE, MU::fd, and PRINTF.

void acq32_maskInts ( struct MU mbx,
unsigned  mask 
)

Definition at line 381 of file llif26.cpp.

References ACQ32_IOS_INTS_DISABLE, MU::fd, and PRINTF.

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

just clr these bits.

Definition at line 203 of file llif26.cpp.

References IN_RANGE, MU::mailboxes, and MU::mailboxes_shadow.

u32 getBusAddr ( struct DmaBuffer d,
u32  offset_bytes 
)

Definition at line 349 of file llif26.cpp.

References DmaBuffer::physaddr.

Referenced by appEnterLLC_SYNC_2VAO32(), and updateTargetAddr().

int getDmaBufferLen ( struct DmaBuffer buffer)

Definition at line 343 of file llif26.cpp.

References DmaBuffer::nbytes.

u32 getMbox ( struct MU m,
int  ibox 
)

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

Definition at line 222 of file llif26.cpp.

References IN_RANGE, MU::mailboxes, MU::mailboxes_shadow, and PRINTF.

Referenced by llGetCsr(), llGetTinst(), llGetTlatch(), measureBridge(), measureBridgeStats(), mmapMbox(), monitor_handler(), pollAck(), pollMboxBits(), and quit_handler().

int getMboxPollcount ( struct MU m)

Definition at line 269 of file llif26.cpp.

References MU::poll_count.

u32 getMboxShadow ( struct MU m,
int  ibox 
)

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

Definition at line 241 of file llif26.cpp.

References IN_RANGE, and MU::mailboxes_shadow.

Referenced by llWaitDmaDone().

u32* getVaddr ( struct DmaBuffer db,
u32  offset_bytes 
)
int hbPoll ( struct DmaBuffer buf,
int  offset,
int  sample_len,
volatile int *  user_abort 
)

Definition at line 496 of file llif26.cpp.

References INITBUF_MARKER, marker, PRINTF, udelay(), and DmaBuffer::vaddr.

void hbPrimeBuffer ( struct DmaBuffer buf)

Definition at line 478 of file llif26.cpp.

References INITBUF_MARKER, memset32(), DmaBuffer::nbytes, and DmaBuffer::vaddr.

Referenced by initCardResource().

void hbPrimePoll ( struct DmaBuffer buf,
int  offset,
int  sample_len 
)

Definition at line 488 of file llif26.cpp.

References INITBUF_MARKER, marker, and DmaBuffer::vaddr.

static unsigned host_len ( int  iboard) [static]

Definition at line 135 of file llif26.cpp.

References FMT_SYS_DEV_HOST_LEN, and lookup_device_index().

Referenced by mmapBigBuffer().

static unsigned host_pa ( int  iboard) [static]

Definition at line 153 of file llif26.cpp.

References FMT_SYS_DEV_HOST_PA, and lookup_device_index().

Referenced by mmapBigBuffer().

static int lookup_device_index ( int  slot) [static]

Definition at line 91 of file llif26.cpp.

References FMT_SYS_SLOTS, and IN_RANGE.

Referenced by host_len(), and host_pa().

struct DmaBuffer* mmapBigBuffer ( int  iboard,
unsigned  nbytes 
) [read]
struct MU* mmapMbox ( int  iboard) [read]

iboard [1-3].

return mapping on success.

Definition at line 275 of file llif26.cpp.

References MU::fd, FNAME_FMT_MBOX, getMbox(), IN_RANGE, MU::mailboxes, and PRINTF.

Referenced by initCardResource().

void mmapValidateDmaBuffer ( struct MU m,
int  nsamples 
)

Definition at line 455 of file llif26.cpp.

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

return when any of the bits become true.

Definition at line 247 of file llif26.cpp.

References getMbox(), and PRINTF.

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 172 of file llif26.cpp.

References IN_RANGE, MU::mailboxes, MU::mailboxes_lastwrite, MU::mailboxes_shadow, and PRINTF.

Referenced by enterLLC(), enterLLC_SYNC_ECM(), llSetAddr(), llSetCmd(), and llSetTlatch().

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

just set these bits.

Definition at line 195 of file llif26.cpp.

References IN_RANGE, MU::mailboxes, and MU::mailboxes_shadow.

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

set the field in the register only.

Definition at line 211 of file llif26.cpp.

References IN_RANGE, MU::mailboxes, and MU::mailboxes_shadow.

void setMboxPollcount ( struct MU m,
int  poll_count 
)

Definition at line 265 of file llif26.cpp.

References MU::poll_count.

Referenced by llv2WaitDmaDone(), llv2WaitDmaDone_2v(), and llWaitDmaDone().

void setPathCleanup ( struct MU m,
unsigned  cmd 
)

set a deferred action to take place on path close/

Parameters:
m
cmdcommand to send to MAILBOX_0, 0: no command

Definition at line 520 of file llif26.cpp.

References ACQ200_MBOX_IOWR, MU::fd, MailboxControl::mbc_flags, MBC_FLAGS_ONRELEASE, MBC_TO_MBXR, MBC_TO_MBXW, and MailboxControl::mbxw.

Referenced by enterLLC(), and leaveLLC().

void showLastWrites ( struct MU m)

Definition at line 186 of file llif26.cpp.

References MU::mailboxes_lastwrite.

Referenced by quit_handler().

static void udelay ( int  usecs) [static]

Definition at line 464 of file llif26.cpp.

Referenced by hbPoll().


Variable Documentation

int verbose

Definition at line 60 of file llif26.cpp.

Referenced by LL_ControlSystemI::init(), and monitor_handler().