staging: comedi: addi_apci_3xxx: refactor the ttl digital i/o support
Currently, the subdevice functions used to configure and read/write the ttl digital i/o ports is way over to complicated. The (*insn_config) function also abuses the comedi API by overriding the instruction command passed in data[0]. Fix the ttl digital i/o support to work like the comedi core expects. The (*insn_config) function supports the three instructions common for COMEDI_SUBD_DIO subdevices: INSN_CONFIG_DIO_INPUT - configure the specified channel as input INSN_CONFIG_DIO_OUTPUT - configure the specified channel as output INSN_CONFIG_DIO_QUERY - returns the status of the specified channel Port 0 (channels 0-7) is always input Port 1 (channels 8-15) is always output Port 2 (channels 9-23) are programmable i/o (all channels are input or output) The (*insn_bits) function allows writing to the output channels and returns the state of all channels. The (*insn_read) and (*insn_write) functions are not required. The comedi core will emulate them using the (*insn_bits) 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>
Showing
This diff is collapsed.
Please register or sign in to comment