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

📄 apci1710_inccpt.c

📁 最新版comedi的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
/**@verbatimCopyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.                 ADDI-DATA GmbH         Dieselstrasse 3         D-77833 Ottersweier         Tel: +19(0)7223/9493-0         Fax: +49(0)7223/9493-92         http://www.addi-data-com         info@addi-data.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAYou shoud also find the complete GPL in the COPYING file accompanying this source code.@endverbatim*//*      +-----------------------------------------------------------------------+  | (C) ADDI-DATA GmbH          Dieselstraße 3       D-77833 Ottersweier  |  +-----------------------------------------------------------------------+  | Tel : +49 (0) 7223/9493-0     | email    : info@addi-data.com         |  | Fax : +49 (0) 7223/9493-92    | Internet : http://www.addi-data.com   |  +-----------------------------------------------------------------------+  | Project     : API APCI1710    | Compiler : gcc                        |  | Module name : INC_CPT.C       | Version  : 2.96                       |  +-------------------------------+---------------------------------------+  | Project manager: Eric Stolz   | Date     :  02/12/2002                |  +-----------------------------------------------------------------------+  | Description :   APCI-1710 incremental counter module                  |  |                                                                       |  |                                                                       |  +-----------------------------------------------------------------------+  |                             UPDATES                                   |  +-----------------------------------------------------------------------+  |   Date   |   Author  |          Description of updates                |  +----------+-----------+------------------------------------------------+  |          |           |                                                |  |----------|-----------|------------------------------------------------|  | 08/05/00 | Guinot C  | - 0400/0228 All Function in RING 0             |  |          |           |   available                                    |  +-----------------------------------------------------------------------+  | 29/06/01 | Guinot C. | - 1100/0231 -> 0701/0232                       |  |          |           | See i_APCI1710_DisableFrequencyMeasurement     |  +-----------------------------------------------------------------------+*//*+----------------------------------------------------------------------------+|                               Included files                               |+----------------------------------------------------------------------------+*/#include "APCI1710_INCCPT.h"/*+----------------------------------------------------------------------------+| INT	i_APCI1710_InsnConfigINCCPT(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data)+----------------------------------------------------------------------------+| Task              : Configuration function for INC_CPT                             |+----------------------------------------------------------------------------+| Input Parameters  :														 |	+----------------------------------------------------------------------------+| Output Parameters : *data+----------------------------------------------------------------------------+| Return Value      :                 |+----------------------------------------------------------------------------+*/INT	i_APCI1710_InsnConfigINCCPT(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ 	UINT  ui_ConfigType; 	INT    i_ReturnValue = 0;	ui_ConfigType=CR_CHAN(insn->chanspec);		printk ("\nINC_CPT");       devpriv->tsk_Current=current; // Save the current process task structure	switch(ui_ConfigType)	{	case	APCI1710_INCCPT_INITCOUNTER	:							i_ReturnValue =i_APCI1710_InitCounter (dev,					CR_AREF(insn->chanspec),					(BYTE) data[0],					(BYTE) data[1],					(BYTE) data[2],					(BYTE) data[3],					(BYTE) data[4]);			break;	case	APCI1710_INCCPT_COUNTERAUTOTEST:			i_ReturnValue =i_APCI1710_CounterAutoTest (dev,					(PBYTE)   &data[0]);			break;	case	APCI1710_INCCPT_INITINDEX:			i_ReturnValue =i_APCI1710_InitIndex    (dev,					CR_AREF(insn->chanspec),					(BYTE) data[0],					(BYTE) data[1],					(BYTE) data[2],					(BYTE) data[3]);			break;	case	APCI1710_INCCPT_INITREFERENCE:			i_ReturnValue =i_APCI1710_InitReference  (dev,					CR_AREF(insn->chanspec),					(BYTE) data[0]);			break;	case	APCI1710_INCCPT_INITEXTERNALSTROBE:					i_ReturnValue =i_APCI1710_InitExternalStrobe	(dev,					CR_AREF(insn->chanspec),					(BYTE) data[0],					(BYTE) data[1]);			break;	case	APCI1710_INCCPT_INITCOMPARELOGIC:			i_ReturnValue =i_APCI1710_InitCompareLogic     (dev,					CR_AREF(insn->chanspec),					(UINT) data[0]);			break;	case	APCI1710_INCCPT_INITFREQUENCYMEASUREMENT:			i_ReturnValue =i_APCI1710_InitFrequencyMeasurement	(dev,					CR_AREF(insn->chanspec),					(BYTE) data[0],					(BYTE) data[1],					(ULONG) data[2],					(PULONG) &data[0]);			break;    default: 		    printk("Insn Config : Config Parameter Wrong\n");	}    if(i_ReturnValue>=0) i_ReturnValue =insn->n;	return (i_ReturnValue);}/*+----------------------------------------------------------------------------+| Function Name     : _INT_ i_APCI1710_InitCounter                           ||                               (BYTE_          b_BoardHandle,               ||                                BYTE_          b_ModulNbr,                  ||                                BYTE_          b_CounterRange,              ||                                BYTE_          b_FirstCounterModus,         ||                                BYTE_          b_FirstCounterOption,        ||                                BYTE_          b_SecondCounterModus,        ||                                BYTE_          b_SecondCounterOption)       |+----------------------------------------------------------------------------+| Task              : Configure the counter operating mode from selected     ||                     module (b_ModulNbr). You must calling this function be ||                     for you call any other function witch access of        ||                     counters.                                              ||                                                                            ||                          Counter range                                     ||                          -------------                                     || +------------------------------------+-----------------------------------+ || | Parameter       Passed value       |        Description                | || |------------------------------------+-----------------------------------| || |b_ModulNbr   APCI1710_16BIT_COUNTER |  The module is configured for     | || |                                    |  two 16-bit counter.              | || |                                    |  - b_FirstCounterModus and        | || |                                    |    b_FirstCounterOption           | || |                                    |    configure the first 16 bit     | || |                                    |    counter.                       | || |                                    |  - b_SecondCounterModus and       | || |                                    |    b_SecondCounterOption          | || |                                    |    configure the second 16 bit    | || |                                    |    counter.                       | || |------------------------------------+-----------------------------------| || |b_ModulNbr   APCI1710_32BIT_COUNTER |  The module is configured for one | || |                                    |  32-bit counter.                  | || |                                    |  - b_FirstCounterModus and        | || |                                    |    b_FirstCounterOption           | || |                                    |    configure the 32 bit counter.  | || |                                    |  - b_SecondCounterModus and       | || |                                    |    b_SecondCounterOption          | || |                                    |    are not used and have no       | || |                                    |    importance.                    | || +------------------------------------+-----------------------------------+ ||                                                                            ||                      Counter operating mode                                ||                      ----------------------                                ||                                                                            || +--------------------+-------------------------+-------------------------+ || |    Parameter       |     Passed value        |    Description          | || |--------------------+-------------------------+-------------------------| || |b_FirstCounterModus | APCI1710_QUADRUPLE_MODE | In the quadruple mode,  | || |       or           |                         | the edge analysis       | || |b_SecondCounterModus|                         | circuit generates a     | || |                    |                         | counting pulse from     | || |                    |                         | each edge of 2 signals  | || |                    |                         | which are phase shifted | || |                    |                         | in relation to each     | || |                    |                         | other.                  | || |--------------------+-------------------------+-------------------------| || |b_FirstCounterModus |   APCI1710_DOUBLE_MODE  | Functions in the same   | || |       or           |                         | way as the quadruple    | || |b_SecondCounterModus|                         | mode, except that only  | || |                    |                         | two of the four edges   | || |                    |                         | are analysed per        | || |                    |                         | period                  | || |--------------------+-------------------------+-------------------------| || |b_FirstCounterModus |   APCI1710_SIMPLE_MODE  | Functions in the same   | || |       or           |                         | way as the quadruple    | || |b_SecondCounterModus|                         | mode, except that only  | || |                    |                         | one of the four edges   | || |                    |                         | is analysed per         | || |                    |                         | period.                 | || |--------------------+-------------------------+-------------------------| || |b_FirstCounterModus |   APCI1710_DIRECT_MODE  | In the direct mode the  | || |       or           |                         | both edge analysis      | || |b_SecondCounterModus|                         | circuits are inactive.  | || |                    |                         | The inputs A, B in the  | || |                    |                         | 32-bit mode or A, B and | || |                    |                         | C, D in the 16-bit mode | || |                    |                         | represent, each, one    | || |                    |                         | clock pulse gate circuit| || |                    |                         | There by frequency and  | || |                    |                         | pulse duration          | || |                    |                         | measurements can be     | || |                    |                         | performed.              | || +--------------------+-------------------------+-------------------------+ ||                                                                            ||                                                                            ||       IMPORTANT!                                                           ||       If you have configured the module for two 16-bit counter, a mixed    ||       mode with a counter in quadruple/double/single mode                  ||       and the other counter in direct mode is not possible!                ||                                                                            ||                                                                            ||         Counter operating option for quadruple/double/simple mode          ||         ---------------------------------------------------------          ||                                                                            || +----------------------+-------------------------+------------------------+|| |       Parameter      |     Passed value        |  Description           ||| |----------------------+-------------------------+------------------------||| |b_FirstCounterOption  | APCI1710_HYSTERESIS_ON  | In both edge analysis  ||| |        or            |                         | circuits is available  ||| |b_SecondCounterOption |                         | one hysteresis circuit.||| |                      |                         | It suppresses each     ||| |                      |                         | time the first counting||| |                      |                         | pulse after a change   ||| |                      |                         | of rotation.           ||| |----------------------+-------------------------+------------------------||| |b_FirstCounterOption  | APCI1710_HYSTERESIS_OFF | The first counting     ||| |       or             |                         | pulse is not suppress  ||| |b_SecondCounterOption |                         | after a change of      ||| |                      |                         | rotation.              ||| +----------------------+-------------------------+------------------------+||                                                                            ||                                                                            ||       IMPORTANT!                                                           ||       This option are only avaible if you have selected the direct mode.   ||                                                                            ||                                                                            ||               Counter operating option for direct mode                     ||               ----------------------------------------                     ||                                                                            || +----------------------+--------------------+----------------------------+ || |      Parameter       |     Passed value   |       Description          | || |----------------------+--------------------+----------------------------| || |b_FirstCounterOption  | APCI1710_INCREMENT | The counter increment for  | || |       or             |                    | each counting pulse        | || |b_SecondCounterOption |                    |                            | || |----------------------+--------------------+----------------------------| || |b_FirstCounterOption  | APCI1710_DECREMENT | The counter decrement for  | || |       or             |                    | each counting pulse        | || |b_SecondCounterOption |                    |                            | || +----------------------+--------------------+----------------------------+ ||                                                                            |+----------------------------------------------------------------------------+| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710||                     BYTE_ b_ModulNbr            : Module number to         ||                                                   configure (0 to 3)       ||                     BYTE_ b_CounterRange        : Selection form counter   ||                                                   range.                   ||                     BYTE_ b_FirstCounterModus   : First counter operating  ||                                                   mode.                    ||                     BYTE_ b_FirstCounterOption  : First counter  option.   ||                     BYTE_ b_SecondCounterModus  : Second counter operating ||                                                   mode.                    ||                     BYTE_ b_SecondCounterOption : Second counter  option.  |+----------------------------------------------------------------------------+| Output Parameters : -                                                      |+----------------------------------------------------------------------------+| Return Value      : 0: No error                                            ||                    -1: The handle parameter of the board is wrong          ||                    -2: The module is not a counter module                  ||                    -3: The selected counter range is wrong.                ||                    -4: The selected first counter operating mode is wrong. ||                    -5: The selected first counter operating option is wrong||                    -6: The selected second counter operating mode is wrong.||                    -7: The selected second counter operating option is     ||                        wrong.                                              |+----------------------------------------------------------------------------+*/INT   i_APCI1710_InitCounter (comedi_device *dev,				BYTE          b_ModulNbr,

⌨️ 快捷键说明

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