void DumpPmtVerbose(int n, uint32_t *pmt_buf, char* msg_buf) { int i,j; char msg[10000]; memset(msg,'\0',10000); for (i=0;i<n*3;i+=3) { if (!(i%32)){ sprintf(msg+strlen(msg),"No\tCh\tCell\t\tGT\tQlx\tQhs\tQhl\tTAC\tES\tMC\tLGI\tNC/CC\tCr\tBd\n"); sprintf(msg+strlen(msg),"--------------------------------------------------------------------------------------\n"); } sprintf(msg+strlen(msg),"% 4d\t%2u\t%2u\t%8u\t%4u\t%4u\t%4u\t%4u\t%u%u%u\t%1u\t%1u\t%1u\t%2u\t%2u\n", i/3, (uint32_t) UNPK_CHANNEL_ID(pmt_buf+i), (uint32_t) UNPK_CELL_ID(pmt_buf+i), (uint32_t) UNPK_FEC_GT_ID(pmt_buf+i), (uint32_t) UNPK_QLX(pmt_buf+i), (uint32_t) UNPK_QHS(pmt_buf+i), (uint32_t) UNPK_QHL(pmt_buf+i), (uint32_t) UNPK_TAC(pmt_buf+i), (uint32_t) UNPK_CMOS_ES_16(pmt_buf+i), (uint32_t) UNPK_CGT_ES_16(pmt_buf+i), (uint32_t) UNPK_CGT_ES_24(pmt_buf+i), (uint32_t) UNPK_MISSED_COUNT(pmt_buf+i), (uint32_t) UNPK_LGI_SELECT(pmt_buf+i), (uint32_t) UNPK_NC_CC(pmt_buf+i), (uint32_t) UNPK_CRATE_ID(pmt_buf+i), (uint32_t) UNPK_BOARD_ID(pmt_buf+i)); } sprintf(msg_buf+strlen(msg_buf),"%s",msg); lprintf("%s",msg); }
void *pt_read_bundle(void *args) { read_bundle_t arg = *(read_bundle_t *) args; free(args); fd_set thread_fdset; FD_ZERO(&thread_fdset); FD_SET(rw_xl3_fd[arg.crate_num],&thread_fdset); int errors = 0; uint32_t crate,slot,chan,gt8,gt16,cmos_es16,cgt_es16,cgt_es8,nc_cc; int cell; double qlx,qhs,qhl,tac; uint32_t pmtword[3]; errors += xl3_rw(READ_MEM+arg.slot_num*FEC_SEL,0x0,pmtword,arg.crate_num,&thread_fdset); errors += xl3_rw(READ_MEM+arg.slot_num*FEC_SEL,0x0,pmtword+1,arg.crate_num,&thread_fdset); errors += xl3_rw(READ_MEM+arg.slot_num*FEC_SEL,0x0,pmtword+2,arg.crate_num,&thread_fdset); if (errors != 0){ pt_printsend("There were %d errors reading out the bundles.\n",errors); unthread_and_unlock(0,(0x1<<arg.crate_num),arg.thread_num); return; } pt_printsend("%08x %08x %08x\n",pmtword[0],pmtword[1],pmtword[2]); if (arg.quiet == 0){ crate = (uint32_t) UNPK_CRATE_ID(pmtword); slot = (uint32_t) UNPK_BOARD_ID(pmtword); chan = (uint32_t) UNPK_CHANNEL_ID(pmtword); cell = (int) UNPK_CELL_ID(pmtword); gt8 = (uint32_t) UNPK_FEC_GT8_ID(pmtword); gt16 = (uint32_t) UNPK_FEC_GT16_ID(pmtword); cmos_es16 = (uint32_t) UNPK_CMOS_ES_16(pmtword); cgt_es16 = (uint32_t) UNPK_CGT_ES_16(pmtword); cgt_es8 = (uint32_t) UNPK_CGT_ES_24(pmtword); nc_cc = (uint32_t) UNPK_NC_CC(pmtword); qlx = (double) MY_UNPK_QLX(pmtword); qhs = (double) UNPK_QHS(pmtword); qhl = (double) UNPK_QHL(pmtword); tac = (double) UNPK_TAC(pmtword); pt_printsend("crate %d, slot %d, chan %d, cell %d, gt8 %08x, gt16 %08x, cmos_es16 %08x," " cgt_es16 %08x, cgt_es8 %08x, nc_cc %08x, qlx %6.1f, qhs %6.1f, qhl %6.1f, tac %6.1f\n", (int)crate,(int)slot,(int)chan,cell,gt8, gt16,cmos_es16,cgt_es16,cgt_es8,nc_cc,qlx,qhs,qhl,tac); } unthread_and_unlock(0,(0x1<<arg.crate_num),arg.thread_num); }