Data Structures | Defines | Typedefs | Functions

llif26.c File Reference

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

Detailed Description

implementation of device driver interface for LLC for kernel .2.6x.

Definition in file llif26.c.


Define Documentation

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

Definition at line 65 of file llif26.c.

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

Definition at line 90 of file llif26.c.

#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"

Definition at line 91 of file llif26.c.

Referenced by host_pa().

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

Definition at line 87 of file llif26.c.

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

Definition at line 81 of file llif26.c.

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

#define MAX_MAPPING   0x00100000

Definition at line 352 of file llif26.c.

#define MAX_SEG   0x00020000

Definition at line 353 of file llif26.c.

#define MAX_SEGMENTS   (MAX_MAPPING/MAX_SEG)

Definition at line 355 of file llif26.c.


Typedef Documentation

typedef volatile u32 r32

Definition at line 68 of file llif26.c.


Function Documentation

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.

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

just clr these bits.

Definition at line 207 of file llif26.c.

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

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

Definition at line 371 of file llif26.c.

References DmaBuffer::nbytes.

u32 getMbox ( struct MU m,
int  ibox 
)

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.

u32 getMboxShadow ( struct MU m,
int  ibox 
)

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

Definition at line 245 of file llif26.c.

References IN_RANGE, and MU::mailboxes_shadow.

u32* getVaddr ( struct DmaBuffer db,
u32  offset 
)

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]
struct DmaBuffer* mmapDmaBuffer ( int  iboard,
unsigned  nbytes 
) [read]
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.

MFA mu_getInbound ( struct MU mu  ) 

Definition at line 637 of file llif26.c.

References MU::outbound_q_port.

int mu_putOutbound ( struct MU mu,
MFA  mfa 
)

Definition at line 629 of file llif26.c.

References MU::inbound_q_port.

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 625 of file llif26.c.

References MU::inbound_q_port.

int mu_returnInbound ( struct MU mu,
MFA  mfa 
)

Definition at line 641 of file llif26.c.

References MU::outbound_q_port.

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

return when any of the bits become true.

Definition at line 251 of file llif26.c.

References getMbox(), and PRINTF.

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

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.

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

just set these bits.

Definition at line 199 of file llif26.c.

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

static void udelay ( int  usecs  )  [static]

Definition at line 568 of file llif26.c.

Referenced by hbPoll().