hilvar.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* $OpenBSD: hilvar.h,v 1.10 2006/11/05 14:39:32 miod Exp $ */
  2. /*
  3. * Copyright (c) 2003, Miodrag Vallat.
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  16. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  19. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  21. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  22. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  23. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  24. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. * POSSIBILITY OF SUCH DAMAGE.
  26. *
  27. */
  28. /*
  29. * Copyright (c) 1988 University of Utah.
  30. * Copyright (c) 1990, 1993
  31. * The Regents of the University of California. All rights reserved.
  32. *
  33. * This code is derived from software contributed to Berkeley by
  34. * the Systems Programming Group of the University of Utah Computer
  35. * Science Department.
  36. *
  37. * Redistribution and use in source and binary forms, with or without
  38. * modification, are permitted provided that the following conditions
  39. * are met:
  40. * 1. Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * 2. Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in the
  44. * documentation and/or other materials provided with the distribution.
  45. * 3. Neither the name of the University nor the names of its contributors
  46. * may be used to endorse or promote products derived from this software
  47. * without specific prior written permission.
  48. *
  49. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  50. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  51. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  52. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  53. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  54. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  55. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  56. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  57. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  58. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  59. * SUCH DAMAGE.
  60. *
  61. * from: Utah $Hdr: hilvar.h 1.3 92/01/21$
  62. *
  63. * @(#)hilvar.h 8.1 (Berkeley) 6/10/93
  64. */
  65. #define NHILD 8 /* 7 actual + loop pseudo (dev 0) */
  66. struct hildev_softc;
  67. struct hil_softc {
  68. struct device sc_dev;
  69. bus_space_handle_t sc_bsh;
  70. bus_space_tag_t sc_bst;
  71. int *sc_console; /* console path set to hil */
  72. struct proc *sc_thread; /* event handling thread */
  73. int sc_cmddone;
  74. int sc_cmdending;
  75. u_int sc_actdev; /* current input device */
  76. u_int sc_cmddev; /* device to perform command on */
  77. u_int8_t sc_pollbuf[HILBUFSIZE]; /* interrupt time input buf */
  78. u_int8_t sc_cmdbuf[HILBUFSIZE];
  79. u_int8_t *sc_pollbp; /* pointer into sc_pollbuf */
  80. u_int8_t *sc_cmdbp; /* pointer into sc_cmdbuf */
  81. int sc_status; /* initialization status */
  82. #define HIL_STATUS_BUSY 0x00
  83. #define HIL_STATUS_READY 0x01
  84. int sc_pending; /* reconfiguration events in progress */
  85. #define HIL_PENDING_RECONFIG 0x01
  86. #define HIL_PENDING_UNPLUGGED 0x02
  87. u_int sc_maxdev; /* number of devices on loop */
  88. struct hildev_softc *sc_devices[NHILD]; /* interrupt dispatcher */
  89. };
  90. #ifdef _KERNEL
  91. int send_hil_cmd(struct hil_softc *, u_int, u_int8_t *, u_int, u_int8_t *);
  92. int send_hildev_cmd(struct hildev_softc *, u_int, u_int8_t *, u_int *);
  93. void hil_set_poll(struct hil_softc *, int);
  94. int hil_poll_data(struct hildev_softc *, u_int8_t *, u_int8_t *);
  95. void hil_attach(struct hil_softc *, int *);
  96. void hil_attach_deferred(void *);
  97. int hil_intr(void *);
  98. int hildevprint(void *, const char *);
  99. #endif /* _KERNEL */