Defines | Functions | Variables

llcontrol-core.h File Reference

llcontrol-core shared definitions. More...

Go to the source code of this file.

Defines

#define HOST_TIMING   1
#define IGNORE_COUNTER_STOP   0
#define POLLALERT(ipoll, message)   if ( (++ipoll&0xfffff) == 0 ) fprintf( stderr, message )
#define INIT_TIMER   get_elapsed_microseconds(1)
#define MARK_TIME(t, ident)
#define FOREACHCARD_MARK_TIME(t, ident)   FOREACHCARD{ MARK_TIME(t, ident); }
#define TIMER_CHECK_OVERFLOW   if (get_elapsed_microseconds(0) > 99000) INIT_TIMER

Functions

void appEnterLLC_SYNC_ECM (int icard, struct MU *mu, struct TestDescription *td)
 set up LLCV2_INIT buffer and enter mode.
int runSYNC_ECM (struct TestDescription *td, int soft_clock)
 runs the test SYNC_ECM mode.
void appEnterLLC_SYNC_2V (int icard, struct MU *mu, struct TestDescription *td)
 set up LLCV2_INIT buffer and enter mode.
int runSYNC_2V (struct TestDescription *td, int soft_clock)
 runs the test SYNC_2V mode.
void appEnterLLC_SYNC_2VAO32 (int icard, struct MU *mu, struct TestDescription *td)
 set up LLCV2_INIT buffer and enter mode.
void appEnterLLC_SYNC_2VRFM (void)
 set up LLCV2_INIT buffer and enter mode.
int runSYNC_2VAO32 (struct TestDescription *td, int soft_clock)
 runs the test SYNC_2V mode.
int runSYNC_2VRFM (struct TestDescription *td, int soft_clock)
 runs the test SYNC_2V mode.
int runSCM216 (struct TestDescription *td)
u32 commandModifiers (struct TestDescription *td)
static void updateTargetAddr (u32 cmd, struct Card *card, unsigned offset)
static void * td_get_next_dac_data (struct TestDescription *td)
void doApplicationWork (struct TestDescription *td, u32 offset)
void initV2Stats (struct TestDescription *td)
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

Variables

void(* updateTstats )(u32 cmd, struct Card *card, struct TimingStats *tstats)
 virtual function to retrieve timing stats.
u32(* waitDmaDone )(struct Card *c)
 virtual function to block until DMA done.
int user_abort

Detailed Description

llcontrol-core shared definitions.

Definition in file llcontrol-core.h.


Define Documentation

#define FOREACHCARD_MARK_TIME (   t,
  ident 
)    FOREACHCARD{ MARK_TIME(t, ident); }

Definition at line 59 of file llcontrol-core.h.

Referenced by do_run(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), and runSYNC_ECM().

#define HOST_TIMING   1

Definition at line 38 of file llcontrol-core.h.

#define IGNORE_COUNTER_STOP   0

Definition at line 39 of file llcontrol-core.h.

#define INIT_TIMER   get_elapsed_microseconds(1)

Definition at line 55 of file llcontrol-core.h.

#define MARK_TIME (   t,
  ident 
)
Value:
do { \
        tstats[icard].test_points[t] = get_elapsed_microseconds(0);\
        } while(0)

Definition at line 56 of file llcontrol-core.h.

Referenced by do_run(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), runSYNC_2VRFM(), and runSYNC_ECM().

#define POLLALERT (   ipoll,
  message 
)    if ( (++ipoll&0xfffff) == 0 ) fprintf( stderr, message )

Definition at line 41 of file llcontrol-core.h.

Referenced by do_run(), runSCM216(), runSYNC_2V(), runSYNC_2VAO32(), and runSYNC_ECM().

#define TIMER_CHECK_OVERFLOW   if (get_elapsed_microseconds(0) > 99000) INIT_TIMER

Definition at line 60 of file llcontrol-core.h.


Function Documentation

void appEnterLLC_SYNC_2V ( 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

Todo:
  • this overwrites settings from initV2Stats(), initV2Stats is therefore redundant.

set up for single 4K buffer

uses V2 synchronization

Definition at line 90 of file llcontrol-sync2v-core.c.

References TestDescription::arg, TestDescription::cards, TestDescription::channels, TestDescription::clkpos, commandModifiers(), TestDescription::ARG::divisor, EACHBUF, enterLLC_SYNC_ECM(), getBusAddr(), getVaddr(), TestDescription::internal_loopback, LLCV2_AI_HSBT, llcv2_hb_offset, PRINTF, short, Card::sync_2v_offset_status_hsbt, Card::tlatch, TestDescription::trpos, updateTstats, and waitDmaDone.

Referenced by runTest().

void appEnterLLC_SYNC_2VAO32 ( int  icard,
struct MU mu,
struct TestDescription td 
)
void appEnterLLC_SYNC_2VRFM ( void   ) 

set up LLCV2_INIT buffer and enter mode.

Buffer set up as 4K block at offset 0

Todo:
  • this overwrites settings from initV2Stats(), initV2Stats is therefore redundant.

Definition at line 90 of file llcontrol-sync2VRFM-core.c.

Referenced by runTest().

void appEnterLLC_SYNC_ECM ( 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

Todo:
  • this overwrites settings from initV2Stats(), initV2Stats is therefore redundant.

set up for single 4K buffer

uses V2 synchronization

Definition at line 56 of file llcontrol-syncECM-core.c.

References TestDescription::arg, TestDescription::clkpos, commandModifiers(), TestDescription::ARG::divisor, EACHBUF, enterLLC_SYNC_ECM(), getBusAddr(), getVaddr(), TestDescription::internal_loopback, llcv2_hb_offset, TestDescription::trpos, updateTstats, and waitDmaDone.

Referenced by runTest().

u32 card_v2_WaitDmaDone ( struct Card card  ) 

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  ) 
void doApplicationWork ( struct TestDescription td,
u32  offset 
)
void initV2Stats ( struct TestDescription td  ) 
Todo:
could be set by a signal

Definition at line 874 of file llcontrol-core.c.

int runSCM216 ( struct TestDescription td  ) 

runs the test SCM mode, ACQ216 only. PSEUDO-CODE:

  • (1) Clear the latch timer
  • (2) Set a local memory target address and arm the capture
  • (3) Poll for counter running (hardware counter starts on external gate)
  • (4) Iterate for required number of samples:
  • (5) [optionally send a soft clock command] trigger an acquisition
  • (6) Wait for DMA Done - at this point data is available in target mem. A "real" control application is probably getting most of its calcs done here rather than simply polling
  • (7) [Get the latch (sample) and current uSec counters from the boards - only if interested]
  • (8) Check the process has not stopped (external gate high)
  • (9) [optionally update the target address - else it gets overwritten]

Definition at line 100 of file llcontrol-acq216-core.c.

References BP_MB_A4, TestDescription::decimation, TestDescription::do_work, doApplicationWork216(), EACHBBB, EACHBUF, EACHCARD, EACHMBX, FIRSTMBX, FOREACHCARD, FOREACHCARD_MARK_TIME, G_quit, getBusAddr(), getMboxPollcount(), getVaddr(), TestDescription::hardware_gate_off, TimingStats::hb_poll, TestDescription::hb_polling, hbPoll(), hbPrimePoll(), icard, TestDescription::iter, TestDescription::iterations, TestDescription::llc200_init_count, LLC_CSR_M_ARM, LLC_CSR_M_SOFTCLOCK, LLC_MAKE_DECIM, llCounterRunning(), llSetCmd(), llSetTlatch(), MARK_TIME, TestDescription::min_latency_test, TestDescription::overwrite, POLLALERT, POLLOFF, PRAMS_OFFSET, TestDescription::sample_offset, setAcq216Parameters(), setMbox(), TestDescription::stats_buf, TimingStats::target_poll, td_sample_size(), THIS_CARD, TimingStats::tlatch, TestDescription::tlog, updateTargetAddr(), updateTimingStats(), updateTstats, user_abort, and waitDmaDone.

Referenced by runTest().

int runSYNC_2V ( struct TestDescription td,
int  soft_clock 
)

runs the test SYNC_2V mode.

PSEUDO-CODE:

  • (1) Clear the latch timer
  • (2) Set a local memory target address and arm the capture
  • (3) Poll for counter running (hardware counter starts on external gate)
  • (4) Iterate for required number of samples:
  • (5) [optionally send a soft clock command] trigger an acquisition
  • (6) Wait for DMA Done - at this point data is available in target mem. A "real" control application is probably getting most of its calcs done here rather than simply polling
  • (7) [Get the latch (sample) and current uSec counters from the boards - only if interested]
  • (8) Check the process has not stopped (external gate high)
  • (b) write data to host side buffer(LLCV2_AO_HSBS)
  • (b.1) take the incoming value on feedback_channel and propagate to all DACS. default is to assume HAWG on DAC0 (so feedback_channel better be 0 !), but td->update_dacs makes a better test.
  • (b.15) special case where we are DRIVING the initial DAC signal from host side.
  • (b.2) simple feedforward case - just drive all DACS from AWG pattern.

(b.2)

Definition at line 127 of file llcontrol-sync2v-core.c.

References DAC_COUNT, TestDescription::decimation, TestDescription::do_work, doApplicationWork(), EACHBBB, EACHBUF, EACHCARD, EACHDAC_BASE, EACHDAC_BASE16, EACHMBX, TestDescription::feedback, TestDescription::feedback_channel, FIRSTBUF, FIRSTMBX, FOREACHCARD, FOREACHCARD_MARK_TIME, G_quit, getBusAddr(), getMboxPollcount(), getVaddr(), TestDescription::hardware_gate_off, icard, TestDescription::iter, TestDescription::iterations, LLC_CSR_M_ARM, LLC_CSR_M_SOFTCLOCK, LLC_MAKE_DECIM, llCounterRunning(), LLCV2_AO_HSBS, llSetCmd(), llSetTlatch(), llv2InitDmaDone(), MARK_TIME, memset32(), TestDescription::min_latency_test, OFFSET, POLLALERT, PRINTF, TestDescription::stats_buf, TimingStats::target_poll, td_get_next_dac_data(), TimingStats::tlatch, TestDescription::tlog, TestDescription::update_dacs, updateTargetAddr(), updateTimingStats(), updateTstats, V2SETDACS, and waitDmaDone.

Referenced by runTest().

int runSYNC_2VAO32 ( struct TestDescription td,
int  soft_clock 
)

runs the test SYNC_2V mode.

PSEUDO-CODE:

  • (1) Clear the latch timer
  • (2) Set a local memory target address and arm the capture
  • (3) Poll for counter running (hardware counter starts on external gate)
  • (4) Iterate for required number of samples:
  • (5) [optionally send a soft clock command] trigger an acquisition
  • (6) Wait for DMA Done - at this point data is available in target mem. A "real" control application is probably getting most of its calcs done here rather than simply polling
  • (7) [Get the latch (sample) and current uSec counters from the boards - only if interested]
  • (8) Check the process has not stopped (external gate high)
  • (b) write data to host side buffer(LLCV2_AO_HSBS)
  • (b.1) take the incoming value on feedback_channel and propagate to all DACS. default is to assume HAWG on DAC0 (so feedback_channel better be 0 !), but td->update_dacs makes a better test. NB: Feedback is on RTMAO, not AO32CPCI
  • (b.15) special case where we are DRIVING the initial DAC signal from host side.
  • (b.2) simple feedforward case - just drive all DACS from AWG pattern.

(b.2)

AO32 update: apply to MASTER only

Definition at line 213 of file llcontrol-sync2VAO32-core.c.

References TestDescription::ao32_count, BASE_AO32, DAC_COUNT, TestDescription::decimation, TestDescription::do_work, doApplicationWork(), EACHBBB, EACHBUF, EACHCARD, EACHDAC_BASE, EACHDAC_BASE16, EACHMBX, TestDescription::feedback, TestDescription::feedback_channel, FIRSTBUF, FIRSTMBX, FOREACHCARD, FOREACHCARD_MARK_TIME, G_quit, getBusAddr(), getMboxPollcount(), getVaddr(), TestDescription::hardware_gate_off, icard, TestDescription::iter, TestDescription::iterations, LLC_CSR_M_ARM, LLC_CSR_M_SOFTCLOCK, LLC_MAKE_DECIM, llCounterRunning(), LLCV2_AO_HSBS, llSetCmd(), llSetTlatch(), llv2InitDmaDone(), MARK_TIME, memset32(), TestDescription::min_latency_test, OFFSET, POLLALERT, PRINTF, setSlaveData(), TestDescription::stats_buf, TimingStats::target_poll, td_get_next_dac_data(), THIS_CARD, TimingStats::tlatch, TestDescription::tlog, TestDescription::update_dacs, updateTargetAddr(), updateTimingStats(), updateTstats, V2SETDACS, and waitDmaDone.

Referenced by runTest().

int runSYNC_2VRFM ( struct TestDescription td,
int  soft_clock 
)

runs the test SYNC_2V mode.

PSEUDO-CODE:

  • (1) Clear the latch timer
  • (2) Set a local memory target address and arm the capture
  • (3) Poll for counter running (hardware counter starts on external gate)
  • (4) Iterate for required number of samples:
  • (5) [optionally send a soft clock command] trigger an acquisition
  • (6) Wait for DMA Done - at this point data is available in target mem. A "real" control application is probably getting most of its calcs done here rather than simply polling
  • (7) [Get the latch (sample) and current uSec counters from the boards - only if interested]
  • (8) Check the process has not stopped (external gate high)
  • (b) write data to host side buffer(LLCV2_AO_HSBS)
  • (b.1) take the incoming value on feedback_channel and propagate to all DACS. default is to assume HAWG on DAC0 (so feedback_channel better be 0 !), but td->update_dacs makes a better test.
  • (b.15) special case where we are DRIVING the initial DAC signal from host side.
  • (b.2) simple feedforward case - just drive all DACS from AWG pattern.

Definition at line 99 of file llcontrol-sync2VRFM-core.c.

References TestDescription::decimation, TestDescription::do_work, doApplicationWork(), EACHCARD, EACHMBX, G_quit, getMboxPollcount(), icard, TestDescription::iter, TestDescription::iterations, LLC_MAKE_DECIM, MARK_TIME, TestDescription::min_latency_test, TestDescription::stats_buf, TimingStats::target_poll, TimingStats::tlatch, TestDescription::tlog, updateTimingStats(), updateTstats, and waitDmaDone.

Referenced by runTest().

int runSYNC_ECM ( struct TestDescription td,
int  soft_clock 
)

runs the test SYNC_ECM mode.

PSEUDO-CODE:

  • (1) Clear the latch timer
  • (2) Set a local memory target address and arm the capture
  • (3) Poll for counter running (hardware counter starts on external gate)
  • (4) Iterate for required number of samples:
  • (5) [optionally send a soft clock command] trigger an acquisition
  • (6) Wait for DMA Done - at this point data is available in target mem. A "real" control application is probably getting most of its calcs done here rather than simply polling
  • (7) [Get the latch (sample) and current uSec counters from the boards - only if interested]
  • (8) Check the process has not stopped (external gate high)
  • (b) write data to host side buffer(LLCV2_AO_HSBS)
  • (b.1) take the incoming value on feedback_channel and propagate to all DACS. default is to assume HAWG on DAC0 (so feedback_channel better be 0 !), but td->update_dacs makes a better test.
  • (b.15) special case where we are DRIVING the initial DAC signal from host side.
  • (b.2) simple feedforward case - just drive all DACS from AWG pattern.

(b.2)

Definition at line 87 of file llcontrol-syncECM-core.c.

References DAC_COUNT, TestDescription::decimation, TestDescription::do_work, doApplicationWork(), EACHBBB, EACHBUF, EACHCARD, EACHDAC_BASE, EACHDAC_BASE16, EACHMBX, TestDescription::feedback, TestDescription::feedback_channel, FIRSTBUF, FIRSTMBX, FOREACHCARD, FOREACHCARD_MARK_TIME, G_quit, getBusAddr(), getMboxPollcount(), getVaddr(), TestDescription::hardware_gate_off, icard, TestDescription::iter, TestDescription::iterations, LLC_CSR_M_ARM, LLC_CSR_M_SOFTCLOCK, LLC_MAKE_DECIM, llCounterRunning(), LLCV2_AO_HSBS, LLCV2_OFFSET_STATUS_HSBT, llSetCmd(), llSetTlatch(), llv2InitDmaDone(), MARK_TIME, memset32(), TestDescription::min_latency_test, OFFSET, POLLALERT, PRINTF, TestDescription::stats_buf, TimingStats::target_poll, td_get_next_dac_data(), TimingStats::tlatch, TestDescription::tlog, TestDescription::update_dacs, updateTargetAddr(), updateTimingStats(), updateTstats, V2SETDACS, and waitDmaDone.

Referenced by runTest().

static void* td_get_next_dac_data ( struct TestDescription td  )  [inline, static]
static void updateTargetAddr ( u32  cmd,
struct Card card,
unsigned  offset 
) [inline, static]
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.


Variable Documentation

void(* updateTstats)(u32 cmd, struct Card *card, struct TimingStats *tstats)

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

Definition at line 311 of file llcontrol-core.c.

Referenced by do_run(), and runSCM216().

u32(* waitDmaDone)(struct Card *c)

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