16 if ( SubeventData == 0)
return -1;
23 for (i=0; i<nlen;) iarr[i++]=0;
26 int *sptr = SubeventData;
35 if (nlen > 0 && i >= nlen)
57 if ( SubeventData == 0)
return -1;
62 for (i=0; i<nlen;) iarr[i++]=0;
65 short *sptr = SubeventData;
74 if (nlen > 0 && i >= nlen)
93 if ( SubeventData == 0)
return -1;
101 for (i=0; i<nlen;) iarr[i++]=0;
104 int *sptr = SubeventData;
120 for ( k = 0; k<30; k+=5)
122 if (nlen > 0 && out_channel >= nlen)
124 *olength = out_channel+1;
127 iarr[out_channel++] = ((h1>>
k) & 0x1f) ;
130 is = ((h1>>30) & 3) | ( h2 << 2);
132 for (k = 0; k<10; k+=5)
134 if (nlen > 0 && out_channel >= nlen)
136 *olength = out_channel+1;
139 iarr[out_channel++] = ((is>>
k) & 0x1f) ;
144 *olength = out_channel;
155 if ( SubeventData == 0)
return -1;
161 for (i=0; i<nlen;) iarr[i++]=0;
164 int *sptr = SubeventData;
173 if (nlen > 0 && i >= nlen)
191 if ( SubeventData == 0)
return -1;
197 for (i=0; i<nlen;) iarr[i++]=0;
200 int *sptr = SubeventData;
209 for (i=istart; i <
dlength ; i++)
219 if (nlen > 0 && nrl >= nlen)
229 iarr[nrl++] = (b20 >>
j ) & 0x1f;
233 iarr[nrl++] = (b20 >>
j ) & 0x1f;
237 iarr[nrl++] = (b20 >>
j ) & 0x1f;
241 iarr[nrl++] = (b20 >>
j ) & 0x1f;
258 if ( SubeventData == 0)
return -1;
265 for (i=0; i<nlen;) parr[i++]=0;
270 int ipos,isdm,
index,adr,len,len_adc;
274 for(isdm=0;isdm<11;isdm++)
301 while (index<len_adc)
303 if (sdm->
array[index] & 0x80000000)
311 iarr->
out[isdm].
tac[adr] = ((sdm->
array[index+1]>>20) & 0x3ff);
320 *olength =
sizeof(*iarr)/4;
331 if ( SubeventData == 0)
return -1;
338 istat =
decode_id4evt(iarr, SubeventData, dlength, nlen, olength);
341 for (i=0; i < *olength ; i++)
361 for (i=0; i<nlen;) iarr[i++]=0;
364 int *sptr = SubeventData;
367 while (sptr[i] != 0xdc111 && i++ < dlength ){}
376 for (i=istart; i <
dlength ; i++)
386 if (nlen > 0 && nrl >= nlen)
392 if (sptr[i] == 0xff444)
402 iarr[nrl++] = (b20 >>
j ) & 0x1f;
406 iarr[nrl++] = (b20 >>
j ) & 0x1f;
410 iarr[nrl++] = (b20 >>
j ) & 0x1f;
414 iarr[nrl++] = (b20 >>
j ) & 0x1f;
429 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
439 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
449 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
459 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
470 if ( packetData == 0)
return -1;
476 for (i=0; i<nlen;) iarr[i++]=0;
479 int *sptr = &packetData[5];
492 while ( (sptr[i] & 0x80000000) == 0)
495 if ( i > dlength -5)
break;
504 b20 = sptr[
i] & 0xfffff;
506 int upperbits = (sptr[
i] >> 20 ) & 0xfff;
507 int wordnr = upperbits & 0x01f;
508 int channel = (upperbits >> 5 ) & 0x3f;
511 nrl = channel * 80 + wordnr *4;
514 iarr[nrl++] = (b20 >>
j ) & 0x1f;
519 iarr[nrl++] = (b20 >>
j ) & 0x1f;
524 iarr[nrl++] = (b20 >>
j ) & 0x1f;
529 iarr[nrl++] = (b20 >>
j ) & 0x1f;
549 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
559 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
570 if ( packetData == 0)
return -1;
580 for (i=0; i<nlen;) iarr[i++]=0;
582 emchannel emc = (emchannel) &packetData[8];
586 for (i=0; i < 144 ; i++)
593 channel= ( emc->timing >> 20) & 0xff;
595 if (nlen > 0 && 5*channel >= nlen)
598 *olength = (channel+1)*5;
603 if ( (emc->timing & 0x90000 && emc->post &0xc0000 && emc->pre & 0xa0000 )
604 && channel >= 0 && channel < 144 )
607 if ( emc->post & 0x8000)
609 iarr[
channel] = (emc->timing & 0xfff);
611 iarr[channel+2] = (emc->post & 0xfff);
613 iarr[channel+4] = (emc->pre & 0xfff);
618 iarr[
channel] = (emc->timing & 0xfff);
619 iarr[channel+1] = (emc->post & 0xfff);
621 iarr[channel+3] = (emc->pre & 0xfff);
638 if ( packetData == 0)
return -1;
653 for (i=0; i<nlen;) iarr[i++]=0;
656 emchannel emc = (emchannel) &packetData[9];
661 for (i=0; i < 192 ; i++)
667 if (nlen > 0 && j >= nlen)
674 iarr[j++] = (emc->timing & 0xfff);
675 iarr[j++] = (emc->higain_post & 0xfff);
676 iarr[j++] = (emc->logain_post & 0xfff);
677 iarr[j++] = (emc->higain_pre & 0xfff);
678 iarr[j++] = (emc->logain_pre & 0xfff);
695 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
705 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
718 if ( packetData == 0)
return -1;
725 for (i=0; i<nlen;) iarr[i++]=0;
729 int *ic = &packetData[5];
734 if (nlen > 0 && nlen < 63*32)
742 for (i=0; i < 63*32 ; i++)
762 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
771 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
781 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
790 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
799 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
808 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
817 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
826 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
835 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
844 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
853 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
862 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
871 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
881 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
891 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
901 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
911 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
921 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
931 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
941 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
951 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
961 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
971 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
981 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
993 if ( packetData == 0)
return -1;
998 for (i=0; i<nlen;) iarr[i++]=0;
1002 int *ic = &packetData[10];
1008 if (nlen > 0 && nlen < 512){
1016 for (i=0; i < 512 ; i++) {
1030 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1039 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1048 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1058 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1068 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1078 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1087 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1097 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1107 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1117 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1127 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1137 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1147 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1157 if ( packetData == 0)
return -1;
1162 for (i=0; i<nlen;) iarr[i++]=0;
1166 int *ic = &packetData[10];
1170 if (nlen > 0 && nlen < 512){
1176 for (i=0; i < 512 ; i++) {
1191 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1200 return decode_id4evt( iarr, packetData, dlength, nlen, olength);
1212 if ( packetData == 0)
return -1;
1225 for (i=0; i<nlen;) iarr[i++]=0;
1228 emchannel emc = (emchannel) &packetData[9];
1233 for (i=0; i < 144 ; i++)
1239 if (nlen > 0 && j >= nlen)
1246 if ( emc->post & 0x1000)
1248 iarr[j++] = (emc->timing & 0xfff);
1250 iarr[j++] = (emc->post & 0xfff);
1252 iarr[j++] = (emc->pre & 0xfff);
1257 iarr[j++] = (emc->timing & 0xfff);
1258 iarr[j++] = (emc->post & 0xfff);
1260 iarr[j++] = (emc->pre & 0xfff);
1278 if ( packetData == 0)
return -1;
1283 for (i=0; i<nlen;) iarr[i++]=0;
1287 int *ic = &packetData[10];
1291 if (nlen > 0 && nlen < 512){
1297 for (i=0; i < 512 ; i++) {