rt_isa.c 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* $OpenBSD: rt_isa.c,v 1.1 2002/08/28 21:20:48 mickey Exp $ */
  2. /*
  3. * Copyright (c) 2001, 2002 Maxim Tsyplakov <tm@oganer.net>,
  4. * Vladimir Popov <jumbo@narod.ru>
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
  17. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. /* ISA interface for AIMS Lab Radiotrack FM Radio Card device driver */
  28. /*
  29. * Sanyo LM7000 Direct PLL Frequency Synthesizer
  30. */
  31. #include <sys/param.h>
  32. #include <sys/systm.h>
  33. #include <sys/device.h>
  34. #include <machine/bus.h>
  35. #include <dev/ic/lm700x.h>
  36. #include <dev/isa/isavar.h>
  37. #include <dev/isa/rtreg.h>
  38. #include <dev/isa/rtvar.h>
  39. int rt_isa_probe(struct device *, void *, void *);
  40. void rt_isa_attach(struct device *, struct device *, void *);
  41. struct cfattach rt_isa_ca = {
  42. sizeof(struct rt_softc), rt_isa_probe, rt_isa_attach
  43. };
  44. int
  45. rt_isa_probe(struct device *parent, void *match, void *aux)
  46. {
  47. struct isa_attach_args *ia = aux;
  48. bus_space_handle_t ioh;
  49. int iosize = 1;
  50. if (!RT_BASE_VALID(ia->ia_iobase)) {
  51. printf("rt: wrong iobase 0x%x\n", ia->ia_iobase);
  52. return (0);
  53. }
  54. if (bus_space_map(ia->ia_iot, ia->ia_iobase, iosize, 0, &ioh))
  55. return (0);
  56. /* This doesn't work yet */
  57. bus_space_unmap(ia->ia_iot, ioh, iosize);
  58. return (0);
  59. #if 0
  60. ia->ia_iosize = iosize;
  61. return 1;
  62. #endif /* 0 */
  63. }
  64. void
  65. rt_isa_attach(struct device *parent, struct device *self, void *aux)
  66. {
  67. struct rt_softc *sc = (void *) self;
  68. struct isa_attach_args *ia = aux;
  69. bus_space_handle_t ioh;
  70. /* remap I/O */
  71. if (bus_space_map(ia->ia_iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) {
  72. printf(": bus_space_map() failed\n");
  73. return;
  74. }
  75. printf(": AIMS Lab Radiotrack or compatible\n");
  76. sc->sc_ct = CARD_RADIOTRACK;
  77. sc->lm.iot = ia->ia_iot;
  78. sc->lm.ioh = ioh;
  79. rtattach(sc);
  80. }