// // Author: Sfiligoi Igor // // Created : 27.01.1997 // Last modified: 23.04.1997 Program "rock" Comment "ROCK library tcl interface" // ROCK_id Intype ROCKT_ITrid = pointer Comment "ROCK id" Comment "Must be the same as ROCKT_OTrid" Outtype ROCKT_OTrid = pointer Comment "ROCK id" Comment "Must be the same as ROCKT_ITrid" OutType ROCKT_OTdummy = int Comment "Dummy result" Select Command "ispresent" Comment "Querry if ROCK is present" data rockt_t_ispresent param chain:natural param crate:natural call rockt_tl_ispresent:nbool Command "open" data rockt_t_open param chain:natural param crate:natural call rockt_tl_open:ROCKT_OTrid Command "close" data rockt_t_close param rid:ROCKT_ITrid call rockt_tl_close:ROCKT_OTdummy //dummy result Command "raw" Comment "Raw ROCK access" Select Command "open" Comment "Open the ROCK using fisical address" data rockt_t_raw_open param vme_addr:natural option "offset" offs:integer Comment "defaults to 0" option "vmesize" vme_size:integer Comment "defaults to offs+0x40" option "vmeam" vme_am:integer Comment "defaults to 0x09" call rockt_tl_raw_open:ROCKT_OTrid Command "read" Comment "Read a register" Const ROCKT_Cread_reset ROCKT_Cread_fifo ROCKT_Cread_watchdog ROCKT_Cread_csr0 ROCKT_Cread_csr1 ROCKT_Cread_csr2 ROCKT_Cread_elapsed ROCKT_Cread_trigger ROCKT_Cread_tque ROCKT_Cread_tnow ROCKT_Cread_rockinfo ROCKT_Cread_golden ROCKT_Cread_efifo ROCKT_Cread_dfifo Intype ROCKT_ITreadreg = iset("reset":ROCKT_Cread_reset, "FIFO":ROCKT_Cread_fifo, "watchdog":ROCKT_Cread_watchdog, "CSR0":ROCKT_Cread_csr0, "CSR1":ROCKT_Cread_csr1, "CSR2":ROCKT_Cread_csr2, "elapsed":ROCKT_Cread_elapsed, "trigger":ROCKT_Cread_trigger, "tque":ROCKT_Cread_tque, "tnow":ROCKT_Cread_tnow, "rockinfo":ROCKT_Cread_rockinfo, "golden":ROCKT_Cread_golden, "EFIFO":ROCKT_Cread_efifo, "DFIFO":ROCKT_Cread_dfifo) data rockt_t_read param reg:ROCKT_ITreadreg param rid:ROCKT_ITrid call rockt_tl_read:natural Command "write" Comment "Write into a register" Const ROCKT_Cwrite_reset ROCKT_Cwrite_watchdog ROCKT_Cwrite_csr0 ROCKT_Cwrite_csr2 ROCKT_Cwrite_trigger ROCKT_Cwrite_golden ROCKT_Cwrite_edfifo Intype ROCKT_ITwritereg = iset("reset":ROCKT_Cwrite_reset, "watchdog":ROCKT_Cwrite_watchdog, "CSR0":ROCKT_Cwrite_csr0, "CSR2":ROCKT_Cwrite_csr2, "trigger":ROCKT_Cwrite_trigger, "golden":ROCKT_Cwrite_golden, "EDFIFO":ROCKT_Cwrite_edfifo) data rockt_t_write param reg:ROCKT_ITwritereg param rid:ROCKT_ITrid param value:natural option "and" and:natural Comment "Apply an and befor writing (before the or)" option "or" or:natural Comment "Apply an or befor writing (after the and)" call rockt_tl_write:ROCKT_OTdummy // dummy result Command "readpage" Comment "Read an entire page" Select Command "internal" Comment "Read the internal page" OutType ROCKT_OTreadpage_internal = record reset:natural fifo:natural watchdog:natural csr0:natural csr1:natural csr2:natural elapsed:natural trigger:natural end data rockt_t_readpage_internal param rid:ROCKT_ITrid call rockt_tl_readpage_internal:ROCKT_OTreadpage_internal Command "info" Comment "Read the info page" OutType ROCKT_OTreadpage_info = record tque:natural tnow:natural rockinfo:natural golden:natural end data rockt_t_readpage_info param rid:ROCKT_ITrid call rockt_tl_readpage_info:ROCKT_OTreadpage_info end //end rock raw readpage end // end rock raw Command "get" Comment "Get a bit" Const ROCKT_Cget_cintf ROCKT_Cget_xintf ROCKT_Cget_tfifo ROCKT_Cget_efifo ROCKT_Cget_dfifo ROCKT_Cget_auxrst ROCKT_Cget_intrst ROCKT_Cget_fltrst ROCKT_Cget_dff ROCKT_Cget_dhf ROCKT_Cget_def ROCKT_Cget_eff ROCKT_Cget_ehf ROCKT_Cget_eef ROCKT_Cget_tef ROCKT_Cget_tff ROCKT_Cget_watchdog ROCKT_Cget_efmode ROCKT_Cget_boe ROCKT_Cget_tkndis ROCKT_Cget_inttrg ROCKT_Cget_diag ROCKT_Cget_tknin ROCKT_Cget_tknout ROCKT_Cget_ceob ROCKT_Cget_cerr ROCKT_Cget_crst ROCKT_Cget_crngt ROCKT_Cget_cbusy ROCKT_Cget_ctrgv ROCKT_Cget_efwren ROCKT_Cget_auxon ROCKT_Cget_timeout ROCKT_Cget_elapsed ROCKT_Cget_wscale ROCKT_Cget_elapsedtime ROCKT_Cget_halt ROCKT_Cget_busy ROCKT_Cget_synchf ROCKT_Cget_xbusy ROCKT_Cget_xberr ROCKT_Cget_qtrg ROCKT_Cget_cstate ROCKT_Cget_ptrg ROCKT_Cget_sof ROCKT_Cget_eof ROCKT_Cget_syncrespf ROCKT_Cget_rocksfail ROCKT_Cget_slvsfail ROCKT_Cget_lwadd ROCKT_Cget_xadd ROCKT_Cget_last ROCKT_Cget_cradd ROCKT_Cget_goldenref Intype ROCKT_ITgetreg = iset( "cintf":ROCKT_Cget_cintf, "xintf":ROCKT_Cget_xintf, "tfifo":ROCKT_Cget_tfifo, "efifo":ROCKT_Cget_efifo, "dfifo":ROCKT_Cget_dfifo, "auxrst":ROCKT_Cget_auxrst, "intrst":ROCKT_Cget_intrst, "fltrst":ROCKT_Cget_fltrst, "dff":ROCKT_Cget_dff, "dhf":ROCKT_Cget_dhf, "def":ROCKT_Cget_def, "eff":ROCKT_Cget_eff, "ehf":ROCKT_Cget_ehf, "eef":ROCKT_Cget_eef, "tef":ROCKT_Cget_tef, "tff":ROCKT_Cget_tff, "watchdog":ROCKT_Cget_watchdog, "efmode":ROCKT_Cget_efmode, "boe":ROCKT_Cget_boe, "tkndis":ROCKT_Cget_tkndis, "inttrg":ROCKT_Cget_inttrg, "diag":ROCKT_Cget_diag, "tknin":ROCKT_Cget_tknin, "tknout":ROCKT_Cget_tknout, "coeb":ROCKT_Cget_ceob, "cerr":ROCKT_Cget_cerr, "crst":ROCKT_Cget_crst, "crngt":ROCKT_Cget_crngt, "cbusy":ROCKT_Cget_cbusy, "ctrgv":ROCKT_Cget_ctrgv, "efwren":ROCKT_Cget_efwren, "auxon":ROCKT_Cget_auxon, "timeout":ROCKT_Cget_timeout, "elapsed":ROCKT_Cget_elapsed, "wscale":ROCKT_Cget_wscale, "elapsedtime":ROCKT_Cget_elapsedtime, "halt":ROCKT_Cget_halt, "busy":ROCKT_Cget_busy, "synchf":ROCKT_Cget_synchf, "xbusy":ROCKT_Cget_xbusy, "xberr":ROCKT_Cget_xberr, "qtrg":ROCKT_Cget_qtrg, "cstate":ROCKT_Cget_cstate, "ptrg":ROCKT_Cget_ptrg, "sof":ROCKT_Cget_sof, "eof":ROCKT_Cget_eof, "syncrespf":ROCKT_Cget_syncrespf, "rocksfail":ROCKT_Cget_rocksfail, "slvsfail":ROCKT_Cget_slvsfail, "lwadd":ROCKT_Cget_lwadd, "xadd":ROCKT_Cget_xadd, "last":ROCKT_Cget_last, "cradd":ROCKT_Cget_cradd, "goldenref":ROCKT_Cget_goldenref) data rockt_t_get param bit:ROCKT_ITgetreg param rid:ROCKT_ITrid call rockt_tl_get:natural Command "set" Comment "Set a bit" Const ROCKT_Cset_cintf ROCKT_Cset_xintf ROCKT_Cset_tfifo ROCKT_Cset_efifo ROCKT_Cset_dfifo ROCKT_Cset_auxrst ROCKT_Cset_intrst ROCKT_Cset_fltrst ROCKT_Cset_watchdog ROCKT_Cset_efmode ROCKT_Cset_boe ROCKT_Cset_tkndis ROCKT_Cset_inttrg ROCKT_Cset_diag ROCKT_Cset_elapsed ROCKT_Cset_wscale ROCKT_Cset_test ROCKT_Cset_last ROCKT_Cset_cradd ROCKT_Cset_goldenref Intype ROCKT_ITsetreg = iset( "cintf":ROCKT_Cset_cintf, "xintf":ROCKT_Cset_xintf, "tfifo":ROCKT_Cset_tfifo, "efifo":ROCKT_Cset_efifo, "dfifo":ROCKT_Cset_dfifo, "auxrst":ROCKT_Cset_auxrst, "intrst":ROCKT_Cset_intrst, "fltrst":ROCKT_Cset_fltrst, "watchdog":ROCKT_Cset_watchdog, "efmode":ROCKT_Cset_efmode, "boe":ROCKT_Cset_boe, "tkndis":ROCKT_Cset_tkndis, "inttrg":ROCKT_Cset_inttrg, "diag":ROCKT_Cset_diag, "elapsed":ROCKT_Cset_elapsed, "wscale":ROCKT_Cset_wscale, "test":ROCKT_Cset_test, "last":ROCKT_Cset_last, "cradd":ROCKT_Cset_cradd, "goldenref":ROCKT_Cset_goldenref) data rockt_t_set param bit:ROCKT_ITsetreg param rid:ROCKT_ITrid param value:natural call rockt_tl_set:ROCKT_OTdummy // dummy result Command "read" Comment "Read and decode a register" Select Command "reset" Comment "Decode the reset register" Outtype ROCKT_OTdecreset = record fltrst:natural intrst:natural auxrst:natural dfifo:natural efifo:natural xintf:natural tfifo:natural cintf:natural end data rockt_t_decode_reset param rid:ROCKT_ITrid call rockt_tl_decode_reset:ROCKT_OTdecreset Command "FIFO" Comment "Decode the FIFO register" Outtype ROCKT_OTdecfifo = record dff:natural dhf:natural def:natural eff:natural ehf:natural eef:natural tef:natural tff:natural end data rockt_t_decode_fifo param rid:ROCKT_ITrid call rockt_tl_decode_fifo:ROCKT_OTdecfifo Command "Watchdog" Comment "Decode the Watchdog register" Outtype ROCKT_OTdecwatchdog = natural data rockt_t_decode_watchdog param rid:ROCKT_ITrid call rockt_tl_decode_watchdog:ROCKT_OTdecwatchdog Command "CSR0" Comment "Decode the CSR0 register" Outtype ROCKT_OTdeccsr0 = record efmode:natural boe:natural tkndis:natural inttrg:natural diag:natural end data rockt_t_decode_csr0 param rid:ROCKT_ITrid call rockt_tl_decode_csr0:ROCKT_OTdeccsr0 Command "CSR1" Comment "Decode the CSR1 register" Outtype ROCKT_OTdeccsr1 = record tknin:natural tknout:natural ceob:natural cerr:natural crst:natural crngt:natural cbusy:natural ctrgv:natural end data rockt_t_decode_csr1 param rid:ROCKT_ITrid call rockt_tl_decode_csr1:ROCKT_OTdeccsr1 Command "CSR2" Comment "Decode the CSR2 register" Outtype ROCKT_OTdeccsr2 = record efwren:natural auxon:natural timeout:natural elapsed:natural wscale:natural end data rockt_t_decode_csr2 param rid:ROCKT_ITrid call rockt_tl_decode_csr2:ROCKT_OTdeccsr2 Command "Elapsed" Comment "Decode the Elapsed register" Outtype ROCKT_OTdecelapsed = natural data rockt_t_decode_elapsed param rid:ROCKT_ITrid call rockt_tl_decode_elapsed:ROCKT_OTdecelapsed Command "Trigger" Comment "Decode the Trigger register" Outtype ROCKT_OTdectrigger = record halt:natural busy:natural synchf:natural xbusy:natural xberr:natural end data rockt_t_decode_trigger param rid:ROCKT_ITrid call rockt_tl_decode_trigger:ROCKT_OTdectrigger Command "TQUE" Comment "Decode the TQUE register" Outtype ROCKT_OTdectque = record tff:natural link:natural qtrg:natural end data rockt_t_decode_tque param rid:ROCKT_ITrid call rockt_tl_decode_tque:ROCKT_OTdectque Command "TNOW" Comment "Decode the TNOW register" Outtype ROCKT_OTdectnow = record cstate:natural ptrg:natural end data rockt_t_decode_tnow param rid:ROCKT_ITrid call rockt_tl_decode_tnow:ROCKT_OTdectnow Command "Rockinfo" Comment "Decode the Rockinfo register" Outtype ROCKT_OTdecrockinfo = record sof:natural eof:natural syncrespf:natural rocksfail:natural slvsfail:natural lwadd:natural xadd:natural end data rockt_t_decode_rockinfo param rid:ROCKT_ITrid call rockt_tl_decode_rockinfo:ROCKT_OTdecrockinfo Command "Golden" Comment "Decode the Golden register" Outtype ROCKT_OTdecgolden = record last:natural cradd:natural goldenref:natural end data rockt_t_decode_golden param rid:ROCKT_ITrid call rockt_tl_decode_golden:ROCKT_OTdecgolden Command "EFIFO" Comment "Decode EFIFO" Outtype ROCKT_OTdecefifo = record nvd:natural ff:natural hf:natural ef:natural fifodata:natural end data rockt_t_decode_efifo param rid:ROCKT_ITrid call rockt_tl_decode_efifo:ROCKT_OTdecefifo Command "DFIFO" Comment "Decode DFIFO" Outtype ROCKT_OTdecdfifo = record nvd:natural ff:natural hf:natural ef:natural fifodata:natural end data rockt_t_decode_dfifo param rid:ROCKT_ITrid call rockt_tl_decode_dfifo:ROCKT_OTdecdfifo end // end rock read read Command "write" Comment "encode and write into a register" Select Command "reset" Comment "Encode the reset register" Intype ROCKT_ITencreset = record fltrst:irange(0,1) intrst:irange(0,1) auxrst:irange(0,1) dfifo:irange(0,1) efifo:irange(0,1) xintf:irange(0,1) tfifo:irange(0,1) cintf:irange(0,1) end data rockt_t_encode_reset param rid:ROCKT_ITrid param value:ROCKT_ITencreset call rockt_tl_encode_reset:ROCKT_OTdummy // dummy result Command "Watchdog" Comment "Encode the Watchdog register" Intype ROCKT_ITencwatchdog = natural data rockt_t_encode_watchdog param rid:ROCKT_ITrid param value:ROCKT_ITencwatchdog call rockt_tl_encode_watchdog:ROCKT_OTdummy // dummy result Command "CSR0" Comment "Encode the CSR0 register" Intype ROCKT_ITenccsr0 = record efmode:irange(0..3) boe:irange(0,1) tkndis:irange(0,1) inttrg:irange(0,1) diag:irange(0,1) end data rockt_t_encode_csr0 param rid:ROCKT_ITrid param value:ROCKT_ITenccsr0 call rockt_tl_encode_csr0:ROCKT_OTdummy // dummy result Command "CSR2" Comment "Encode the CSR2 register" Intype ROCKT_ITenccsr2 = record elapsed:irange(0,1) wscale:irange(0..7) end data rockt_t_encode_csr2 param rid:ROCKT_ITrid param value:ROCKT_ITenccsr2 call rockt_tl_encode_csr2:ROCKT_OTdummy // dummy result Command "Trigger" Comment "Encode the Trigger register" Intype ROCKT_ITenctrigger = natural // test data rockt_t_encode_trigger param rid:ROCKT_ITrid param value:ROCKT_ITenctrigger call rockt_tl_encode_trigger:ROCKT_OTdummy // dummy result Command "Golden" Comment "Encode the Golden register" Intype ROCKT_ITencgolden = record last:irange(0,1) cradd:irange(0..7) goldenref:irange(0..0xfff) end data rockt_t_encode_golden param rid:ROCKT_ITrid param value:ROCKT_ITencgolden call rockt_tl_encode_golden:ROCKT_OTdummy // dummy result end // end rock write Command "readpage" Comment "Read and decode an entire page" Select Command "internal" Comment "Read the internal page" OutType ROCKT_OTdecodepage_internal = record fltrst:natural intrst:natural auxrst:natural dfifo:natural efifo:natural xintf:natural tfifo:natural cintf:natural dff:natural dhf:natural def:natural eff:natural ehf:natural eef:natural tef:natural tff:natural watchdog:natural efmode:natural boe:natural tkndis:natural inttrg:natural diag:natural tknin:natural tknout:natural ceob:natural cerr:natural crst:natural crngt:natural cbusy:natural ctrgv:natural efwren:natural auxon:natural timeout:natural elapsed:natural wscale:natural elapsedtime:natural halt:natural busy:natural synchf:natural xbusy:natural xberr:natural end data rockt_t_decodepage_internal param rid:ROCKT_ITrid call rockt_tl_decodepage_internal:ROCKT_OTdecodepage_internal Command "info" Comment "Read the info page" OutType ROCKT_OTdecodepage_info = record tff:natural link:natural qtrg:natural cstate:natural ptrg:natural sof:natural eof:natural syncrespf:natural rocksfail:natural slvsfail:natural lwadd:natural xadd:natural last:natural cradd:natural goldenref:natural end data rockt_t_decodepage_info param rid:ROCKT_ITrid call rockt_tl_decodepage_info:ROCKT_OTdecodepage_info end // end rock readpage Command "readfifo" Comment "Read a FIFO in DMA" Outtype ROCKT_OTreadfifo_list = list of natural Select Command "EFIFO" Comment "Read the EFIFO in DMA" data rockt_t_readefifo param rid:ROCKT_ITrid optparam size:natural Comment "Defaults to 16K" call rockt_tl_readefifo:ROCKT_OTreadfifo_list Command "DFIFO" Comment "Read the DFIFO in DMA" data rockt_t_readdfifo param rid:ROCKT_ITrid optparam size:natural Comment "Defaults to 16K" call rockt_tl_readdfifo:ROCKT_OTreadfifo_list end // end rock readfifo end // end rock