summaryrefslogtreecommitdiff
path: root/xpp/init_card_3_26
blob: 3f0757896985e4df516d1d01e189a66b8a7bf0fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#! /bin/sh
#
# Written by Oron Peled <oron@actcom.co.il>
# Copyright (C) 2006, Xorcom
#
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# See the file LICENSE in the top level of this tarball.
#

#
# $Id$
#
# Data format:
#	- A comment start with ';' or '#' until the end of line
#	- Blank lines are ignored
#	- Fields are whitespace separated (spaces or tabs)
#
# The fields are (in command line order):
#	1. SLIC select in decimal (range 0-7).
#	   31 is a special value which means ALL SLICS (only some registers
#	   accept settings for ALL SLICS).
#	2. Command word:
#		- RD	Read Direct register.
#		- RI	Read Indirect register.
#		- WD	Write Direct register.
#		- WI	Write Indirect register.
#	3. Register number in hexadecimal.
#	4. Low data byte in hexadecimal. (for WD and WI commands).
#	5. High data byte in hexadecimal. (for WI command only).
#
#

# ----------------------------------==== 8-channel FXS unit initialization ===-----------------------------------------

set -e

me=`basename $0`
INIT_DIR=`dirname $0`
XPP_BASE=/proc/xpp
export XPP_BASE
LOGGER="logger -s -t $me"

ZAPTEL_BOOT_DEBIAN=${ZAPTEL_BOOT_DEBIAN:-/etc/default/zaptel}
ZAPTEL_BOOT_FEDORA=${ZAPTEL_BOOT_FEDORA:-/etc/sysconfig/zaptel}

# read default configuration from /etc/default/zaptel
if [ -r $ZAPTEL_BOOT_DEBIAN ]; then . $ZAPTEL_BOOT_DEBIAN; fi
if [ -r $ZAPTEL_BOOT_FEDORA ]; then . $ZAPTEL_BOOT_FEDORA; fi

if [ "$DEBUG_CALIBRATION"=1 ]; then
	LOGGER=":"
fi

# Always redirect stderr somewhere, otherwise the shell script will die
# when it tries to do I/O related stuff on closed file descriptor.
# Our default is to throw it down the bit-bucket.
exec 2> /dev/console
## If you wish to trace this script:
#exec 2> /tmp/xpp_init_$XPD_NAME
## Altenativly, if you have multiple XBUS'es:
#exec 2> /tmp/xpp_init_$XBUS_NAME_$XPD_NAME
#set -x

# redirect script output to the "slics" (registers command) file:
exec 1> "$XPP_BASE/$XPD_BUS/$XPD_NAME/slics"

$LOGGER -p kern.info "$XPD_BUS/$XPD_NAME: Calibrating '$0'"

"$INIT_DIR/calibrate_slics"

$LOGGER -p kern.info "$XPD_BUS/$XPD_NAME: Continue '$0'"

echo "
# Change SLICs states to "Open state"s  (Off,all transfers tristated to avoid data collision), Voltage sense
31	WD	40	00

# Flush out energy accumulators
31	WI	58	00 00
31	WI	59	00 00
31	WI	5A	00 00
31	WI	5B	00 00
31	WI	5C	00 00
31	WI	5D	00 00
31	WI	5E	00 00
31	WI	5F	00 00
31	WI	61	00 00
31	WI	58	00 00
31	WI	C1	00 00
31	WI	C2	00 00
31	WI	C3	00 00
31	WI	C4	00 00
31	WI	C5	00 00
31	WI	C6	00 00
31	WI	C7	00 00
31	WI	C8	00 00
31	WI	C9	00 00
31	WI	CA	00 00
31	WI	CB	00 00
31	WI	CC	00 00
31	WI	CD	00 00
31	WI	CE	00 00
31	WI	CF	00 00
31	WI	D0	00 00
31	WI	D1	00 00
31	WI	D2	00 00
31	WI	D3	00 00

# Setting of SLICs offsets
# New card initialization
0	WD	02	00
0	WD	04	00
1	WD	02	08
1	WD	04	08
2	WD	02	10
2	WD	04	10
3	WD	02	18
3	WD	04	18
4	WD	02	20
4	WD	04	20
5	WD	02	28
5	WD	04	28
6	WD	02	30
6	WD	04	30
7	WD	02	38
7	WD	04	38
31	WD	03	00
31	WD	05	00

# Audio path. (also initialize 0A and 0B here if necessary)
31	WD	08 00
31	WD	09 00

31	WD	17 00

# Automatic/Manual Control: defaults - Cancel Power Alarm
31	WD	43 1E

# Loop Closure Debounce Interval
31	WD	45 0A

# Ring Detect Debounce Interval
31	WD	46 0B

# Battery Feed Control: Battery low (DCSW low)
31	WD	42 00

# Loop Current Limit
31	WD	47 00

31	WD	6C	01

31	WI	23	00 80
31	WI	24	20 03
31	WI	25	8C 08
31	WI	26	00 01
31	WI	27	10 00


# ------------------------------------- Initialization of direct registers --------------------------------------------

# Mode(8-bit,u-Law,1 PCLK ) setting, Loopbacks and Interrupts clear

31	WD	01	29
#31	WD	0E	00  

#31	WD	15 00
#31	WD	16 03

# Clear pending interrupts
31	WD	12 FF
31	WD	13 FF
31	WD	14 FF 

#31	WD	4A 34
#31	WD	4B 10
" | sed -e 's/[;#].*$//' -e '/^[ 	]*$/d' 

$LOGGER -p kern.info "$XPD_BUS/$XPD_NAME: Ending '$0'"
exit 0