/************************************************/ /* */ /* File : userrockm.c */ /* Description : tl user part */ /* */ /* Command : rockm */ /* Comment : ROCKM library tcl interface */ /* */ /* Author: Sfiligoi Igor */ /* */ /* Created : 27.05.1997 */ /* Last modified : 20.10.1997 */ /* */ /************************************************/ #include <string.h> #include <stdlib.h> #include <Error.h> #include "RockM.h" #include "userrockm.h" /* rockm ispresent data function*/ /* return TL_OK iff no error */ int rockmt_tl_ispresent(rockmt_t_ispresent *data) { data->result = rockm_ispresent(data->chain); return TL_OK; } /* rockm open data function*/ /* return TL_OK iff no error */ int rockmt_tl_open(rockmt_t_open *data) { ROCKM_id this_board; char error; error = rockm_open(data->chain, &this_board); if(error!=ROCKM_ERROR_OK) { char *tmp; data->errorstr = (char *) malloc(64); strcpy(data->errorstr,"Error during ROCKM open."); return TL_OK+error; } else { data->result = (void *) this_board; return TL_OK; } } /* rockm close data function*/ /* return TL_OK iff no error */ int rockmt_tl_close(rockmt_t_close *data) { ROCKM_id this_board = (ROCKM_id ) data->rid; rockm_close(this_board); return TL_OK; } /* rockm raw read data function*/ /* return TL_OK iff no error */ int rockmt_tl_raw_read(rockmt_t_raw_read *data) { ROCKM_id this_board = (ROCKM_id ) data->rid; switch (data->reg.nr) { case ROCKMT_Cread_reset: data->result=RockM_read_reset(this_board); break; case ROCKMT_Cread_fifo: data->result=RockM_read_fiforeg(this_board); break; case ROCKMT_Cread_watchdog: data->result=RockM_read_watchdog(this_board); break; case ROCKMT_Cread_csr0: data->result=RockM_read_csr0(this_board); break; case ROCKMT_Cread_csr1: data->result=RockM_read_csr1(this_board); break; case ROCKMT_Cread_csr2: data->result=RockM_read_csr2(this_board); break; case ROCKMT_Cread_elapsed: data->result=RockM_read_elapsed_time(this_board); break; case ROCKMT_Cread_trigger: data->result=RockM_read_trig_err(this_board); break; case ROCKMT_Cread_tque: data->result=RockM_read_tque(this_board); break; case ROCKMT_Cread_tnow: data->result=RockM_read_tnow(this_board); break; case ROCKMT_Cread_chainadd: data->result=RockM_read_chainadd(this_board); break; case ROCKMT_Cread_golden: data->result=RockM_read_golden(this_board); break; case ROCKMT_Cread_wordcnt: data->result=RockM_read_wordcnt(this_board); break; case ROCKMT_Cread_info: data->result=RockM_read_info(this_board); break; case ROCKMT_Cread_infohub: data->result=RockM_read_infohub(this_board); break; case ROCKMT_Cread_infomicro: data->result=RockM_read_infomicro(this_board); break; case ROCKMT_Cread_microstat: data->result=RockM_read_microstat(this_board); break; case ROCKMT_Cread_microword: data->result=RockM_read_microword(this_board); break; case ROCKMT_Cread_DFIFO: data->result=RockM_read_fifo(this_board); break; deafult: { char *tmp; data->errorstr = (char *) malloc(64); sprintf(data->errorstr,"Invalid register: %i",data->reg.nr); return TL_OK+1; } break; } return TL_OK; } /* rockm raw write data function*/ /* return TL_OK iff no error */ int rockmt_tl_raw_write(rockmt_t_raw_write *data) { ROCKM_id this_board = (ROCKM_id ) data->rid; unsigned int val = data->value; if (data->and_present) val &= data->and; if (data->or_present) val |= data->or; switch (data->reg.nr) { case ROCKMT_Cwrite_reset: RockM_write_reset(this_board,val); break; case ROCKMT_Cwrite_watchdog: RockM_write_watchdog(this_board,val); break; case ROCKMT_Cwrite_csr0: RockM_write_csr0(this_board,val); break; case ROCKMT_Cwrite_csr2: RockM_write_csr2(this_board,val); break; case ROCKMT_Cwrite_trigger: RockM_write_trig_err(this_board,val); break; case ROCKMT_Cwrite_chainadd: RockM_write_chainadd(this_board,val); break; case ROCKMT_Cwrite_golden: RockM_write_golden(this_board,val); break; case ROCKMT_Cwrite_microword: RockM_write_microword(this_board,val); break; case ROCKMT_Cwrite_DFIFO: RockM_write_fifo(this_board,val); break; deafult: { char *tmp; data->errorstr = (char *) malloc(64); sprintf(data->errorstr,"Invalid register: %i",data->reg.nr); return TL_OK+1; } break; } return TL_OK; } /* rockm raw readpage internal data function*/ /* return TL_OK iff no error */ int rockmt_tl_raw_readpage_internal(rockmt_t_raw_readpage_internal *data) { ROCKM_id this_board = (ROCKM_id ) data->rid; data->result.reset=RockM_read_reset(this_board); data->result.fifo=RockM_read_fiforeg(this_board); data->result.watchdog=RockM_read_watchdog(this_board); data->result.csr0=RockM_read_csr0(this_board); data->result.csr1=RockM_read_csr1(this_board); data->result.csr2=RockM_read_csr2(this_board); data->result.elapsed=RockM_read_elapsed_time(this_board); data->result.trigger=RockM_read_trig_err(this_board); return TL_OK; } /* rockm raw readpage intfo data function*/ /* return TL_OK iff no error */ int rockmt_tl_raw_readpage_info(rockmt_t_raw_readpage_info *data) { ROCKM_id this_board = (ROCKM_id ) data->rid; data->result.tque=RockM_read_tque(this_board); data->result.tnow=RockM_read_tnow(this_board); data->result.chainadd=RockM_read_chainadd(this_board); data->result.golden=RockM_read_golden(this_board); data->result.wordcnt=RockM_read_wordcnt(this_board); data->result.info=RockM_read_info(this_board); data->result.microstat=RockM_read_microstat(this_board); data->result.microword=RockM_read_microword(this_board); return TL_OK; } /* rockm get data function*/ /* return TL_OK iff no error */ int rockmt_tl_get(rockmt_t_get *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; switch (data->fld.nr) { case ROCKMT_Cget_filter: data->result=RockM_get_filter(this_board); break; case ROCKMT_Cget_intrst: data->result=RockM_get_intrst(this_board); break; case ROCKMT_Cget_reprog: data->result=RockM_get_reprog(this_board); break; case ROCKMT_Cget_cbus: data->result=RockM_get_cbus(this_board); break; case ROCKMT_Cget_fifo_rst: data->result=RockM_get_fifo_rst(this_board); break; case ROCKMT_Cget_micro: data->result=RockM_get_micro(this_board); break; case ROCKMT_Cget_hub_rst: data->result=RockM_get_hub_rst(this_board); break; case ROCKMT_Cget_cman: data->result=RockM_get_cman(this_board); break; case ROCKMT_Cget_df: data->result=RockM_get_d_f(this_board); break; case ROCKMT_Cget_daf: data->result=RockM_get_d_af(this_board); break; case ROCKMT_Cget_dghf: data->result=RockM_get_d_ghf(this_board); break; case ROCKMT_Cget_dlhf: data->result=RockM_get_d_lhf(this_board); break; case ROCKMT_Cget_dae: data->result=RockM_get_d_ae(this_board); break; case ROCKMT_Cget_de: data->result=RockM_get_d_e(this_board); break; case ROCKMT_Cget_tef: data->result=RockM_get_t_ef(this_board); break; case ROCKMT_Cget_tff: data->result=RockM_get_t_ff(this_board); break; case ROCKMT_Cget_watchdog: data->result=RockM_read_watchdog(this_board); break; case ROCKMT_Cget_foe: data->result=RockM_get_foe(this_board); break; case ROCKMT_Cget_boe: data->result=RockM_get_boe(this_board); break; case ROCKMT_Cget_bof: data->result=RockM_get_bof(this_board); break; case ROCKMT_Cget_cbusy_ff: data->result=RockM_get_cbusy_ff(this_board); break; case ROCKMT_Cget_cpause: data->result=RockM_get_cpause(this_board); break; case ROCKMT_Cget_hub_mode: data->result=RockM_get_hub_mode(this_board); break; case ROCKMT_Cget_inttrg: data->result=RockM_get_inttrg(this_board); break; case ROCKMT_Cget_diag: data->result=RockM_get_diag(this_board); break; case ROCKMT_Cget_ctknout: data->result=RockM_get_ctknout(this_board); break; case ROCKMT_Cget_crdy: data->result=RockM_get_crdy(this_board); break; case ROCKMT_Cget_cerr: data->result=RockM_get_cerr(this_board); break; case ROCKMT_Cget_crst: data->result=RockM_get_crst(this_board); break; case ROCKMT_Cget_crngt: data->result=RockM_get_crngt(this_board); break; case ROCKMT_Cget_cbusy: data->result=RockM_get_cbusy(this_board); break; case ROCKMT_Cget_ctrgv: data->result=RockM_get_ctrgv(this_board); break; case ROCKMT_Cget_edata: data->result=RockM_get_edata(this_board); break; case ROCKMT_Cget_hubon: data->result=RockM_get_hubon(this_board); break; case ROCKMT_Cget_cbuson: data->result=RockM_get_cbuson(this_board); break; case ROCKMT_Cget_timeout: data->result=RockM_get_timeout(this_board); break; case ROCKMT_Cget_elapsed: data->result=RockM_get_elapsed(this_board); break; case ROCKMT_Cget_wscale: data->result=RockM_get_wscale(this_board); break; case ROCKMT_Cget_elapsed_time: data->result=RockM_read_elapsed_time(this_board); break; case ROCKMT_Cget_halt: data->result=RockM_get_halt(this_board); break; case ROCKMT_Cget_busy: data->result=RockM_get_busy(this_board); break; case ROCKMT_Cget_syncfail: data->result=RockM_get_syncfail(this_board); break; case ROCKMT_Cget_parity_error: data->result=RockM_get_parity_error(this_board); break; case ROCKMT_Cget_qtrg: data->result=RockM_get_qtrg(this_board); break; case ROCKMT_Cget_ptrg: data->result=RockM_get_ptrg(this_board); break; case ROCKMT_Cget_overrun: data->result=RockM_get_overrun(this_board); break; case ROCKMT_Cget_cnthigh: data->result=RockM_get_cnthigh(this_board); break; case ROCKMT_Cget_chain_add: data->result=RockM_get_chain_add(this_board); break; case ROCKMT_Cget_goldenref: data->result=RockM_get_goldenref(this_board); break; case ROCKMT_Cget_cntlow: data->result=RockM_get_cntlow(this_board); break; case ROCKMT_Cget_slot: data->result=RockM_get_slot(this_board); break; case ROCKMT_Cget_auxas: data->result=RockM_get_auxas(this_board); break; case ROCKMT_Cget_auxtrgv: data->result=RockM_get_auxtrgv(this_board); break; case ROCKMT_Cget_auxdk: data->result=RockM_get_auxdk(this_board); break; case ROCKMT_Cget_auxds: data->result=RockM_get_auxds(this_board); break; case ROCKMT_Cget_cbustemp: data->result=RockM_get_cbustemp(this_board); break; case ROCKMT_Cget_vmetemp: data->result=RockM_get_vmetemp(this_board); break; case ROCKMT_Cget_wrcyc: data->result=RockM_get_wrcyc(this_board); break; case ROCKMT_Cget_rdcyc: data->result=RockM_get_rdcyc(this_board); break; case ROCKMT_Cget_urw: data->result=RockM_get_urw(this_board); break; case ROCKMT_Cget_udav: data->result=RockM_get_udav(this_board); break; case ROCKMT_Cget_udk: data->result=RockM_get_udk(this_board); break; case ROCKMT_Cget_uds: data->result=RockM_get_uds(this_board); break; case ROCKMT_Cget_status: data->result=RockM_get_status(this_board); break; case ROCKMT_Cget_cycle: data->result=RockM_get_cycle(this_board); break; case ROCKMT_Cget_invacc: data->result=RockM_get_invacc(this_board); break; case ROCKMT_Cget_uwrdy: data->result=RockM_get_uwrdy(this_board); break; case ROCKMT_Cget_done: data->result=RockM_get_done(this_board); break; case ROCKMT_Cget_microw: data->result=RockM_get_microw(this_board); break; default: { char *tmp; data->errorstr = (char *) malloc(64); sprintf(data->errorstr,"Invalid field: %i",data->fld.nr); return TL_OK+1; } break; } return TL_OK; } /* rockm set data function*/ /* return TL_OK iff no error */ int rockmt_tl_set(rockmt_t_set *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; unsigned int val = data->value; switch (data->fld.nr) { case ROCKMT_Cset_filter: RockM_set_filter(this_board,val); break; case ROCKMT_Cset_intrst: RockM_set_intrst(this_board,val); break; case ROCKMT_Cset_reprog: RockM_set_reprog(this_board,val); break; case ROCKMT_Cset_cbus: RockM_set_cbus(this_board,val); break; case ROCKMT_Cset_fifo_rst: RockM_set_fifo_rst(this_board,val); break; case ROCKMT_Cset_micro: RockM_set_micro(this_board,val); break; case ROCKMT_Cset_hub_rst: RockM_set_hub_rst(this_board,val); break; case ROCKMT_Cset_cman: RockM_set_cman(this_board,val); break; case ROCKMT_Cset_watchdog: RockM_write_watchdog(this_board,val); break; case ROCKMT_Cset_foe: RockM_set_foe(this_board,val); break; case ROCKMT_Cset_boe: RockM_set_boe(this_board,val); break; case ROCKMT_Cset_bof: RockM_set_bof(this_board,val); break; case ROCKMT_Cset_cbusy_ff: RockM_set_cbusy_ff(this_board,val); break; case ROCKMT_Cset_cpause: RockM_set_cpause(this_board,val); break; case ROCKMT_Cset_hub_mode: RockM_set_hub_mode(this_board,val); break; case ROCKMT_Cset_inttrg: RockM_set_inttrg(this_board,val); break; case ROCKMT_Cset_diag: RockM_set_diag(this_board,val); break; case ROCKMT_Cset_edata: RockM_set_edata(this_board,val); break; case ROCKMT_Cset_elapsed: RockM_set_elapsed(this_board,val); break; case ROCKMT_Cset_wscale: RockM_set_wscale(this_board,val); break; case ROCKMT_Cset_test: RockM_set_test(this_board,val); break; case ROCKMT_Cset_chain_add: RockM_set_chain_add(this_board,val); break; case ROCKMT_Cset_goldenref: RockM_set_goldenref(this_board,val); break; case ROCKMT_Cset_microw: RockM_set_microw(this_board,val); break; default: { char *tmp; data->errorstr = (char *) malloc(64); sprintf(data->errorstr,"Invalid field: %i",data->fld.nr); return TL_OK+1; } break; } return TL_OK; } /* rockm read reset data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_reset(rockmt_t_read_reset *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; RESET = RockM_read_reset(this_board); data->result.filter=FILTER; data->result.intrst=INTRST; data->result.reprog=REPROG; data->result.cbus=CBUS; data->result.fifo_rst=FIFO_RST; data->result.micro=MICRO; data->result.hub_rst=HUB_RST; data->result.cman=CMAN; return TL_OK; } /* rockm read FIFO data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_fifo(rockmt_t_read_fifo *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; FIFOREG = RockM_read_fiforeg(this_board); data->result.df=D_F; data->result.daf=D_AF; data->result.dghf=D_GHF; data->result.dlhf=D_LHF; data->result.dae=D_AE; data->result.de=D_E; data->result.tef=T_EF; data->result.tff=T_FF; return TL_OK; } /* rockm read watchdog data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_watchdog(rockmt_t_read_watchdog *data) { ROCKM_id this_board = (ROCKM_id ) data->rid; data->result=RockM_read_watchdog(this_board); return TL_OK; } /* rockm read CSR0 data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_csr0(rockmt_t_read_csr0 *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; CSR0 = RockM_read_csr0(this_board); data->result.foe=FOE; data->result.boe=BOE; data->result.bof=BOF; data->result.cbusy_ff=CBUSY_FF; data->result.cpause=CPAUSE; data->result.hub_mode=HUB_MODE; data->result.inttrg=INTTRG; data->result.diag=DIAG; return TL_OK; } /* rockm read CSR1 data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_csr1(rockmt_t_read_csr1 *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; CSR1 = RockM_read_csr1(this_board); data->result.ctknout=CTKNOUT; data->result.crdy=CRDY; data->result.cerr=CERR; data->result.crst=CRST; data->result.crngt=CRNGT; data->result.cbusy=CBUSY; data->result.ctrgv=CTRGV; return TL_OK; } /* rockm read CSR2 data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_csr2(rockmt_t_read_csr2 *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; CSR2 = RockM_read_csr2(this_board); data->result.edata=EDATA; data->result.hubon=HUBON; data->result.cbuson=CBUSON; data->result.timeout=TIMEOUT; data->result.elapsed=ELAPSED; data->result.wscale=WSCALE; return TL_OK; } /* rockm read elapsed data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_elapsed(rockmt_t_read_elapsed *data) { ROCKM_id this_board = (ROCKM_id ) data->rid; data->result=RockM_read_elapsed_time(this_board); return TL_OK; } /* rockm read trigger data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_trigger(rockmt_t_read_trigger *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; TRIG_ERR = RockM_read_trig_err(this_board); data->result.halt=HALT; data->result.busy=BUSY; data->result.syncfail=SYNCFAIL; data->result.parity_error=PARITY_ERROR; return TL_OK; } /* rockm read tque data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_tque(rockmt_t_read_tque *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; TQUE = RockM_read_tque(this_board); data->result.tff = TFFF; data->result.link = LINK; data->result.qtrg = QTRG; return TL_OK; } /* rockm read tnow data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_tnow(rockmt_t_read_tnow *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; data->result = RockM_get_ptrg(this_board); return TL_OK; } /* rockm read chainadd data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_chainadd(rockmt_t_read_chainadd *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; CHAINADD = RockM_read_chainadd(this_board); data->result.overrun = OVERRUN; data->result.cnthigh = CNTHIGH; data->result.chain_add = CHAIN_ADD; return TL_OK; } /* rockm read golden data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_golden(rockmt_t_read_golden *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; data->result = RockM_get_goldenref(this_board); return TL_OK; } /* rockm read wordcnt data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_wordcnt(rockmt_t_read_wordcnt *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; data->result = RockM_get_cntlow(this_board); return TL_OK; } /* rockm read infohub data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_infohub(rockmt_t_read_infohub *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; INFOHUB = RockM_read_infohub(this_board); data->result.slot = SLOT; data->result.auxas = AUXAS; data->result.auxtrgv = AUXTRGV; data->result.auxdk = AUXDK; data->result.auxds = AUXDS; return TL_OK; } /* rockm read infomicro data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_infomicro(rockmt_t_read_infomicro *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; INFOMICRO = RockM_read_infomicro(this_board); data->result.cbustemp = CBUSTEMP; data->result.vmetemp = VMETEMP; data->result.wrcyc = WRCYC; data->result.rdcyc = RDCYC; data->result.urw = uRW; data->result.udav = uDAV; data->result.udk = uDK; data->result.uds = uDS; return TL_OK; } /* rockm read microstat data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_microstat(rockmt_t_read_microstat *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; MICROSTAT = RockM_read_microstat(this_board); data->result.status = STATUS; data->result.cycle = CYCLE; data->result.invacc = INVACC; data->result.uwrdy = uWRDY; data->result.done = DONE; return TL_OK; } /* rockm read microword data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_microword(rockmt_t_read_microword *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; data->result = RockM_get_microw(this_board); return TL_OK; } /* rockm read DFIFO data function*/ /* return TL_OK iff no error */ int rockmt_tl_read_dfifo(rockmt_t_read_dfifo *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; FIFO = RockM_read_fifo(this_board); data->result.nvd = NVD; data->result.value = DATA; return TL_OK; } /* rockm write reset data function*/ /* return TL_OK iff no error */ int rockmt_tl_write_reset(rockmt_t_write_reset *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; FILTER = data->value.filter; INTRST = data->value.intrst; REPROG = data->value.reprog; CBUS = data->value.cbus; FIFO_RST = data->value.fifo_rst; MICRO = data->value.micro; HUB_RST = data->value.hub_rst; CMAN = data->value.cman; RockM_write_reset(this_board,RESET); return TL_OK; } /* rockm write watchdog data function*/ /* return TL_OK iff no error */ int rockmt_tl_write_watchdog(rockmt_t_write_watchdog *data) { ROCKM_id this_board = (ROCKM_id ) data->rid; unsigned char val = data->value; RockM_write_watchdog(this_board,val); return TL_OK; } /* rockm write CSR0 data function*/ /* return TL_OK iff no error */ int rockmt_tl_write_csr0(rockmt_t_write_csr0 *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; FOE = data->value.foe; BOE = data->value.boe; BOF = data->value.bof; CBUSY_FF = data->value.cbusy_ff; CPAUSE = data->value.cpause; HUB_MODE = data->value.hub_mode; INTTRG = data->value.inttrg; DIAG = data->value.diag; RockM_write_csr0(this_board,CSR0); return TL_OK; } /* rockm write CSR2 data function*/ /* return TL_OK iff no error */ int rockmt_tl_write_csr2(rockmt_t_write_csr2 *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; EDATA = data->value.edata; ELAPSED = data->value.elapsed; WSCALE = data->value.wscale; RockM_write_csr2(this_board,CSR2); return TL_OK; } /* rockm write trigger data function*/ /* return TL_OK iff no error */ int rockmt_tl_write_trigger(rockmt_t_write_trigger *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; TEST = data->value; RockM_write_trig_err(this_board,TRIG_ERR); return TL_OK; } /* rockm write chainadd data function*/ /* return TL_OK iff no error */ int rockmt_tl_write_chainadd(rockmt_t_write_chainadd *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; CHAIN_ADD = data->value; RockM_write_chainadd(this_board,CHAINADD); return TL_OK; } /* rockm write golden data function*/ /* return TL_OK iff no error */ int rockmt_tl_write_golden(rockmt_t_write_golden *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; GOLDENREF = data->value; RockM_write_golden(this_board,GOLDEN); return TL_OK; } /* rockm write microword data function*/ /* return TL_OK iff no error */ int rockmt_tl_write_microword(rockmt_t_write_microword *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; MICROW = data->value; RockM_write_microword(this_board,MICROWORD); return TL_OK; } /* rockm readpage internal data function*/ /* return TL_OK iff no error */ int rockmt_tl_readpage_internal(rockmt_t_readpage_internal *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; RESET = RockM_read_reset(this_board); FIFOREG = RockM_read_fiforeg(this_board); WATCHDOG = RockM_read_watchdog(this_board); CSR0 = RockM_read_csr0(this_board); CSR1 = RockM_read_csr1(this_board); CSR2 = RockM_read_csr2(this_board); ELAPSED_TIME = RockM_read_elapsed_time(this_board); TRIG_ERR = RockM_read_trig_err(this_board); data->result.filter=FILTER; data->result.intrst=INTRST; data->result.reprog=REPROG; data->result.cbus=CBUS; data->result.fifo_rst=FIFO_RST; data->result.micro=MICRO; data->result.hub_rst=HUB_RST; data->result.cman=CMAN; data->result.df=D_F; data->result.daf=D_AF; data->result.dghf=D_GHF; data->result.dlhf=D_LHF; data->result.dae=D_AE; data->result.de=D_E; data->result.tef=T_EF; data->result.tff=T_FF; data->result.watchdog=WATCHDOG; data->result.foe=FOE; data->result.boe=BOE; data->result.bof=BOF; data->result.cbusy_ff=CBUSY_FF; data->result.cpause=CPAUSE; data->result.hub_mode=HUB_MODE; data->result.inttrg=INTTRG; data->result.diag=DIAG; data->result.ctknout=CTKNOUT; data->result.crdy=CRDY; data->result.cerr=CERR; data->result.crst=CRST; data->result.crngt=CRNGT; data->result.cbusy=CBUSY; data->result.ctrgv=CTRGV; data->result.edata=EDATA; data->result.hubon=HUBON; data->result.cbuson=CBUSON; data->result.timeout=TIMEOUT; data->result.elapsed=ELAPSED; data->result.wscale=WSCALE; data->result.elapsed_time=ELAPSED_TIME; data->result.halt=HALT; data->result.busy=BUSY; data->result.syncfail=SYNCFAIL; data->result.parity_error=PARITY_ERROR; return TL_OK; } /* rockm readpage infohub data function*/ /* return TL_OK iff no error */ int rockmt_tl_readpage_infohub(rockmt_t_readpage_infohub *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; TQUE = RockM_read_tque(this_board); TNOW = RockM_read_tnow(this_board); CHAINADD = RockM_read_chainadd(this_board); GOLDEN = RockM_read_golden(this_board); WORDCNT = RockM_read_wordcnt(this_board); INFOHUB = RockM_read_infohub(this_board); MICROSTAT = RockM_read_microstat(this_board); MICROWORD = RockM_read_microword(this_board); data->result.tff = TFFF; data->result.link = LINK; data->result.qtrg = QTRG; data->result.ptrg = PTRG; data->result.overrun = OVERRUN; data->result.cnthigh = CNTHIGH; data->result.chain_add = CHAIN_ADD; data->result.goldenref = GOLDENREF; data->result.cntlow = CNTLOW; data->result.slot = SLOT; data->result.auxas = AUXAS; data->result.auxtrgv = AUXTRGV; data->result.auxdk = AUXDK; data->result.auxds = AUXDS; data->result.status = STATUS; data->result.cycle = CYCLE; data->result.invacc = INVACC; data->result.uwrdy = uWRDY; data->result.done = DONE; data->result.microw = MICROW; return TL_OK; } /* rockm readpage infomicro data function*/ /* return TL_OK iff no error */ int rockmt_tl_readpage_infomicro(rockmt_t_readpage_infomicro *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; TQUE = RockM_read_tque(this_board); TNOW = RockM_read_tnow(this_board); CHAINADD = RockM_read_chainadd(this_board); GOLDEN = RockM_read_golden(this_board); WORDCNT = RockM_read_wordcnt(this_board); INFOMICRO = RockM_read_infomicro(this_board); MICROSTAT = RockM_read_microstat(this_board); MICROWORD = RockM_read_microword(this_board); data->result.tff = TFFF; data->result.link = LINK; data->result.qtrg = QTRG; data->result.ptrg = PTRG; data->result.overrun = OVERRUN; data->result.cnthigh = CNTHIGH; data->result.chain_add = CHAIN_ADD; data->result.goldenref = GOLDENREF; data->result.cntlow = CNTLOW; data->result.cbustemp = CBUSTEMP; data->result.vmetemp = VMETEMP; data->result.wrcyc = WRCYC; data->result.rdcyc = RDCYC; data->result.urw = uRW; data->result.udav = uDAV; data->result.udk = uDK; data->result.uds = uDS; data->result.status = STATUS; data->result.cycle = CYCLE; data->result.invacc = INVACC; data->result.uwrdy = uWRDY; data->result.done = DONE; data->result.microw = MICROW; return TL_OK; } /* rockm do reset data function*/ /* return TL_OK iff no error */ int rockmt_tl_do_reset(rockmt_t_do_reset *data) { RockM_reg_declaration; ROCKM_id this_board = (ROCKM_id ) data->rid; RESET=RockM_read_reset(this_board); RockM_write_reset(this_board,0x20&RESET); /* do not modify reprog*/ if(REPROG==0) { RockM_set_reprog(this_board,1); while (RockM_get_t_ef(this_board)) ; } RockM_set_intrst(this_board,1); RockM_set_fifo_rst(this_board,1); RockM_set_filter(this_board,1); RockM_set_cman(this_board,1); RockM_set_hub_rst(this_board,1); RockM_set_micro(this_board,1); RockM_set_cbus(this_board,1); return TL_OK; }