LLC2_API
|
00001 /***************************************************************************** 00002 * 00003 * File: llcontrol-core.h 00004 * 00005 * $RCSfile: llcontrol-core.h,v $ 00006 * 00007 * Copyright (C) 2001 D-TACQ Solutions Ltd 00008 * not to be used without owner's permission 00009 * 00010 * Description: 00011 * application implementing the LOW LATENCY CONTROL feature 00012 * 00013 * $Id: llcontrol-core.h,v 1.4 2009/09/29 13:09:14 pgm Exp $ 00014 * $Log: llcontrol-core.h,v $ 00015 * Revision 1.4 2009/09/29 13:09:14 pgm 00016 * RFM emulation (not complete) 00017 * 00018 * Revision 1.3 2009/04/02 13:19:01 pgm 00019 * docs away 00020 * 00021 * Revision 1.2 2009/03/28 18:47:39 pgm 00022 * sync2VAO32 take 1 00023 * 00024 * Revision 1.1 2009/03/26 14:52:03 pgm 00025 * split sync2v, acq216 from main core 00026 * 00027 * Revision 1.1.4.27 2009/03/26 12:40:36 pgm 00028 * reuse same dac_src for each card, avoid data overrun 00029 */ 00030 00031 /** @file llcontrol-core.h llcontrol-core shared definitions. */ 00032 00033 00034 #ifndef __LLCONTROL_CORE_H__ 00035 #define __LLCONTROL_CORE_H__ 00036 00037 00038 #define HOST_TIMING 1 00039 #define IGNORE_COUNTER_STOP 0 00040 00041 #define POLLALERT(ipoll, message) \ 00042 if ( (++ipoll&0xfffff) == 0 ) fprintf( stderr, message ) 00043 00044 #if HOST_TIMING > 1 00045 #define INIT_TIMER get_elapsed_microseconds(1) 00046 #define MARK_TIME(t, ident) do { \ 00047 tstats[icard].test_points[t] = get_elapsed_microseconds(0);\ 00048 fprintf(stderr, "MARK_TIME %s\n", ident); \ 00049 } while(0) 00050 #define FOREACHCARD_MARK_TIME(t, ident) FOREACHCARD{ MARK_TIME(t, ident); } 00051 #define TIMER_CHECK_OVERFLOW \ 00052 if (get_elapsed_microseconds(0) > 99000) INIT_TIMER 00053 #warning HOST_TIMING enabled 00054 #elif HOST_TIMING 00055 #define INIT_TIMER get_elapsed_microseconds(1) 00056 #define MARK_TIME(t, ident) do { \ 00057 tstats[icard].test_points[t] = get_elapsed_microseconds(0);\ 00058 } while(0) 00059 #define FOREACHCARD_MARK_TIME(t, ident) FOREACHCARD{ MARK_TIME(t, ident); } 00060 #define TIMER_CHECK_OVERFLOW \ 00061 if (get_elapsed_microseconds(0) > 99000) INIT_TIMER 00062 #warning HOST_TIMING enabled 00063 #else 00064 #define INIT_TIMER 00065 #define MARK_TIME(t, ident) 00066 #define FOREACHCARD_MARK_TIME(t, ident) 00067 #define TIMER_CHECK_OVERFLOW 00068 #endif 00069 00070 00071 void appEnterLLC_SYNC_2VAO32( 00072 int icard, struct MU *mu, struct TestDescription *td); 00073 00074 void initV2(struct TestDescription *td); 00075 00076 extern void (*updateTstats)( 00077 u32 cmd, struct Card* card, struct TimingStats* tstats); 00078 /** @fn updateTstats() virtual function to update timing stats. 00079 * defaults to V1 mbox. 00080 */ 00081 00082 extern u32 (*waitDmaDone)(struct Card *c); 00083 /** @fn waitDmaDone() virtual function to block until DMA done. 00084 * defaults to V1 mbox 00085 */ 00086 00087 u32 commandModifiers(struct TestDescription *td); 00088 00089 00090 static inline void updateTargetAddr( 00091 u32 cmd, struct Card* card, unsigned offset) 00092 { 00093 u32 baddr = getBusAddr(card->buf, offset); 00094 llSetAddr(card->mbx, baddr, cmd ); 00095 PRINTF(2)("llSetAddr [%d] 0x%08x\n", card->slot, baddr); 00096 } 00097 00098 00099 static inline void* td_get_next_dac_data(struct TestDescription* td) 00100 { 00101 void* dac_data = td->dac_data + td->dac_cursor; 00102 00103 int new_cursor = td->dac_cursor + DAC_SAMPLE_SIZE; 00104 00105 if (new_cursor+DAC_SAMPLE_SIZE > td->dac_data_samples*DAC_SAMPLE_SIZE){ 00106 td->dac_cursor = 0; 00107 }else{ 00108 td->dac_cursor = new_cursor; 00109 } 00110 return dac_data; 00111 } 00112 00113 extern void doApplicationWork(struct TestDescription* td, u32 offset); 00114 00115 00116 00117 00118 extern void v2_updateTstats( 00119 u32 cmd, struct Card* card, struct TimingStats* tstats); 00120 /** updates timing stats from embedded host buffer data */ 00121 00122 00123 extern u32 card_v2_WaitDmaDone(struct Card* card); 00124 00125 void doPostShotAnalysis(struct TestDescription *td); 00126 00127 void updateTimingStats( 00128 struct TimingStats* buffer, int iter, struct TimingStats* tstats); 00129 #endif // __LLCONTROL_CORE_H__