LLC2_API
Defines | Functions | Variables
llcontrol-core.cpp File Reference

module implements the core of llcontrol loop. More...

#include "local.h"
#include <assert.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/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <popt.h>
#include "acq32ioctl.h"
#include "acq32busprot.h"
#include "llif.h"
#include "llprotocol.h"
#include "llcontrol.h"
#include "x86timer.h"
#include "llcontrol-core.h"
#include <signal.h>

Go to the source code of this file.

Defines

#define FLAVOR   "ACQ196"
#define NMEASURE   20
#define SAMPLE_SIZE   (96*2)
#define BAR_FIFO   3
#define CLIP(t)   ((t) < 0? -1: (t) > CLIP_LIMIT? (-1): (t))
 CLIP bogus times - not to try hide anything - big number spoils display.
#define HFMT   "%8s, %10s, %10s, %8s, %8s, %6s, %4s, "
#define DFMT   "%8d, %10d, %10d, %8d, %8d, %6d, %4d, "

Functions

void v2_updateTstats (u32 cmd, struct Card *card, struct TimingStats *tstats)
 updates timing stats from embedded host buffer data
u32 card_v2_WaitDmaDone (struct Card *card)
 updates timing stats from embedded host buffer data
static int measureBridge (struct MU *mu)
 Run a test - measureBridge performance.
static int measureBridgeStats (struct TestDescription *td, struct MU *mu)
static void quit_handler (int signum)
void setupAbortHandler (struct TestDescription *td)
static void monitor_handler (int signum)
void setupMonitor (int millisec)
void initCardResource (struct Card *card)
static void debug_prompt (int icard, int ibuf, u32 addr)
 promnpt user to ensure pram set (temporary pre-update measure).
static void sync_2v_updateTstats (u32 cmd, struct Card *card, struct TimingStats *tstats)
 updates timing stats from embedded host buffer data
static u32 card_sync_2v_WaitDmaDone (struct Card *card)
static u32 getSlavePa (int slot)
static void setSlaveData (u32 *aovec, void *src)
 create some data for AO32CPCI.
void appEnterLLC_SYNC_2VAO32 (int icard, struct MU *mu, struct TestDescription *td)
 set up LLCV2_INIT buffer and enter mode.
static int make_output_file (struct TestDescription *td, int slot, const char *_class)
static void doWorkBufDataOutput (struct TestDescription *td)
static void doDmaBufDataOutput (struct TestDescription *td)
static int extractTprocess (struct TimingStats *ts)
 if TP is available, USE IT, else calculate from tlatch, tinst this is valid because either it is accurate IOP calc, or worst case Host calc
static void dumpTimingStats (struct TestDescription *td, FILE *fp)
static void dumpTimingStatsBin (struct TestDescription *td, const char *bfile)
void doPostShotAnalysis (struct TestDescription *td)
void updateTimingStats (struct TimingStats *buffer, int iter, struct TimingStats *tstats)

Variables

const char * core_ident = "$Revision: 1.1.4.33 $ B1102\n"
int G_quit
unsigned llcv2_hb_offset = 0
 but for future, simpler host side drivers, we'd like a single 4K buf, no offset.
void(* updateTstats )(u32 cmd, struct Card *card, struct TimingStats *tstats)
 defaults to V1 mbox.
u32(* waitDmaDone )(struct Card *c) = card_v2_WaitDmaDone
 virtual function to block until DMA done.
int user_abort = 0
static struct TestDescriptionS_td
static int CLIP_LIMIT = 100000

Detailed Description

module implements the core of llcontrol loop.

Linux 2.4 Host Only:

2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4

Note on HOST MEMORY MAP: assumes bootcommand configured as follows, to allow a 16MB host area per card in at the top of memory. This host area will be slaved off the pci backplane

eg

[dt100 dt100]$ cat /proc/cmdline mem=320M acq32.load_order=slotbased

acq32_big_buf_base=0x18000000 acq32_big_buf_len=0x08000000

For the purpose of LLCONTROL, each 16MB card are is used as follows:

2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4

This means that if the llcontrol app is using an incrementing memory strategy in host buffer for AI, this is subject to max 15MB (80K samples at 96 channels).

The message buffers are used for DAC output. The application reserves a Mesage Frame Address (MFA) from the target before copying data to slave memory. The MFA is an index into the message buffer memory.

Linux 2.6 Host:

the host buffer is setup dynamically, but is LIMITED to 4MB, of which the top 1M is used for messaging.

Definition in file llcontrol-core.cpp.


Define Documentation

#define BAR_FIFO   3

Definition at line 371 of file llcontrol-core.cpp.

Referenced by getSlavePa().

#define CLIP (   t)    ((t) < 0? -1: (t) > CLIP_LIMIT? (-1): (t))

CLIP bogus times - not to try hide anything - big number spoils display.

Definition at line 535 of file llcontrol-core.cpp.

Referenced by dumpTimingStats(), and extractTprocess().

#define DFMT   "%8d, %10d, %10d, %8d, %8d, %6d, %4d, "

Referenced by dumpTimingStats().

#define FLAVOR   "ACQ196"

Definition at line 98 of file llcontrol-core.cpp.

#define HFMT   "%8s, %10s, %10s, %8s, %8s, %6s, %4s, "

Referenced by dumpTimingStats().

#define NMEASURE   20

Referenced by measureBridge().

#define SAMPLE_SIZE   (96*2)

Function Documentation

void appEnterLLC_SYNC_2VAO32 ( int  icard,
struct MU mu,
struct TestDescription td 
)
static u32 card_sync_2v_WaitDmaDone ( struct Card card) [static]
u32 card_v2_WaitDmaDone ( struct Card card)

updates timing stats from embedded host buffer data

Definition at line 129 of file llcontrol-core.cpp.

References Card::buf, getVaddr(), LLCV2_OFFSET_STATUS_HSBT, llv2WaitDmaDone(), and Card::mbx.

static void debug_prompt ( int  icard,
int  ibuf,
u32  addr 
) [static]

promnpt user to ensure pram set (temporary pre-update measure).

Definition at line 329 of file llcontrol-core.cpp.

References LLCV2_INIT_AI_HSBT, LLCV2_INIT_AO_HSBS, LLCV2_INIT_DO_HSBS, and LLCV2_INIT_STATUS_HSBT.

static void doDmaBufDataOutput ( struct TestDescription td) [static]
void doPostShotAnalysis ( struct TestDescription td)
static void doWorkBufDataOutput ( struct TestDescription td) [static]
static void dumpTimingStats ( struct TestDescription td,
FILE *  fp 
) [static]
static void dumpTimingStatsBin ( struct TestDescription td,
const char *  bfile 
) [static]
static int extractTprocess ( struct TimingStats ts) [inline, static]

if TP is available, USE IT, else calculate from tlatch, tinst this is valid because either it is accurate IOP calc, or worst case Host calc

Definition at line 537 of file llcontrol-core.cpp.

References CLIP, TimingStats::tinst, and TimingStats::tlatch.

Referenced by dumpTimingStats().

static u32 getSlavePa ( int  slot) [static]

Definition at line 374 of file llcontrol-core.cpp.

References BAR_FIFO.

Referenced by appEnterLLC_SYNC_2VAO32().

void initCardResource ( struct Card card)
static int make_output_file ( struct TestDescription td,
int  slot,
const char *  _class 
) [static]

Definition at line 474 of file llcontrol-core.cpp.

References TestDescription::outfname.

Referenced by doDmaBufDataOutput(), and doWorkBufDataOutput().

static int measureBridge ( struct MU mu) [static]

Run a test - measureBridge performance.

Todo:
could be set by a signal

Definition at line 147 of file llcontrol-core.cpp.

References get_elapsed_microseconds(), getMbox(), INIT_TIMER, and NMEASURE.

static int measureBridgeStats ( struct TestDescription td,
struct MU mu 
) [static]
static void monitor_handler ( int  signum) [static]
static void quit_handler ( int  signum) [static]

Definition at line 240 of file llcontrol-core.cpp.

References EACHMBX, FOREACHCARD, getMbox(), leaveLLC(), S_td, and showLastWrites().

Referenced by setupAbortHandler().

static void setSlaveData ( u32 aovec,
void *  src 
) [static]

create some data for AO32CPCI.

AO32 gets AO16 data duplicated, DO64 gets a walking bit

Definition at line 409 of file llcontrol-core.cpp.

void setupAbortHandler ( struct TestDescription td)

Definition at line 264 of file llcontrol-core.cpp.

References quit_handler().

Referenced by LL_ControlSystemI::Arm().

void setupMonitor ( int  millisec)

Definition at line 307 of file llcontrol-core.cpp.

References monitor_handler().

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

static void sync_2v_updateTstats ( u32  cmd,
struct Card card,
struct TimingStats tstats 
) [static]
void updateTimingStats ( struct TimingStats buffer,
int  iter,
struct TimingStats tstats 
)

Definition at line 668 of file llcontrol-core.cpp.

References TimingStats::iter.

void v2_updateTstats ( u32  cmd,
struct Card card,
struct TimingStats tstats 
)

Variable Documentation

int CLIP_LIMIT = 100000 [static]

Definition at line 532 of file llcontrol-core.cpp.

const char* core_ident = "$Revision: 1.1.4.33 $ B1102\n"

Definition at line 102 of file llcontrol-core.cpp.

int G_quit

Definition at line 104 of file llcontrol-core.cpp.

Referenced by monitor_handler().

unsigned llcv2_hb_offset = 0

but for future, simpler host side drivers, we'd like a single 4K buf, no offset.

=> use a variable and set as appropriate

Definition at line 108 of file llcontrol-core.cpp.

Referenced by appEnterLLC_SYNC_2VAO32().

struct TestDescription* S_td [static]

Definition at line 238 of file llcontrol-core.cpp.

Referenced by quit_handler().

Initial value:

defaults to V1 mbox.

Definition at line 125 of file llcontrol-core.cpp.

Referenced by appEnterLLC_SYNC_2VAO32(), and LL_ControlSystemI::IO().

int user_abort = 0

Definition at line 143 of file llcontrol-core.cpp.

waitDmaDone = card_v2_WaitDmaDone

virtual function to block until DMA done.

defaults to V1 mbox

Definition at line 137 of file llcontrol-core.cpp.

Referenced by appEnterLLC_SYNC_2VAO32(), and LL_ControlSystemI::IO().