xref: /freebsd/sys/dev/scc/scc_if.m (revision 84ee9401a3fc8d3c22424266f421a928989cd692)
1#-
2# Copyright (c) 2004-2006 Marcel Moolenaar
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
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 WARRANTIES
17# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25#
26# $FreeBSD$
27
28#include <sys/param.h>
29#include <sys/bus.h>
30#include <machine/bus.h>
31#include <sys/lock.h>
32#include <sys/mutex.h>
33#include <sys/rman.h>
34#include <dev/scc/scc_bfe.h>
35
36# The SCC hardware interface. The core SCC code is hardware independent.
37# The details of the hardware are abstracted by the SCC hardware interface.
38
39INTERFACE scc;
40
41# attach() - attach hardware.
42# This method is called when the device is being attached. All resources
43# have been allocated. The intend of this method is to setup the hardware
44# for normal operation.
45# The reset parameter informs the hardware driver whether a full device
46# reset is allowed or not. This is important when one of the channels can
47# be used as system console and a hardware reset would disrupt output.
48METHOD int attach {
49	struct scc_softc *this;
50	int reset;
51};
52
53METHOD void iclear {
54	struct scc_softc *this;
55	struct scc_chan *chan;
56};
57
58# ipend() - query SCC for pending interrupts.
59# When an interrupt is signalled, the handler will call this method to find
60# out which of the interrupt sources needs attention. The handler will use
61# this information to dispatch service routines that deal with each of the
62# interrupt sources. An advantage of this approach is that it allows multi-
63# port drivers (like puc(4)) to query multiple devices concurrently and
64# service them on an interrupt priority basis. If the hardware cannot provide
65# the information reliably, it is free to service the interrupt and return 0,
66# meaning that no attention is required.
67METHOD int ipend {
68	struct scc_softc *this;
69}
70
71# probe() - detect hardware.
72# This method is called as part of the bus probe to make sure the
73# hardware exists. This function should also set the device description
74# to something that represents the hardware.
75METHOD int probe {
76	struct scc_softc *this;
77};
78