LLC2_API
|
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 TestDescription * | S_td |
static int | CLIP_LIMIT = 100000 |
module implements the core of llcontrol loop.
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.
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 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) |
void appEnterLLC_SYNC_2VAO32 | ( | int | icard, |
struct MU * | mu, | ||
struct TestDescription * | td | ||
) |
set up LLCV2_INIT buffer and enter mode.
Buffer set up as 4K block at offset 0
set up for single 4K buffer
uses V2 synchronization
Definition at line 429 of file llcontrol-core.cpp.
References TestDescription::ao32_count, TestDescription::ao32_ids, TestDescription::arg, BP_FC_SET_LLCV2_INIT, card_sync_2v_WaitDmaDone(), TestDescription::cards, Card::channels, TestDescription::clkpos, TestDescription::ARG::divisor, EACHBUF, enterLLC_SYNC_ECM(), getBusAddr(), getSlavePa(), getVaddr(), TestDescription::internal_loopback, LLCV2_AI_HSBT, LLCV2_AO_HSBS, llcv2_hb_offset, LLCV2_INIT_AI_HSBT, LLCV2_INIT_AO32PA0, LLCV2_INIT_AO_HSBS, LLCV2_INIT_MAGIC_AO32, LLCV2_INIT_MARKER, MASTER, PRINTF, Card::sync_2v_offset_status_hsbt, sync_2v_updateTstats(), Card::tlatch, TestDescription::trpos, updateTstats, and waitDmaDone.
Referenced by LL_ControlSystemI::Arm().
Definition at line 363 of file llcontrol-core.cpp.
References Card::buf, getVaddr(), llv2WaitDmaDone_2v(), Card::mbx, Card::sync_2v_offset_status_hsbt, and Card::tlatch.
Referenced by appEnterLLC_SYNC_2VAO32().
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] |
Definition at line 513 of file llcontrol-core.cpp.
References EACHBUF, EACHSLOT, FOREACHCARD, getVaddr(), TestDescription::iterations, make_output_file(), TestDescription::overwrite, TestDescription::sample_offset, TestDescription::samples, and td_sample_size().
Referenced by doPostShotAnalysis().
void doPostShotAnalysis | ( | struct TestDescription * | td | ) |
Definition at line 644 of file llcontrol-core.cpp.
References TestDescription::do_work, doDmaBufDataOutput(), doWorkBufDataOutput(), dumpTimingStats(), dumpTimingStatsBin(), TestDescription::outfname, TestDescription::tlog, and TestDescription::tlog_binfile.
Referenced by LL_ControlSystemI::~LL_ControlSystemI().
static void doWorkBufDataOutput | ( | struct TestDescription * | td | ) | [static] |
Definition at line 498 of file llcontrol-core.cpp.
References EACHSLOT, FOREACHCARD, TestDescription::iterations, make_output_file(), TestDescription::samples, td_sample_size(), and TestDescription::work_buf.
Referenced by doPostShotAnalysis().
static void dumpTimingStats | ( | struct TestDescription * | td, |
FILE * | fp | ||
) | [static] |
brief report
brief report
Definition at line 546 of file llcontrol-core.cpp.
References CLIP, DFMT, EACHSLOT, extractTprocess(), FOREACHCARD, TimingStats::hb_poll, HFMT, TimingStats::iter, TestDescription::iterations, MAXCARDS, MAXTEST, TestDescription::stats_buf, TimingStats::target_poll, TimingStats::test_points, TimingStats::tinst, TimingStats::tlatch, and TestDescription::tlog.
Referenced by doPostShotAnalysis().
static void dumpTimingStatsBin | ( | struct TestDescription * | td, |
const char * | bfile | ||
) | [static] |
Definition at line 621 of file llcontrol-core.cpp.
References FOREACHCARD, TimingStats::iter, TestDescription::iterations, MAXCARDS, TestDescription::stats_buf, and TimingStats::tinst.
Referenced by doPostShotAnalysis().
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 | ) |
Definition at line 319 of file llcontrol-core.cpp.
References ACQ196_BIGBUF_AREA, Card::buf, get_cpu_clock_speed(), hbPrimeBuffer(), Card::mbx, mmapBigBuffer(), mmapMbox(), and Card::slot.
Referenced by ACQ196::init().
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.
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] |
enable all!
Definition at line 178 of file llcontrol-core.cpp.
References acq200_setImask(), EACHSLOT, FOREACHCARD, get_elapsed_microseconds(), getMbox(), INIT_TIMER, TestDescription::iterations, TestDescription::mask_ints, TestDescription::mask_ints_mask, and PRINTF.
static void monitor_handler | ( | int | signum | ) | [static] |
Definition at line 276 of file llcontrol-core.cpp.
References TestDescription::cards, G_quit, getMbox(), TestDescription::iter, Card::mbx, setupMonitor(), and verbose.
Referenced by setupMonitor().
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] |
updates timing stats from embedded host buffer data
Definition at line 352 of file llcontrol-core.cpp.
References Card::buf, getVaddr(), LLC_GET_TCYCLE, LLC_SYNC2V_IN_MBOX0, LLC_SYNC2V_IN_MBOX2, LLC_SYNC2V_IN_TINST, llv2_extend32(), Card::sync_2v_offset_status_hsbt, TimingStats::tinst, and TimingStats::tprocess.
Referenced by appEnterLLC_SYNC_2VAO32().
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 | ||
) |
updates timing stats from embedded host buffer data
Definition at line 114 of file llcontrol-core.cpp.
References BP_MB_LLC_CSR, BP_MB_LLC_TINST, Card::buf, getVaddr(), LLC_GET_TCYCLE, LLCV2_OFFSET_STATUS_HSBT, LLCV2_STATUS_TINST, llv2_extend32(), TimingStats::tinst, and TimingStats::tprocess.
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().
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().