⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apci1710_inccpt.c

📁 最新版comedi的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
	/**************************/	/* Test the module number */	/**************************/	if (b_ModulNbr < 4)	   {	   /*******************************/	   /* Test if counter initialised */	   /*******************************/	   if (devpriv->	       s_ModuleInfo [b_ModulNbr].	       s_SiemensCounterInfo.	       s_InitFlag.	       b_CounterInit == 1)	      {	      /**************************************/	      /* Test the external strobe selection */              /**************************************/	      if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1)		 {		 /******************/		 /* Test the level */		 /******************/		 if ((b_ExternalStrobeLevel == APCI1710_HIGH) ||		     ((b_ExternalStrobeLevel == APCI1710_LOW && (devpriv->								 s_BoardInfos.								 dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3135)))		    {		    /*****************/		    /* Set the level */		    /*****************/		    devpriv->		    s_ModuleInfo [b_ModulNbr].		    s_SiemensCounterInfo.		    s_ModeRegister.		    s_ByteModeRegister.		    b_ModeRegister4 = (devpriv->				       s_ModuleInfo [b_ModulNbr].				       s_SiemensCounterInfo.				       s_ModeRegister.				       s_ByteModeRegister.				       b_ModeRegister4 & (0xFF - (0x10 << b_ExternalStrobe))) |				       ((b_ExternalStrobeLevel^1) << (4 + b_ExternalStrobe));		    }		 else		    {		    /********************************************/		    /* External strobe level parameter is wrong */		    /********************************************/			DPRINTK("External strobe level parameter is wrong\n");		    i_ReturnValue = -5;		    }		 } // if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1)	      else		 {		 /**************************************/		 /* External strobe selection is wrong */		 /**************************************/		 DPRINTK("External strobe selection is wrong\n");		 i_ReturnValue = -4;		 } // if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1)	      }	   else	      {	      /****************************************/	      /* Counter not initialised see function */	      /* "i_APCI1710_InitCounter"             */	      /****************************************/	      DPRINTK("Counter not initialised\n");		      i_ReturnValue = -3;	      }	   }	else	   {	   /*************************************************/	   /* The selected module number parameter is wrong */	   /*************************************************/	   DPRINTK("The selected module number parameter is wrong\n");		   i_ReturnValue = -2;	   }	return (i_ReturnValue);	}	/*+----------------------------------------------------------------------------+| Function Name     : _INT_ i_APCI1710_InitCompareLogic                      ||                               (BYTE_   b_BoardHandle,                      ||                                BYTE_   b_ModulNbr,                         ||                                UINT_  ui_CompareValue)                     |+----------------------------------------------------------------------------+| Task              : Set the 32-Bit compare value. At that moment that the  ||                     incremental counter arrive to the compare value        ||                     (ui_CompareValue) a interrupt is generated.            |+----------------------------------------------------------------------------+| Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    ||                     BYTE_  b_ModulNbr       : Module number to configure   ||                                               (0 to 3)                     ||                     UINT_ ui_CompareValue   : 32-Bit compare value         |+----------------------------------------------------------------------------+| Output Parameters : -+----------------------------------------------------------------------------+| Return Value      :  0: No error                                           ||                     -1: The handle parameter of the board is wrong         ||                     -2: No counter module found                            ||                     -3: Counter not initialised see function               ||                         "i_APCI1710_InitCounter"                           |+----------------------------------------------------------------------------+*/INT   i_APCI1710_InitCompareLogic     (comedi_device *dev,					 BYTE   b_ModulNbr,					 UINT  ui_CompareValue)	{	INT    i_ReturnValue = 0;		/**************************/	/* Test the module number */	/**************************/	if (b_ModulNbr < 4)	   {	   /*******************************/	   /* Test if counter initialised */	   /*******************************/	   if (devpriv->	       s_ModuleInfo [b_ModulNbr].	       s_SiemensCounterInfo.	       s_InitFlag.	       b_CounterInit == 1)	      {	      		   outl(ui_CompareValue,devpriv->s_BoardInfos.		      ui_Address + 28 + (64 * b_ModulNbr));	      devpriv->	      s_ModuleInfo [b_ModulNbr].	      s_SiemensCounterInfo.	      s_InitFlag.	      b_CompareLogicInit = 1;	      }	   else	      {	      /****************************************/	      /* Counter not initialised see function */	      /* "i_APCI1710_InitCounter"             */	      /****************************************/	      DPRINTK("Counter not initialised\n");  		      i_ReturnValue = -3;	      }	   }	else	   {	   /*************************************************/	   /* The selected module number parameter is wrong */	   /*************************************************/	   DPRINTK("The selected module number parameter is wrong\n");		   i_ReturnValue = -2;	   }	return (i_ReturnValue);	}/*+----------------------------------------------------------------------------+| Function Name     : _INT_ i_APCI1710_InitFrequencyMeasurement              ||				(BYTE_		 b_BoardHandle,              ||				 BYTE_		 b_ModulNbr,                 ||				 BYTE_		 b_PCIInputClock,            ||				 BYTE_		 b_TimingUnity,              ||				 ULONG_ 	ul_TimingInterval,           ||				 PULONG_       pul_RealTimingInterval)       |+----------------------------------------------------------------------------+| Task              : Sets the time for the frequency measurement.           ||		      Configures the selected TOR incremental counter of the ||		      selected module (b_ModulNbr). The ul_TimingInterval and||		      ul_TimingUnity determine the time base for the         ||		      measurement. The pul_RealTimingInterval returns the    ||		      real time value. You must call up this function before ||		      you call up any other function which gives access to   ||		      the frequency measurement.                             |+----------------------------------------------------------------------------+| Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    ||		      BYTE_  b_ModulNbr	      :	Number of the module to be   ||						configured (0 to 3)          ||		      BYTE_  b_PCIInputClock  :	Selection of the PCI bus     ||						clock                        ||						- APCI1710_30MHZ :           ||						  The PC has a PCI bus clock ||						  of 30 MHz                  ||						- APCI1710_33MHZ :           ||						  The PC has a PCI bus clock ||						  of 33 MHz                  ||		      BYTE_  b_TimingUnity    : Base time unit (0 to 2)      ||						  0 : ns                     ||						  1 : æs                     ||						  2 : ms                     ||		      ULONG_ ul_TimingInterval: Base time value.             |+----------------------------------------------------------------------------+| Output Parameters : PULONG_ pul_RealTimingInterval : Real base time value. |+----------------------------------------------------------------------------+| Return Value      :  0: No error                                           ||                     -1: The handle parameter of the board is wrong         ||                     -2: The selected module number is wrong                ||                     -3: Counter not initialised see function               ||			  "i_APCI1710_InitCounter"                           ||                     -4: The selected PCI input clock is wrong              ||                     -5: Timing unity selection is wrong                    ||                     -6: Base timing selection is wrong                     ||		      -7: 40MHz quartz not on board                          |+----------------------------------------------------------------------------+*/INT	i_APCI1710_InitFrequencyMeasurement	(comedi_device *dev,						 BYTE		 b_ModulNbr,						 BYTE		 b_PCIInputClock,						 BYTE		 b_TimingUnity,						 ULONG 		 ul_TimingInterval,						 PULONG      pul_RealTimingInterval)	{	INT    i_ReturnValue = 0;	ULONG ul_TimerValue  = 0;	double d_RealTimingInterval;	DWORD dw_Status      = 0;		/**************************/	/* Test the module number */	/**************************/	if (b_ModulNbr < 4)	   {	   /*******************************/	   /* Test if counter initialised */	   /*******************************/	   if (devpriv->	       s_ModuleInfo [b_ModulNbr].	       s_SiemensCounterInfo.	       s_InitFlag.	       b_CounterInit == 1)	      {	      /**************************/	      /* Test the PCI bus clock */	      /**************************/	      if ((b_PCIInputClock == APCI1710_30MHZ) ||		  (b_PCIInputClock == APCI1710_33MHZ) ||		  (b_PCIInputClock == APCI1710_40MHZ))		 {		 /************************/		 /* Test the timing unit */		 /************************/		 if (b_TimingUnity <= 2)		    {		    /**********************************/		    /* Test the base timing selection */		    /**********************************/		    if (((b_PCIInputClock == APCI1710_30MHZ) && (b_TimingUnity == 0) && (ul_TimingInterval >= 266) && (ul_TimingInterval <= 8738133UL)) ||			((b_PCIInputClock == APCI1710_30MHZ) && (b_TimingUnity == 1) && (ul_TimingInterval >= 1)   && (ul_TimingInterval <= 8738UL))    ||			((b_PCIInputClock == APCI1710_30MHZ) && (b_TimingUnity == 2) && (ul_TimingInterval >= 1)   && (ul_TimingInterval <= 8UL))       ||			((b_PCIInputClock == APCI1710_33MHZ) && (b_TimingUnity == 0) && (ul_TimingInterval >= 242) && (ul_TimingInterval <= 7943757UL)) ||			((b_PCIInputClock == APCI1710_33MHZ) && (b_TimingUnity == 1) && (ul_TimingInterval >= 1)   && (ul_TimingInterval <= 7943UL))    ||			((b_PCIInputClock == APCI1710_33MHZ) && (b_TimingUnity == 2) && (ul_TimingInterval >= 1)   && (ul_TimingInterval <= 7UL))       ||			((b_PCIInputClock == APCI1710_40MHZ) && (b_TimingUnity == 0) && (ul_TimingInterval >= 200) && (ul_TimingInterval <= 6553500UL)) ||			((b_PCIInputClock == APCI1710_40MHZ) && (b_TimingUnity == 1) && (ul_TimingInterval >= 1)   && (ul_TimingInterval <= 6553UL))    ||			((b_PCIInputClock == APCI1710_40MHZ) && (b_TimingUnity == 2) && (ul_TimingInterval >= 1)   && (ul_TimingInterval <= 6UL)))		       {		       /**********************/		       /* Test if 40MHz used */		       /**********************/		       if (b_PCIInputClock == APCI1710_40MHZ)			  {			  /******************************/			  /* Test if firmware >= Rev1.5 */			  /******************************/			  if ((devpriv->			       s_BoardInfos.			       dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3135)			     {			     /*********************************/			     /* Test if 40MHz quartz on board */			     /*********************************/			     /*INPDW (ps_APCI1710Variable->				    s_Board [b_BoardHandle].				    s_BoardInfos.				    ui_Address + 36 + (64 * b_ModulNbr), &dw_Status);*/				  dw_Status=inl(devpriv->s_BoardInfos.				    ui_Address + 36 + (64 * b_ModulNbr));			     /******************************/			     /* Test the quartz flag (DQ0) */			     /******************************/			     if ((dw_Status & 1) != 1)				{				/*****

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -