struct ns558 { int type; int io; int size; struct pnp_dev *dev; struct gameport *gameport; struct list_head node;
};
static LIST_HEAD(ns558_list);
/* * ns558_isa_probe() tries to find an isa gameport at the * specified address, and also checks for mirrors. * A joystick must be attached for this to work.
*/
staticint ns558_isa_probe(int io)
{ int i, j, b; unsignedchar c, u, v; struct ns558 *ns558; struct gameport *port;
/* * No one should be using this address.
*/
if (!request_region(io, 1, "ns558-isa")) return -EBUSY;
/* * We must not be able to write arbitrary values to the port. * The lower two axis bits must be 1 after a write.
*/
c = inb(io);
outb(~c & ~3, io); if (~(u = v = inb(io)) & 3) {
outb(c, io);
release_region(io, 1); return -ENODEV;
} /* * After a trigger, there must be at least some bits changing.
*/
for (i = 0; i < 1000; i++) v &= inb(io);
if (u == v) {
outb(c, io);
release_region(io, 1); return -ENODEV;
}
msleep(3); /* * After some time (4ms) the axes shouldn't change anymore.
*/
u = inb(io); for (i = 0; i < 1000; i++) if ((u ^ inb(io)) & 0xf) {
outb(c, io);
release_region(io, 1); return -ENODEV;
} /* * And now find the number of mirrors of the port.
*/
for (i = 1; i < 5; i++) {
release_region(io & (-1 << (i - 1)), (1 << (i - 1)));
staticint __init ns558_init(void)
{ int i = 0; int error;
error = pnp_register_driver(&ns558_pnp_driver); if (error && error != -ENODEV) /* should be ENOSYS really */ return error;
/* * Probe ISA ports after PnP, so that PnP ports that are already * enabled get detected as PnP. This may be suboptimal in multi-device * configurations, but saves hassle with simple setups.
*/
while (ns558_isa_portlist[i])
ns558_isa_probe(ns558_isa_portlist[i++]);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.