예제 #1
0
파일: ua101.c 프로젝트: 454053205/linux
static void free_usb_related_resources(struct ua101 *ua,
				       struct usb_interface *interface)
{
	unsigned int i;
	struct usb_interface *intf;

	mutex_lock(&ua->mutex);
	free_stream_urbs(&ua->capture);
	free_stream_urbs(&ua->playback);
	mutex_unlock(&ua->mutex);
	free_stream_buffers(ua, &ua->capture);
	free_stream_buffers(ua, &ua->playback);

	for (i = 0; i < ARRAY_SIZE(ua->intf); ++i) {
		mutex_lock(&ua->mutex);
		intf = ua->intf[i];
		ua->intf[i] = NULL;
		mutex_unlock(&ua->mutex);
		if (intf) {
			usb_set_intfdata(intf, NULL);
			if (intf != interface)
				usb_driver_release_interface(&ua101_driver,
							     intf);
		}
	}
}
예제 #2
0
static void free_usb_related_resources(struct ua101 *ua,
                                       struct usb_interface *interface)
{
    unsigned int i;

    free_stream_urbs(&ua->capture);
    free_stream_urbs(&ua->playback);
    free_stream_buffers(ua, &ua->capture);
    free_stream_buffers(ua, &ua->playback);

    for (i = 0; i < ARRAY_SIZE(ua->intf); ++i)
        if (ua->intf[i]) {
            usb_set_intfdata(ua->intf[i], NULL);
            if (ua->intf[i] != interface)
                usb_driver_release_interface(&ua101_driver,
                                             ua->intf[i]);
        }
}
예제 #3
0
int p7_ViterbiStream(DATA_STREAM* dstream, dsq_cmp_t **seqsdb, float* results)
{
	int j, maxL = 0;

#if 0
	for (j = 0; j < 8; j++)
		if (seqsdb[j]->length > maxL)
			maxL = seqsdb[j]->length;

//	maxL = 2000;
//	for (j = 0; j < 8; j++)	printf("%d ", seqsdb[j]->length); 	printf("\n"); 

	if (maxL > dstream->allocL-10)
	{	// realloc
		dstream->allocL = ESL_MAX(dstream->allocL*2, roundtop(maxL,1024));
		free_stream_buffers(dstream);
		alloc_stream_buffers(dstream, dstream->allocL);
	}

	if (dstream->L != maxL)
	{   dstream->L  = maxL;
		p7_ReconfigLength(dstream->gm, maxL);
	}

	for (j = 0; j < 8; j++)
		memcpy(dstream->seqs[j], seqsdb[j]->seq, (seqsdb[j]->length+1)*sizeof(ESL_DSQ));
	
	// pad sequences with k = Alphasize
	for (j = 0; j < 8; j++)
		memset(dstream->seqs[j]+seqsdb[j]->length+1, dstream->gm->abc->Kp, maxL-seqsdb[j]->length);

	for (j = 1; j <= dstream->gm->M/dstream->partition; j++)
		memset((void*) dstream->synchflags[j], 0, dstream->nflags);

	for (j = 1; j <= dstream->gm->M/dstream->partition; j++)
		memset((void*) dstream->synchflags[j], 0, dstream->nflags);
#endif

if(1)
	for (j = 0; j < NTHREADS-1; j++)
	{	sem_post(&semsynch[j]);
		syncflags[j] = 1;
	}
	
	dstream->synccontrol++;
	viterbi_stream_word_partitioned(dstream, results, NTHREADS-1	);
	return maxL;
}