/* * IEEE 1284.3 Parallel port daisy chain and multiplexor code * * Copyright (C) 1999, 2000 Tim Waugh <[email protected]> * * 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. * * ??-12-1998: Initial implementation. * 31-01-1999: Make port-cloning transparent. * 13-02-1999: Move DeviceID technique from parport_probe. * 13-03-1999: Get DeviceID from non-IEEE 1284.3 devices too. * 22-02-2000: Count devices that are actually detected. * * Any part of this program may be used in documents licensed under * the GNU Free Documentation License, Version 1.1 or any later version * published by the Free Software Foundation. */ #include <linux/module.h> #include <linux/parport.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/sched/signal.h> #include <asm/current.h> #include <linux/uaccess.h> #undef DEBUG static struct daisydev { … } *topology = …; static DEFINE_SPINLOCK(topology_lock); static int numdevs; static bool daisy_init_done; /* Forward-declaration of lower-level functions. */ static int mux_present(struct parport *port); static int num_mux_ports(struct parport *port); static int select_port(struct parport *port); static int assign_addrs(struct parport *port); /* Add a device to the discovered topology. */ static void add_dev(int devnum, struct parport *port, int daisy) { … } /* Clone a parport (actually, make an alias). */ static struct parport *clone_parport(struct parport *real, int muxport) { … } static int daisy_drv_probe(struct pardevice *par_dev) { … } static struct parport_driver daisy_driver = …; /* Discover the IEEE1284.3 topology on a port -- muxes and daisy chains. * Return value is number of devices actually detected. */ int parport_daisy_init(struct parport *port) { … } /* Forget about devices on a physical port. */ void parport_daisy_fini(struct parport *port) { … } /** * parport_open - find a device by canonical device number * @devnum: canonical device number * @name: name to associate with the device * * This function is similar to parport_register_device(), except * that it locates a device by its number rather than by the port * it is attached to. * * All parameters except for @devnum are the same as for * parport_register_device(). The return value is the same as * for parport_register_device(). **/ struct pardevice *parport_open(int devnum, const char *name) { … } /** * parport_close - close a device opened with parport_open() * @dev: device to close * * This is to parport_open() as parport_unregister_device() is to * parport_register_device(). **/ void parport_close(struct pardevice *dev) { … } /* Send a daisy-chain-style CPP command packet. */ static int cpp_daisy(struct parport *port, int cmd) { … } /* Send a mux-style CPP command packet. */ static int cpp_mux(struct parport *port, int cmd) { … } void parport_daisy_deselect_all(struct parport *port) { … } int parport_daisy_select(struct parport *port, int daisy, int mode) { … } static int mux_present(struct parport *port) { … } static int num_mux_ports(struct parport *port) { … } static int select_port(struct parport *port) { … } static int assign_addrs(struct parport *port) { … }