Esempio n. 1
0
static int Open(enum DibBoardType BoardType)
{
	DBG("TSTV:DIBCOM!1009XH: %s[%d]\n", __FUNCTION__, __LINE__);
	#if 0
	while(1){
		DBG("TSTV:DIBCOM!1009XH: \t%s[%d]\n", __FUNCTION__, __LINE__);
		if(spi_write(gTSTVModuleSpi, "a", sizeof("a")) < 0)
		{
			DBG("spi_write failed: \t%s[%d]\n", __FUNCTION__, __LINE__);	
			break;
		}
		msleep(1);
	}
			if(pContext != NULL)
	{
		DBG("Open already!\n");
		return DIBSTATUS_SUCCESS;
	}

	#endif

	
	if(DibOpen(&pContext, BoardType, 0) != DIBSTATUS_SUCCESS)
	{
		DBG("TSTV:DIBCOM!1009XH: Open Driver Failed %s[%d]\n", __FUNCTION__, __LINE__);
		return DIBSTATUS_ERROR;
	}
	
	/*Get driver version*/
	DibGetGlobalInfo(pContext, &globalInfo);
	DBG("Driver ver: %d.%d.%d\t",
			DIB_MAJOR_VER(globalInfo.DriverVersion),
			DIB_MINOR_VER(globalInfo.DriverVersion),
			DIB_REVISION(globalInfo.DriverVersion));
	DBG("Embedded SW ver: %d.%02d (IC: %d)\t",
			(globalInfo.EmbVersions[0] >> 10),
			globalInfo.EmbVersions[0] & 0x03ff,
			globalInfo.EmbVersions[1]);
	DBG("TSTV:DIBCOM!1009XH: Number of demod %d \t%s[%d]\n\n", globalInfo.NumberOfDemods,__FUNCTION__, __LINE__);
	DBG("TSTV:DIBCOM!1009XH: NumberOfStreams: %d\n", globalInfo.NumberOfStreams);
	return DIBSTATUS_SUCCESS;
}
int Open( enum DibBoardType BoardType )
{

   if(DibOpen(&pContext, BoardType, 0) != DIBSTATUS_SUCCESS) 
   {
      printf("Open Driver Failed  \n");
      return DIBSTATUS_ERROR;
   }

   /*  Get driver version */
   DibGetGlobalInfo(pContext, &globalInfo);
   printf("Driver ver: %d.%d.%d\n", 
           DIB_MAJOR_VER(globalInfo.DriverVersion), 
           DIB_MINOR_VER(globalInfo.DriverVersion), 
           DIB_REVISION(globalInfo.DriverVersion));
   printf("Embedded SW ver: %d.%02d (IC: %d)\n", 
           (globalInfo.EmbVersions[0] >> 10), 
           globalInfo.EmbVersions[0] & 0x03ff, 
           globalInfo.EmbVersions[1]);

   return DIBSTATUS_SUCCESS;
}
int	DisplayLayout(void)
{
   uint32_t FeNum, StreamNum, i;
   struct DibStreamAttributes   StreamAttr;
   struct DibFrontendAttributes FrontendAttr;
   const char * StreamTypeString[]= {"HOST_DMA", "MPEG_1", "MPEG_2"};
   
   /*** Get Global Information ***/
   DibGetGlobalInfo(pContext, &globalInfo);

   printf("-------------------------------\n");
   printf("Driver ver: %d.%d.%d\n", 
           DIB_MAJOR_VER(globalInfo.DriverVersion), 
           DIB_MINOR_VER(globalInfo.DriverVersion), 
           DIB_REVISION(globalInfo.DriverVersion));
   printf("Embedded SW ver: %d.%02d (IC: %d)\n", 
           (globalInfo.EmbVersions[0] >> 10), 
           globalInfo.EmbVersions[0] & 0x03ff, 
           globalInfo.EmbVersions[1]);

   printf("     Layout Desccription: \n");
   printf("-------------------------------\n");
   printf("NumberOfChips     = %d\n", globalInfo.NumberOfChips);
   printf("NumberOfFrontends = %d\n", globalInfo.NumberOfFrontends);
   printf("NumberOfStreams   = %d\n", globalInfo.NumberOfStreams);


   /*** Get and Display Stream Attributes ***/

   printf("      Stream attributes:\n");
   printf("-------------------------------\n");

   for(StreamNum = 0; StreamNum < globalInfo.NumberOfStreams; StreamNum++)
   {
      DibGetStreamAttributes(pContext, globalInfo.Stream[StreamNum], &StreamAttr);

      printf("Stream Number: %3d Type: %10s ChipId: %3d Standard: ",
            StreamNum, 
            StreamTypeString[StreamAttr.Type],
            StreamAttr.ChipId);

      DisplayStandards(StreamAttr.Standards);
      printf("\n");
      i = 0;
      while(StreamAttr.PossibleDirectInputs[i].Fe)
      {
         printf("  --> Input FeNum %d Stds = ",
               GetFrontendNumByHandle(StreamAttr.PossibleDirectInputs[i].Fe));
         DisplayStandards(StreamAttr.PossibleDirectInputs[i].Standard);
         printf("\n");
         i++;
      }
   }

   /*** Get and Display Frontend Attributes ***/

   printf("-------------------------------\n");
   printf("     Frontend attributes:\n");
   printf("-------------------------------\n");
   for(FeNum = 0; FeNum < globalInfo.NumberOfFrontends; FeNum++)
   {
      DibGetFrontendAttributes(pContext, globalInfo.Frontend[FeNum], &FrontendAttr);

      printf("Frontend Number: %3d ChipId: %3d FeId: %3d" CRA,
            FeNum, 
            FrontendAttr.ChipId, FrontendAttr.FeId);
      printf(" Std = ");
      DisplayStandards(FrontendAttr.Standards);
      printf("\n");

      i = 0;
      while(FrontendAttr.PossibleDirectInputs[i].Fe)
      {
         printf("  --> MRC Input: FeNum: %d Stds = ",
               GetFrontendNumByHandle(FrontendAttr.PossibleDirectInputs[i].Fe));
         DisplayStandards(FrontendAttr.PossibleDirectInputs[i].Standard);
         printf("\n");
         i++;
      }
   }
   printf("-------------------------------\n");
}