aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/ni_tio.h
AgeCommit message (Collapse)Author
2019-02-26staging: comedi: ni_tio: Allocate shadow regs for each counter chipIan Abbott
The "ni_tio" module contains code to allocate, destroy and operate on a `struct ni_gpct_device`, which represents a number of counters spread over one or more blocks (or "chips"). `struct ni_gpct_device` includes an array member `regs` holding shadow copies of register values. Unfortunately, this is currently shared by each block of counters so they interfere with each other. This is a problem for the "ni_660x" module, which has 8 counters spread over 2 blocks. The `regs` storage needs to be two-dimensional, indexed by block (chip) number and register number. (It does not need to be three-dimensional because the registers for individual counters are intermingled within the block.) Change the `regs` member to an array pointer that can be indexed like a two-dimensional array to access the shadow storage for each register in each block. Allocate the storage in `ni_gpct_device_construct()` and free it in `ni_gpct_device_destroy()`. (`ni_gpct_device_construct()` can determine the number of blocks from the `num_counters` and `counters_per_chip` parameters.) Add new member `num_chips` to hold the number of chips. Use that to check that `chip_index` value is in range in the same places that check the register offset is in range. Remove the `counters_per_chip` member of `struct ni_gpct_device` as it is not needed anywhere and could be easily derived from the `num_counters` and `num_chips` members if required. Thanks to GitHub user "raabej" (real name unknown) for an initial implementation of this in the out-of-tree fork of the Comedi drivers. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05staging: comedi: drivers: Cleanup malformed licence identifierStephen Davies
This patch fixes multiple occurences of the checkpatch.pl warning: WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 NB. This is an additional patch and does not overlap the patch sent yesterday for 8255.h. Should have sent them all together. Newb mistake. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Stephen Davies <davo2002@tpg.com.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09staging: comedi: tio: implement global tio/ctr routingSpencer E. Olson
Adds ability to use device-global names in command args, in particular cmd->start_arg (for NI_CtrArmStartTrigger), and cmd->scan_begin_arg or cmd->convert_arg (either is used to specify NI_CtrGate, with preference given to cmd->scan_begin_arg, if it is set). The actual arguments of cmd->start_arg are not fully checked against known register values for the particular devices because these are not documented or currently known. This follows the precedence of prior versions of the tio driver. Should these become known, they should be annotated in the route_values tables and the set of lines in ni_tio_cmdtest should be uncommented to allow the tests to be made. This patch also adds interface functions that allow routes for particular counter route destinations to be made/queried/unmade. This allows overseer modules to implement test_route, connect_route, and disconnect_route. As a part of these changes, various functions were cleaned up and clarified. These new interface functions allow direct writing/reading of register values. This is an example of exactly what the new device-global access was intended to solve: the old interface was not consistent with other portions of the ni_* drivers--it did not allow full register values to be given for various MUXes. Instead, the old interface _did_ abstract away some of the actual hardware from the underlying devices, but it was not consistent with any other NI hardware. Allowing the device-global identifiers to be used, the new patch provides for consistency across all ni_* drivers. One final note: these changes provide for backwards compatibility by allowing the older values to still be used in through the pre-existing kernel interfaces--though not in the new device-global test/dis/connect/route interfaces. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: drivers: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all comedi files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: comedi: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/staging/comedi files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Ian Abbott <abbotti@mev.co.uk> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03staging: comedi: ni_tio.h: add identifiers to function parametersIan Abbott
Fix checkpatch.pl warnings of the form "function definition argument 'foo' should also have an identifier name". Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28staging: comedi: ni_tio.h: remove unnecessary forward declarationsH Hartley Sweeten
These struct forward declarations are not needed. Remove them. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28staging: comedi: ni_tio.h: fix block commentH Hartley Sweeten
Fix the checkpatch.pl issue: WARNING: Block comments use * on subsequent lines Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28staging: comedi: ni_tio.h: tidy up struct ni_gpctH Hartley Sweeten
Fix the checkpatch.pl issues: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' CHECK: Prefer kernel type 'u64' over 'uint64_t' CHECK: spinlock_t definition without comment Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28staging: comedi: ni_tio.h: tidy up struct ni_gpct_deviceH Hartley Sweeten
Fix the checkpatch.pl issues: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' CHECK: spinlock_t definition without comment Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28staging: comedi: ni_tio: tidy up struct ni_gpct_device (*{write, read}_register)H Hartley Sweeten
For aesthetics, rename these callbacks to simply read/write. Change the 'unsigned' parameters to 'unsigned int'. This fixes a number of checkpatch.pl issues: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-30staging: comedi: ni_tiocmd: introduce ni_tio_acknowledge()H Hartley Sweeten
The external callers of ni_tio_acknowledge_and_confirm() only call this function to ack any pending errors or interrupts before starting a new async command. Only the internal code in ni_tiocmd uses the data that is optionally returned by this function. Remove the export from ni_tio_acknowledge_and_confirm() and introduce a new exported function that handles passing the NULL params. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08Staging: comedi: ni_tio Fixed whitespace coding style warningsNick Davies
Fixed coding style warnings in ni_tio.h which had an extra space after the function pointer name. Signed-off-by: Nick Davies <git@nicolasdavies.com.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ni_tiocmd: make ni_tio_cmd() a proper comedi (*do_cmd)H Hartley Sweeten
Change the parameters to ni_tio_cmd() to make it a proper comedi (*do_cmd) function. The wrappers in the ni_660x and ni_mio_common modules are still needed to request the mite channel and setup the device before actually doing the command. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ni_tiocmd: make ni_tio_cmdtest() a proper comedi (*do_cmdtest)H Hartley Sweeten
Change the parameters to ni_tio_cmdtest() to make it a proper comedi (*do_cmdtest) function. This allows using it directly and removing the wrapper functions in the ni_660x and ni_mio_common modules. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ni_tio: make ni_tio_insn_config() a proper comedi ↵H Hartley Sweeten
(*insn_config) Change the parameters to ni_tio_insn_config() to make it a proper comedi (*insn_config) function. This allows using it directly and removing the wrapper functions in the ni_660x and ni_mio_common modules. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ni_tio: make ni_tio_winsn() a proper comedi (*insn_write)H Hartley Sweeten
Change the parameters to ni_tio_winsn() to make it a proper comedi (*insn_write) function. This allows using it directly and removing the wrapper functions in the ni_660x and ni_mio_common modules. For aesthetics, rename the function. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ni_tio: make ni_tio_rinsn() a proper comedi (*insn_read)H Hartley Sweeten
Change the parameters to ni_tio_rinsn() to make is a proper comedi (*insn_read) function. This allows using it directly and removing the wrapper functions in the ni_660x and ni_mio_common modules. For aesthetics, rename the function. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ni_tio.h: remove subdev_to_counter()H Hartley Sweeten
This inline helper function simply returns the s->private void *. Remove the helper and just get the s->private void * directly where needed. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ni_tio.h: remove 'extern' from exported function prototypesH Hartley Sweeten
The 'extern' is not required, remove it. Tidy up the function prototypes a bit. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-20staging: comedi: ni_tio.h: rename the CamelCase enum ni_gpct_register labelsH Hartley Sweeten
As prefered by the CodingStyle, rename all the CamelCase labels of the enum ni_gpct_register. Cleanup all the helper functions in ni_tio_internal.h that used the enum. The 'counter_index' parameter to all the functions is the ni_gpct_device 'counter_index' which is initialized when the subdevices are setup. This value is always < 4 so the default: BUG() cases can never happen. For aesthetics, rename the 'counter_idx' to simply 'idx' and fix the type in some of the helpers. Also, remove the unnecessary break statements after the return statements. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13staging: comedi: remove FSF address from boilerplate textH Hartley Sweeten
Addresses change... Remove the paragraph with the FSF address from all the comedi source files. Also, remove the paragraph about the finding the complete GPL in the COPYING file since it's unnecessary. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-26staging: comedi: ni_tio.h fixed coding style issue with pointer variablesMatt Phillips
Fixed coding style issues with pointers Signed-off-by: Matt Phillips <mathewrphillips@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2009-09-15Staging: Comedi: Lindent changes to comdi driver in staging treeMithlesh Thukral
Lindent changes to comdi driver in staging tree. This patch is followed by the checkpatch.pl error fixes. Did not make them part of this patch as the patch size is already huge. Signed-off-by: Mithlesh Thukral <mithlesh@linsyssoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-06-19Staging: comedi: fix "foo * bar" should be "foo *bar"Bill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-06-19Staging: comedi: Remove C99 commentsBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Remove comedi_insn typedefBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Remove comedi_cmd typedefBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Remove comedi_async typedefBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Remove comedi_subdevice typedefBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Remove comedi_device typedefBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Remove lsampl_t and sampl_t typedefsBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: add National Instruments infrastructureFrank Mori Hess
These drivers are used to support National Instruments general purpose counters and commands. From: Frank Mori Hess <fmhess@users.sourceforge.net> Cc: David Schleef <ds@schleef.org> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: J.P. Mellor <jpmellor@rose-hulman.edu> Cc: Herman Bruyninckx <Herman.Bruyninckx@mech.kuleuven.ac.be> Cc: Wim Meeussen <Wim.Meeussen@mech.kuleuven.ac.be> Cc: Klass Gadeyne <Klaas.Gadeyne@mech.kuleuven.ac.be> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>