static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int counter_number, unsigned int clock_src) { const struct dio200_board *board = dev->board_ptr; struct dio200_subdev_8254 *subpriv = s->private; unsigned char byte; if (!board->has_clk_gat_sce) return -1; if (counter_number > 2) return -1; if (clock_src > (board->is_pcie ? 31 : 7)) return -1; subpriv->clock_src[counter_number] = clock_src; byte = clk_sce(subpriv->which, counter_number, clock_src); dio200_write8(dev, subpriv->clk_sce_ofs, byte); return 0; }
/* * Set clock source for an '8254' counter subdevice channel. */ static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int counter_number, unsigned int clock_src) { const struct dio200_layout *layout = dio200_dev_layout(dev); struct dio200_subdev_8254 *subpriv = s->private; unsigned char byte; if (!layout->has_clk_gat_sce) return -1; if (counter_number > 2) return -1; if (clock_src > (layout->has_enhancements ? 31 : 7)) return -1; subpriv->clock_src[counter_number] = clock_src; byte = clk_sce(subpriv->which, counter_number, clock_src); dio200_write8(dev, subpriv->clk_sce_ofs, byte); return 0; }