1 /* $OpenBSD: if_art.h,v 1.5 2005/10/26 09:26:56 claudio Exp $ */
2
3 /*
4 * Copyright (c) 2005 Internet Business Solutions AG, Zurich, Switzerland
5 * Written by: Claudio Jeker <jeker@accoom.net>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 #ifndef __IF_ART_H__
21 #define __IF_ART_H__
22
23 #define MUSYCC_FRAMER_BT8370 0x8370
24
25 enum art_sbi_type {
26 ART_SBI_SINGLE,
27 ART_SBI_MASTER,
28 ART_SBI_SLAVE
29 };
30
31 struct art_softc {
32 struct device art_dev; /* generic device structures */
33 struct ebus_dev art_ebus; /* ebus attachement */
34 struct ifmedia art_ifm; /* interface media descriptor */
35 struct timeout art_onesec; /* onesec timeout */
36 struct musycc_softc *art_parent; /* parent hdlc controller */
37 struct channel_softc *art_channel; /* channel config */
38 void *art_linkstatehook;
39
40 u_int art_media; /* if_media media */
41 enum art_sbi_type art_type; /* System Bus Type */
42 u_int8_t art_gnum; /* group number */
43 u_int8_t art_port; /* port number */
44 char art_slot; /* TDM slot */
45 };
46
47 enum art_sbi_mode {
48 SBI_MODE_1536 = 1, /* 24TS */
49 SBI_MODE_1544, /* 24TS + F bit */
50 SBI_MODE_2048, /* 32TS */
51 SBI_MODE_4096_A, /* lower 32TS */
52 SBI_MODE_4096_B, /* upper 32TS */
53 SBI_MODE_8192_A, /* first 32TS */
54 SBI_MODE_8192_B, /* second 32TS */
55 SBI_MODE_8192_C, /* third 32TS */
56 SBI_MODE_8192_D /* last 32TS */
57 };
58
59 enum art_linecode {
60 ART_LIU_AMI, /* Alternate Mark Inversion */
61 ART_LIU_B8ZS, /* Bipolar 8-zero Substitution */
62 ART_LIU_HDB3 /* High Density Bipolar 3 */
63 };
64
65 enum art_loopback {
66 ART_NOLOOP, /* All Loopback disabled */
67 ART_RLOOP_PAYLOAD, /* Remote Payload Loopback */
68 ART_RLOOP_LINE, /* Remote Line Loopback */
69 ART_LLOOP_PAYLOAD, /* Local Payload Loopback */
70 ART_LLOOP_LINE /* Local Line Loopback */
71 };
72
73 #define ART_DL1_BOP 1
74 #define ART_BOP_ESF 1
75
76 int bt8370_reset(struct art_softc *);
77 int bt8370_set_frame_mode(struct art_softc *, enum art_sbi_type, u_int,
78 u_int);
79 void bt8370_intr_enable(struct art_softc *, int);
80 void bt8370_intr(struct art_softc *);
81 int bt8370_link_status(struct art_softc *);
82
83 #endif