MAIN llcontrol top level and "UI". 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"
Go to the source code of this file.
Defines | |
#define | FLAVOR "ACQ32" |
#define | VERID "llcontrol $Revision: 1.30.2.43 $ B1051 " FLAVOR "\n" |
#define | HELP |
#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 | |
static void | setDefaults (struct TestDescription *td) |
static void | loadPramfile (struct TestDescription *td, const char *pram_file) |
ACQ216 ONLY: pram_file contains binary array of struct LLC200_INIT. | |
static u32 | makeChannelMask (struct TestDescription *td) |
static void | initPrams (struct TestDescription *td) |
force channel mask if not already set in prams data. | |
static int | make_output_file (struct TestDescription *td, int slot, const char *class) |
void | updateTimingStats (struct TimingStats *buffer, int iter, struct TimingStats *tstats) |
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) |
static void | td_allocate_dac_data (struct TestDescription *td, int nsamples) |
static void | td_load_dac_data_impulse (struct TestDescription *td) |
static int | get_file_size (const char *fname) |
static void | td_load_dac_data_file (struct TestDescription *td, const char *fname) |
static void | td_load_dac_data (struct TestDescription *td) |
static void | setEdge (int *flag, const char *arg) |
static void | selectBoards (struct TestDescription *td, const char *board_def) |
static void | doWorkBufDataOutput (struct TestDescription *td) |
static void | doDmaBufDataOutput (struct TestDescription *td) |
static void | doPostShotAnalysis (struct TestDescription *td) |
static void | initWorkBuf (struct TestDescription *td) |
void | initV2Stats (struct TestDescription *td) |
static void | initV2 (struct TestDescription *td) |
LLC V2 initialization - pick up prams from config file. | |
int | main (int argc, const char *argv[]) |
Variables | |
const char * | core_ident |
int | verbose = 0 |
int | G_quit |
static int | CLIP_LIMIT = 100000 |
static int | is_v2 = 0 |
unsigned | llcv2_hb_offset = LLCV2_HB_OFFSET |
but for future, simpler host side drivers, we'd like a single 4K buf, no offset. |
MAIN llcontrol top level and "UI".
llcontrol -
Definition in file llcontrol.c.
#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 574 of file llcontrol.c.
Referenced by dumpTimingStats(), and extractTprocess().
#define DFMT "%8d, %10d, %10d, %8d, %8d, %6d, %4d, " |
Referenced by dumpTimingStats().
#define FLAVOR "ACQ32" |
Definition at line 348 of file llcontrol.c.
#define HELP |
Definition at line 353 of file llcontrol.c.
Referenced by main().
#define HFMT "%8s, %10s, %10s, %8s, %8s, %6s, %4s, " |
Referenced by dumpTimingStats().
#define VERID "llcontrol $Revision: 1.30.2.43 $ B1051 " FLAVOR "\n" |
Definition at line 351 of file llcontrol.c.
Referenced by main().
static void doDmaBufDataOutput | ( | struct TestDescription * | td | ) | [static] |
Definition at line 796 of file llcontrol.c.
References EACHBUF, EACHSLOT, fd_out, FOREACHCARD, getVaddr(), TestDescription::iterations, make_output_file(), TestDescription::overwrite, TestDescription::sample_offset, TestDescription::samples, and td_sample_size().
Referenced by doPostShotAnalysis().
static void doPostShotAnalysis | ( | struct TestDescription * | td | ) | [static] |
Definition at line 817 of file llcontrol.c.
References TestDescription::do_work, doDmaBufDataOutput(), doWorkBufDataOutput(), dumpTimingStats(), dumpTimingStatsBin(), fclose(), TestDescription::outfname, TestDescription::tlog, and TestDescription::tlog_binfile.
Referenced by main().
static void doWorkBufDataOutput | ( | struct TestDescription * | td | ) | [static] |
Definition at line 779 of file llcontrol.c.
References EACHSLOT, fd_out, FOREACHCARD, icard, 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] |
Definition at line 589 of file llcontrol.c.
References CLIP, CLIP_LIMIT, DFMT, EACHSLOT, extractTprocess(), FOREACHCARD, TimingStats::hb_poll, HFMT, isAcq216(), TimingStats::iter, TestDescription::iterations, TestDescription::stats_buf, TimingStats::target_poll, TimingStats::test_points, TimingStats::tinst, and TimingStats::tlatch.
Referenced by doPostShotAnalysis().
static void dumpTimingStatsBin | ( | struct TestDescription * | td, | |
const char * | bfile | |||
) | [static] |
Definition at line 663 of file llcontrol.c.
References fclose(), FOREACHCARD, TimingStats::iter, TestDescription::iterations, 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 576 of file llcontrol.c.
References CLIP, isAcq216(), TimingStats::tinst, TimingStats::tlatch, and TimingStats::tprocess.
Referenced by dumpTimingStats().
static int get_file_size | ( | const char * | fname | ) | [static] |
Definition at line 704 of file llcontrol.c.
Referenced by td_load_dac_data_file().
static void initPrams | ( | struct TestDescription * | td | ) | [static] |
force channel mask if not already set in prams data.
Definition at line 519 of file llcontrol.c.
References LLC200_INIT::channel_mask, TestDescription::channels, isAcq216HS(), TestDescription::llc200_init, LLC200_INIT_MASK_CHANNEL, makeChannelMask(), and LLC200_INIT::mask.
Referenced by main().
static void initV2 | ( | struct TestDescription * | td | ) | [static] |
LLC V2 initialization - pick up prams from config file.
WORKTODO V2
Definition at line 855 of file llcontrol.c.
References TestDescription::hb_polling, initV2Stats(), and TestDescription::V2_BUFS.
Referenced by main().
void initV2Stats | ( | struct TestDescription * | td | ) |
Definition at line 874 of file llcontrol-core.c.
References debug_prompt(), EACHBUF, FOREACHCARD, getBusAddr(), getVaddr(), icard, LLCV2_INIT_AI_HSBT, LLCV2_INIT_AO_HSBS, LLCV2_INIT_DO_HSBS, LLCV2_INIT_MARKER, LLCV2_INIT_STATUS_HSBT, updateTstats, TestDescription::V2_BUFS, V2_NOBUF, and waitDmaDone.
Referenced by initV2().
static void initWorkBuf | ( | struct TestDescription * | td | ) | [static] |
Definition at line 839 of file llcontrol.c.
References FOREACHCARD, icard, TestDescription::iterations, len, TestDescription::samples, td_sample_size(), and TestDescription::work_buf.
Referenced by main().
static void loadPramfile | ( | struct TestDescription * | td, | |
const char * | pram_file | |||
) | [static] |
ACQ216 ONLY: pram_file contains binary array of struct LLC200_INIT.
Definition at line 445 of file llcontrol.c.
References fclose(), isAcq216(), TestDescription::llc200_init, TestDescription::llc200_init_count, and LLC200_INIT_SZ.
Referenced by main().
int main | ( | int | argc, | |
const char * | argv[] | |||
) |
Definition at line 872 of file llcontrol.c.
References TestDescription::acq216hs_ch12ch34_bonding, TestDescription::ao32_count, TestDescription::ao32_ids, TestDescription::arg, TestDescription::channels, CLIP_LIMIT, TestDescription::clkpos, core_ident, TestDescription::dac_data_file, TestDescription::decimation, TestDescription::ARG::divisor, TestDescription::do_work, doPostShotAnalysis(), EACHCARD, TestDescription::feedback, TestDescription::feedback_channel, FOREACHCARD, TestDescription::hardware_gate_off, TestDescription::hb_polling, HELP, initCardResource(), initPrams(), initV2(), initWorkBuf(), TestDescription::internal_loopback, TestDescription::ARG::interval, IS_SYNC_2V, is_v2, isAcq216HS(), TestDescription::iterations, TestDescription::llc200_init_count, loadPramfile(), TestDescription::mask_ints, TestDescription::mask_ints_mask, MAX, MAXAO32, TestDescription::min_latency_test, mmapBigBuffer(), mmapDmaBuffer(), mmapValidateDmaBuffer(), TestDescription::mode, TestDescription::outfname, TestDescription::overwrite, runTest(), TestDescription::sample_offset, TestDescription::sample_size, TestDescription::samples, selectBoards(), setDefaults(), setEdge(), setupAbortHandler(), setupMonitor(), short, STREQ, td_dss(), td_load_dac_data(), td_sample_size(), TestDescription::tlog, TestDescription::tlog_binfile, TestDescription::trpos, verbose, and VERID.
static int make_output_file | ( | struct TestDescription * | td, | |
int | slot, | |||
const char * | class | |||
) | [static] |
Definition at line 536 of file llcontrol.c.
References fd_out, and TestDescription::outfname.
Referenced by doDmaBufDataOutput(), and doWorkBufDataOutput().
static u32 makeChannelMask | ( | struct TestDescription * | td | ) | [inline, static] |
Definition at line 487 of file llcontrol.c.
References TestDescription::acq216hs_ch12ch34_bonding, TestDescription::channels, and isAcq216HS().
Referenced by initPrams().
static void selectBoards | ( | struct TestDescription * | td, | |
const char * | board_def | |||
) | [static] |
Definition at line 758 of file llcontrol.c.
References TestDescription::cards, EACHSLOT, FOREACHCARD, TestDescription::ncards, and Card::slot.
Referenced by main().
static void setDefaults | ( | struct TestDescription * | td | ) | [static] |
Definition at line 412 of file llcontrol.c.
References TestDescription::arg, TestDescription::channels, TestDescription::clkpos, TestDescription::decimation, TestDescription::hb_polling, TestDescription::internal_loopback, TestDescription::ARG::interval, isAcq216(), TestDescription::iterations, TestDescription::mask_ints, TestDescription::mask_ints_mask, TestDescription::mode, TestDescription::overwrite, TestDescription::samples, TestDescription::trpos, and TestDescription::update_dacs.
Referenced by main().
static void setEdge | ( | int * | flag, | |
const char * | arg | |||
) | [static] |
Definition at line 751 of file llcontrol.c.
Referenced by main().
static void td_allocate_dac_data | ( | struct TestDescription * | td, | |
int | nsamples | |||
) | [static] |
Definition at line 687 of file llcontrol.c.
References TestDescription::dac_cursor, TestDescription::dac_data, TestDescription::dac_data_samples, and DAC_SAMPLE_SIZE.
Referenced by td_load_dac_data_file(), and td_load_dac_data_impulse().
static void td_load_dac_data | ( | struct TestDescription * | td | ) | [static] |
Definition at line 736 of file llcontrol.c.
References TestDescription::dac_data_file, td_load_dac_data_file(), td_load_dac_data_impulse(), and TestDescription::update_dacs.
Referenced by main().
static void td_load_dac_data_file | ( | struct TestDescription * | td, | |
const char * | fname | |||
) | [static] |
Definition at line 715 of file llcontrol.c.
References TestDescription::dac_data, DAC_SAMPLE_SIZE, fclose(), get_file_size(), and td_allocate_dac_data().
Referenced by td_load_dac_data().
static void td_load_dac_data_impulse | ( | struct TestDescription * | td | ) | [static] |
Definition at line 695 of file llcontrol.c.
References TestDescription::dac_data, DAC_SAMPLE_SIZE, and td_allocate_dac_data().
Referenced by td_load_dac_data().
void updateTimingStats | ( | struct TimingStats * | buffer, | |
int | iter, | |||
struct TimingStats * | tstats | |||
) |
Definition at line 561 of file llcontrol.c.
References TimingStats::iter.
Referenced by do_run(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_2VRFM(), and runSYNC_ECM().
int CLIP_LIMIT = 100000 [static] |
Definition at line 571 of file llcontrol.c.
Referenced by dumpTimingStats(), and main().
const char* core_ident |
Definition at line 232 of file llcontrol-core.c.
Referenced by main().
int G_quit |
Definition at line 409 of file llcontrol.c.
Referenced by do_run(), monitor_handler(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_2VRFM(), and runSYNC_ECM().
int is_v2 = 0 [static] |
Definition at line 870 of file llcontrol.c.
Referenced by main().
unsigned llcv2_hb_offset = LLCV2_HB_OFFSET |
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 1113 of file llcontrol.c.
Referenced by appEnterLLC_SYNC_2V(), appEnterLLC_SYNC_2VAO32(), and appEnterLLC_SYNC_ECM().
int verbose = 0 |
Definition at line 400 of file llcontrol.c.
Referenced by main(), and monitor_handler().