Debian Codegraph @

drivers/dahdi/wcte12xp/wcte12xp.h

raw symbols SCIP
1 /*
2 * Digium, Inc. Wildcard TE12xP T1/E1 card Driver
3 *
4 * Written by Michael Spiceland <[email protected]>
5 *
6 * Adapted from the wctdm24xxp and wcte11xp drivers originally
7 * written by Mark Spencer <[email protected]>
8 * Matthew Fredrickson <[email protected]>
9 * William Meadows <[email protected]>
10 *
11 * Copyright (C) 2007-2010, Digium, Inc.
12 *
13 * All rights reserved.
14 *
15 */
16
17 /*
18 * See http://www.asterisk.org for more information about
19 * the Asterisk project. Please do not directly contact
20 * any of the maintainers of this project for assistance;
21 * the project provides a web site, mailing lists and IRC
22 * channels for your use.
23 *
24 * This program is free software, distributed under the terms of
25 * the GNU General Public License Version 2 as published by the
26 * Free Software Foundation. See the LICENSE file included with
27 * this program for more details.
28 */
29
30 #ifndef _WCTE12XP_H
31 #define _WCTE12XP_H
32
33 /* Comment to disable VPM support */
34 #define VPM_SUPPORT 1
35
36 #define WC_MAX_IFACES 8
37
38 #ifdef VPM_SUPPORT
39 #define MAX_TDM_CHAN 31
40 #endif
41
42 #define SDI_CLK (0x00010000)
43 #define SDI_DOUT (0x00020000)
44 #define SDI_DREAD (0x00040000)
45 #define SDI_DIN (0x00080000)
46
47 #define EFRAME_SIZE 108
48 #define ERING_SIZE 16 /* Maximum ring size */
49 #define EFRAME_GAP 20
50 #define SFRAME_SIZE ((EFRAME_SIZE * DAHDI_CHUNKSIZE) + (EFRAME_GAP * (DAHDI_CHUNKSIZE - 1)))
51
52 #define PCI_WINDOW_SIZE ((2 * 2 * 2 * SFRAME_SIZE) + (2 * ERING_SIZE * 4))
53
54 #define MAX_COMMANDS 16
55
56 #define NUM_EC 4
57
58 #define __CMD_PINS (1 << 18) /* CPLD pin read */
59 #define __CMD_LEDS (1 << 19) /* LED Operation */
60 #define __CMD_RD (1 << 20) /* Read Operation */
61 #define __CMD_WR (1 << 21) /* Write Operation */
62
63 #define __LED_ORANGE (1<<3)
64 #define __LED_GREEN (1<<2)
65 #define __LED_RED (1<<1)
66
67 #define SET_LED_ORANGE(a) (a | __LED_ORANGE)
68 #define SET_LED_RED(a) ((a | __LED_RED) & ~__LED_GREEN)
69 #define SET_LED_GREEN(a) ((a | __LED_GREEN) & ~__LED_RED)
70
71 #define UNSET_LED_ORANGE(a) (a & ~__LED_ORANGE)
72 #define UNSET_LED_REDGREEN(a) (a | __LED_RED | __LED_GREEN)
73
74 #define CMD_BYTE(slot, a, is_vpm) (slot*6)+(a*2)+is_vpm /* only even slots */
75 //TODO: make a separate macro
76
77 enum linemode {
78 T1 = 1,
79 E1,
80 J1,
81 };
82
83 struct command {
84 struct list_head node;
85 struct completion complete;
86 u8 data;
87 u8 ident;
88 u8 cs_slot;
89 u16 address;
90 u32 flags;
91 };
92
93 struct vpm150m;
94
95 struct t1 {
96 spinlock_t reglock;
97 unsigned char txident;
98 unsigned char rxident;
99 unsigned char statreg; /* bit 0 = vpmadt032 int */
100 struct {
101 unsigned int nmf:1;
102 unsigned int sendingyellow:1;
103 } flags;
104 unsigned char txsigs[16]; /* Copy of tx sig registers */
105 int alarmcount; /* How much red alarm we've seen */
106 int losalarmcount;
107 int aisalarmcount;
108 int yelalarmcount;
109 const char *variety;
110 char name[80];
111 unsigned long blinktimer;
112 int loopupcnt;
113 int loopdowncnt;
114 #define INITIALIZED 1
115 #define SHUTDOWN 2
116 #define READY 3
117 #define IOERROR 4
118 unsigned long bit_flags;
119 unsigned long alarmtimer;
120 unsigned char ledstate;
121 unsigned char vpm_check_count;
122 struct dahdi_device *ddev;
123 struct dahdi_span span; /* Span */
124 struct dahdi_chan *chans[32]; /* Channels */
125 struct dahdi_echocan_state *ec[32]; /* Echocan state for channels */
126 #ifdef CONFIG_VOICEBUS_ECREFERENCE
127 struct dahdi_fifo *ec_reference[32];
128 #else
129 unsigned char ec_chunk1[32][DAHDI_CHUNKSIZE];
130 unsigned char ec_chunk2[32][DAHDI_CHUNKSIZE];
131 #endif
132 unsigned long ctlreg;
133 struct voicebus vb;
134 atomic_t txints;
135 struct vpmadt032 *vpmadt032;
136 struct vpmoct *vpmoct;
137 unsigned long vpm_check;
138 struct work_struct vpm_check_work;
139
140 /* protected by t1.reglock */
141 struct list_head pending_cmds;
142 struct list_head active_cmds;
143 struct timer_list timer;
144 struct work_struct timer_work;
145 struct workqueue_struct *wq;
146 unsigned int not_ready; /* 0 when entire card is ready to go */
147 };
148
149 #define t1_info(t1, format, arg...) \
150 dev_info(&t1->vb.pdev->dev , format , ## arg)
151
152 #define t1_notice(t1, format, arg...) \
153 dev_notice(&t1->vb.pdev->dev , format , ## arg)
154
155 /* Maintenance Mode Registers */
156 #define LIM0 0x36
157 #define LIM0_LL (1<<1)
158 #define LIM1 0x37
159 #define LIM1_RL (1<<1)
160 #define LIM1_JATT (1<<2)
161
162 /* Clear Channel Registers */
163 #define CCB1 0x2f
164 #define CCB2 0x30
165 #define CCB3 0x31
166
167 #endif