Ejemplo n.º 1
0
static void exit_threads(void)
{
	if(dmb_thread_run == 0)
		return;
	
	dmb_thread_run = 0;

#if 0
	pthread_kill(tsp_read_thread_cb, SIGINT);
	pthread_kill(tsp_consumer_thread_cb, SIGINT);

//	pthread_cancel(tsp_read_thread_cb);
//	pthread_cancel(tsp_consumer_thread_cb);
#else	
	mrevent_trigger(&ts_read_event);
#endif
			
	pthread_join(tsp_read_thread_cb, NULL);
	pthread_join(tsp_consumer_thread_cb, NULL);
	ts_buf_deinit();
}
Ejemplo n.º 2
0
void *dmb_read_thread(void *arg)
{
#if !defined(RTV_TDMB_MULTI_SUB_CHANNEL_ENABLE)
	MTV_TS_PKT_INFO *tsp;
#else
	TDMB_CIF_TS_INFO *tsp;
	int len;
#endif

#if defined(RTV_IF_SPI) 	
	int dev = fd_dmb_dev;
#elif defined(RTV_IF_MPEG2_SERIAL_TSIF) || defined(RTV_IF_SPI_SLAVE) || defined(RTV_IF_MPEG2_PARALLEL_TSIF) || defined(RTV_IF_QUALCOMM_TSIF) 
	int dev = fd_tsif_dev; 
#endif	  

	printf("[dmb_read_thread] Entered\n");

	for(;;)
	{
		if(dmb_thread_run == 0)
		{
			break;
		}

#if !defined(RTV_TDMB_MULTI_SUB_CHANNEL_ENABLE)			
		tsp = (MTV_TS_PKT_INFO *)queue_get(&tsp_pool_cb);		
#else
		tsp = (TDMB_CIF_TS_INFO *)queue_get(&tsp_pool_cb);		
#endif
		if(tsp == NULL) 
		{
			printf("[dmb_read_thread] tsp_pool_cb full!!!\n");
			continue;
		}

		// Read a TSP into a free buffer.
#if !defined(RTV_TDMB_MULTI_SUB_CHANNEL_ENABLE)					
		tsp->len = read(dev, tsp->msc_buf, MAX_READ_TSP_SIZE);		
		if(tsp->len > 0)			
#else
		len = read(dev, tsp, sizeof(TDMB_CIF_TS_INFO));		
		if(len > 0)			
#endif
		{			
			/* Enqueue a TSP to data queue. */
			queue_put(&tsp_queue_cb, (unsigned int)tsp);

			/* Send the data-event to consumer. */
			mrevent_trigger(&ts_read_event);
		}		
		else
		{
			//printf("[dmb_read_thread] read() fail: %d, dmb_thread_run:%d\n", ret, dmb_thread_run);
			
			queue_put(&tsp_pool_cb, (unsigned int)tsp);
		}

		usleep(5 * 1000);
	}

	printf("[dmb_read_thread] Exit...\n");			

	pthread_exit((void *)NULL);
}
Ejemplo n.º 3
0
	void set()
	{
		mrevent_trigger(m_event);
	}