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 "ACQ32" |
#define | EACHMFA (dac_buf[icard].mfa) |
#define | EACHBBB (dac_buf[icard].bbb) |
#define | EACHDAC_BASE (EACHBBB + EACHMFA) |
#define | EACHDAC_BASE16 ((u16*)EACHDAC_BASE) |
#define | NMEASURE 20 |
Functions | |
static void | mbox_updateTstats (u32 cmd, struct Card *card, struct TimingStats *tstats) |
update timing stats from card mailbox. | |
void | v2_updateTstats (u32 cmd, struct Card *card, struct TimingStats *tstats) |
updates timing stats from embedded host buffer data | |
void | doApplicationWork (struct TestDescription *td, u32 offset) |
static u32 | card_v1_WaitDmaDone (struct Card *card) |
u32 | card_v2_WaitDmaDone (struct Card *card) |
updates timing stats from embedded host buffer data | |
static int | do_run (struct TestDescription *td, int soft_clock) |
runs the test. | |
static int | runSCM (struct TestDescription *td) |
Run a Test - Soft Clock Master. | |
static int | runECM (struct TestDescription *td) |
Run a Test - External Clock Master. | |
u32 | commandModifiers (struct TestDescription *td) |
static int | measureBridge (struct MU *mu) |
Run a test - measureBridge performance. | |
static int | measureBridgeStats (struct TestDescription *td, struct MU *mu) |
int | runTest (struct TestDescription *td) |
generic top level text exec. | |
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). | |
void | initV2Stats (struct TestDescription *td) |
Variables | |
const char * | core_ident = "$Revision: 1.1.4.33 $ B1102\n" |
void(* | updateTstats )(u32 cmd, struct Card *card, struct TimingStats *tstats) |
virtual function to retrieve timing stats. | |
u32(* | waitDmaDone )(struct Card *c) = card_v1_WaitDmaDone |
virtual function to block until DMA done. | |
int | user_abort = 0 |
static struct TestDescription * | S_td |
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.c.
#define EACHBBB (dac_buf[icard].bbb) |
#define EACHDAC_BASE (EACHBBB + EACHMFA) |
Referenced by do_run(), runSYNC_2V(), runSYNC_2VAO32(), and runSYNC_ECM().
#define EACHDAC_BASE16 ((u16*)EACHDAC_BASE) |
Referenced by do_run(), runSYNC_2V(), runSYNC_2VAO32(), and runSYNC_ECM().
#define EACHMFA (dac_buf[icard].mfa) |
Referenced by do_run().
#define FLAVOR "ACQ32" |
Definition at line 226 of file llcontrol-core.c.
#define NMEASURE 20 |
Referenced by measureBridge().
Definition at line 292 of file llcontrol-core.c.
References llWaitDmaDone(), and Card::mbx.
updates timing stats from embedded host buffer data
Definition at line 297 of file llcontrol-core.c.
References Card::buf, getVaddr(), LLCV2_OFFSET_STATUS_HSBT, llv2WaitDmaDone(), and Card::mbx.
u32 commandModifiers | ( | struct TestDescription * | td | ) |
Definition at line 553 of file llcontrol-core.c.
References LLCV2_INIT_MAGIC_MARKER, LLCV2_INIT_MARKER, and TestDescription::V2_BUFS.
Referenced by appEnterLLC_SYNC_2V(), appEnterLLC_SYNC_ECM(), and runTest().
static void debug_prompt | ( | int | icard, | |
int | ibuf, | |||
u32 | addr | |||
) | [static] |
promnpt user to ensure pram set (temporary pre-update measure).
Definition at line 862 of file llcontrol-core.c.
Referenced by initV2Stats().
static int do_run | ( | struct TestDescription * | td, | |
int | soft_clock | |||
) | [static] |
runs the test.
PSEUDO-CODE:
(b.2)
Definition at line 313 of file llcontrol-core.c.
References TestDescription::arg, TestDescription::channels, DAC_COUNT, DAC_SAMPLE_SIZE, TestDescription::decimation, TestDescription::do_work, doApplicationWork(), EACHBBB, EACHBUF, EACHCARD, EACHDAC_BASE, EACHDAC_BASE16, EACHMBX, EACHMFA, TestDescription::feedback, TestDescription::feedback_channel, FIRSTBUF, FIRSTMBX, FOREACHCARD, FOREACHCARD_MARK_TIME, G_quit, getMboxPollcount(), getVaddr(), TestDescription::hardware_gate_off, TimingStats::hb_poll, TestDescription::hb_polling, hbPoll(), hbPrimePoll(), icard, TestDescription::ARG::interval, TestDescription::iter, TestDescription::iterations, LLC_CSR_M_ARM, LLC_CSR_M_READCTR, LLC_CSR_M_SOFTCLOCK, LLC_MAKE_DECIM, llCounterRunning(), llGetTinst(), llSetCmd(), llSetDacs(), llSetTlatch(), MARK_TIME, memset32(), TestDescription::min_latency_test, mu_putOutbound(), mu_reserveOutbound(), TestDescription::overwrite, POLLALERT, PRINTF, TestDescription::sample_offset, TestDescription::stats_buf, TimingStats::target_poll, td_get_next_dac_data(), td_sample_size(), TimingStats::tlatch, TestDescription::tlog, TestDescription::update_dacs, updateTargetAddr(), updateTimingStats(), updateTstats, user_abort, and waitDmaDone.
void doApplicationWork | ( | struct TestDescription * | td, | |
u32 | offset | |||
) |
Definition at line 276 of file llcontrol-core.c.
References EACHBUF, FOREACHCARD, getVaddr(), icard, TestDescription::iter, td_sample_size(), and TestDescription::work_buf.
Referenced by do_run(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_2VRFM(), and runSYNC_ECM().
void initCardResource | ( | struct Card * | card | ) |
Definition at line 851 of file llcontrol-core.c.
References ACQ196_BIGBUF_AREA, Card::buf, get_cpu_clock_speed(), hbPrimeBuffer(), Card::mbx, mmapBigBuffer(), mmapMbox(), and Card::slot.
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 mbox_updateTstats | ( | u32 | cmd, | |
struct Card * | card, | |||
struct TimingStats * | tstats | |||
) | [static] |
update timing stats from card mailbox.
Definition at line 238 of file llcontrol-core.c.
References LLC_CSR_M_READCTR, llGetTinst(), llGetTprocess(), llSetCmd(), Card::mbx, PRINTF, Card::slot, TimingStats::tinst, TimingStats::tlatch, and TimingStats::tprocess.
static int measureBridge | ( | struct MU * | mu | ) | [static] |
Run a test - measureBridge performance.
Definition at line 565 of file llcontrol-core.c.
References get_elapsed_microseconds(), getMbox(), and NMEASURE.
Referenced by runTest().
static int measureBridgeStats | ( | struct TestDescription * | td, | |
struct MU * | mu | |||
) | [static] |
Definition at line 596 of file llcontrol-core.c.
References acq32_enableInts(), acq32_maskInts(), EACHMBX, FOREACHCARD, get_elapsed_microseconds(), getMbox(), TestDescription::iterations, TestDescription::mask_ints, TestDescription::mask_ints_mask, and PRINTF.
Referenced by runTest().
static void monitor_handler | ( | int | signum | ) | [static] |
Definition at line 808 of file llcontrol-core.c.
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 771 of file llcontrol-core.c.
References EACHMBX, FOREACHCARD, getMbox(), leaveLLC(), and showLastWrites().
Referenced by setupAbortHandler().
static int runECM | ( | struct TestDescription * | td | ) | [static] |
Run a Test - External Clock Master.
Definition at line 547 of file llcontrol-core.c.
References do_run().
Referenced by runTest().
static int runSCM | ( | struct TestDescription * | td | ) | [static] |
Run a Test - Soft Clock Master.
Definition at line 537 of file llcontrol-core.c.
References do_run().
Referenced by runTest().
int runTest | ( | struct TestDescription * | td | ) |
generic top level text exec.
Definition at line 646 of file llcontrol-core.c.
References acq32_enableInts(), acq32_maskInts(), appEnterLLC_SYNC_2V(), appEnterLLC_SYNC_2VAO32(), appEnterLLC_SYNC_2VRFM(), appEnterLLC_SYNC_ECM(), TestDescription::arg, TestDescription::clkpos, commandModifiers(), TestDescription::ARG::divisor, EACHMBX, enterLLCExtClock(), enterLLCSoftClock(), FOREACHCARD, G_env, icard, TestDescription::internal_loopback, isAcq216(), TestDescription::iterations, leaveLLC(), TestDescription::mask_ints, TestDescription::mask_ints_mask, measureBridge(), measureBridgeStats(), TestDescription::mode, PRINTF, runECM(), runSCM(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_2VRFM(), runSYNC_ECM(), TestDescription::stats_buf, THIS_CARD, TestDescription::tlog, and TestDescription::trpos.
Referenced by main().
void setupAbortHandler | ( | struct TestDescription * | td | ) |
void setupMonitor | ( | int | millisec | ) |
Definition at line 839 of file llcontrol-core.c.
References monitor_handler().
Referenced by main(), and monitor_handler().
void v2_updateTstats | ( | u32 | cmd, | |
struct Card * | card, | |||
struct TimingStats * | tstats | |||
) |
updates timing stats from embedded host buffer data
Definition at line 257 of file llcontrol-core.c.
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.
const char* core_ident = "$Revision: 1.1.4.33 $ B1102\n" |
Definition at line 232 of file llcontrol-core.c.
Referenced by main().
struct TestDescription* S_td [static] |
Definition at line 769 of file llcontrol-core.c.
virtual function to retrieve timing stats.
defaults to V1 mbox.
defaults to V1 mode mbox_updateTstats().
Definition at line 268 of file llcontrol-core.c.
Referenced by appEnterLLC_SYNC_2V(), appEnterLLC_SYNC_2VAO32(), appEnterLLC_SYNC_ECM(), do_run(), initV2Stats(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_2VRFM(), and runSYNC_ECM().
int user_abort = 0 |
Definition at line 311 of file llcontrol-core.c.
Referenced by do_run(), and runSCM216().
waitDmaDone = card_v1_WaitDmaDone |
virtual function to block until DMA done.
defaults to V1 mbox
Definition at line 305 of file llcontrol-core.c.
Referenced by appEnterLLC_SYNC_2V(), appEnterLLC_SYNC_2VAO32(), appEnterLLC_SYNC_ECM(), do_run(), initV2Stats(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_2VRFM(), and runSYNC_ECM().