static void
framebuffer_reset(void) {
    bs_reset(&mBSWrite);
    bs_reset(&mBSRead);
    bs_reset(&mBSInput);

    mEosReceived    = false;
    mAvailableRoom  = mBSWrite.buf_size * BITSTREAM_WORD_SIZE;
    mAvailableBits  = 0;
    mFrameReady     = false;
    bInputBufJustArrived = true;
    bOutputBufferFilled = false;   
    mInputBufBits = 0;

    mPayloadDataBitsRead = 0;
    mPayloadDataBitsLeft = 0;
    mPayloadHeaderBitsRead = 0;
    mPartialHeaderByteCount = 0;
    bPartialAsfHeaderPresent = false;

	TSreset(&mTimeStampInfo);
	mTimeStampUpdateFlag = false;
    bEndOfFrame = false;
}
示例#2
0
int main(int argc, char *argv[]) {

   CVBoardTypes VMEBoard;
   short Link;
   short Device;

   std::cout << "Trigger handling from TSV board" << std::endl << std::endl;

   VMEBoard = cvV2718;
   Device = 0;
   Link = 0;

   if( CAENVME_Init(VMEBoard, Link, Device, &BHandle) != cvSuccess ) {

         std::cout << "ERROR: fail to open VME bus adapter" << std::endl;
         exit(1);
   }

   std::cout << "VME board V2818 opened successfully !" << std::endl;

   //CAENVME_SystemReset(BHandle);

   bs_enable();
   bs_reset();

   while(1) {

      if(bs_read()) {	// we got a trigger...

         std::cout << "TRIGGER detected" << std::endl;
         bs_reset();  
      }
   }

   return 0;	// never reached
}
示例#3
0
int alloc_session_slot(struct session_slot_table *sst, uint32_t *sequence,
		       uint32_t *highest_slotid)
{
	int slotid = -1;

	pthread_mutex_lock(&sst->mutex);
	slotid = bs_ffs(sst->free_slots);
	while (slotid == -1 || slotid > sst->target_highest_slotid) {
		// wait until a slot becomes available
		pthread_cond_wait(&sst->slot_cv, &sst->mutex);
		slotid = bs_ffs(sst->free_slots);
	}
	bs_reset(sst->free_slots, slotid);
	if (slotid >= sst->highest_used_slotid_plus1) {
		sst->highest_used_slotid_plus1 = slotid + 1;
	}
	*sequence = sst->slots[slotid];
	*highest_slotid = sst->highest_used_slotid_plus1 - 1;
	pthread_mutex_unlock(&sst->mutex);

	return slotid; /* slotid index starts from 0 instead of 1 */
}