Compare commits

..

2 Commits

Author SHA1 Message Date
Shaun Ruffell
a118a30248 Importing files for 2.5.0 release.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/tags/2.5.0@10090 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-05 18:00:51 +00:00
Shaun Ruffell
aeed6a0268 Creating tag for the release of dahdi-linux-2.5.0
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/tags/2.5.0@10089 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-05 17:59:47 +00:00
49 changed files with 4136 additions and 7631 deletions

View File

@@ -1 +1 @@
2.6.0-rc1
2.5.0

1000
ChangeLog

File diff suppressed because it is too large Load Diff

176
README
View File

@@ -17,7 +17,6 @@ Digital Cards
* Digium TE405P/TE407P/TE410P/TE412P: PCI quad-port T1/E1/J1
* Digium TE220: PCI-Express dual-port T1/E1/J1
* Digium TE420: PCI-Express quad-port T1/E1/J1
* Digium TE820: PCI-Express eight-port T1/E1/J1
- wcte12xp:
* Digium TE120P: PCI single-port T1/E1/J1
* Digium TE121: PCI-Express single-port T1/E1/J1
@@ -539,7 +538,6 @@ timing device it will hang forever in the first cycle. Otherwise it will just
give you in each cycle the percent of how close it was. Also try running it
with the option -v for a verbose output.
Spans and Channels
~~~~~~~~~~~~~~~~~~
DAHDI provides telephony *channels* to the userspace applications.
@@ -559,81 +557,6 @@ There are up to 128 spans and 1024 channels. This is a hard-wired limit
number fits in a 16 bits number). Channel and span numbers start at 1.
Span Assignments
~~~~~~~~~~~~~~~~
A DAHDI device (e.g. a PCI card) is represented within the DAHDI drivers
as a 'DAHDI device'. Normally (with auto_assign_spans=1 in the module
dahdi, which is the default), when a device is discovered and loaded,
it registers with the DAHDI core and its spans automatically become
available. However if you have more than one device, you may be
interested to set explicit spans and channels numbers for them. To use
manual span assigment, set 'auto_assign_spans' to 0 . e.g. in a file
under /etc/modprobe.d/ include the following line:
options dahdi auto_assign_spans=0
You will then need to assign the spans manually at device startup. You
will need to assign a span number and channel numbers for each
available span on the system. On my test system I have one BRI PCI card
and one Astribank BRI+FXS:
# grep . /sys/bus/dahdi_devices/devices/*/spantype
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:1:BRI
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:2:BRI
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:3:BRI
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:4:BRI
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:5:BRI
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:6:BRI
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:7:BRI
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:8:BRI
/sys/bus/dahdi_devices/devices/astribanks:xbus-00/spantype:9:FXS
/sys/bus/dahdi_devices/devices/pci:0000:00:09.0/spantype:1:TE
/sys/bus/dahdi_devices/devices/pci:0000:00:09.0/spantype:2:TE
/sys/bus/dahdi_devices/devices/pci:0000:00:09.0/spantype:3:NT
/sys/bus/dahdi_devices/devices/pci:0000:00:09.0/spantype:4:NT
All spans here, except the FXS one, are BRI spans with 3 channels per span.
In order to assign a span, we write three numbers separated by colns to
the file 'assign_span' in the SysFS node
local_num:span_num:base_chan_num
Thus:
echo 9:5:10 >/sys/bus/dahdi_devices/devices/astribanks:xbus-00/assign_span
echo 2:8:40 >/sys/bus/dahdi_devices/devices/pci:0000:00:09.0/assign_span
echo 1:1:1 >/sys/bus/dahdi_devices/devices/astribanks:xbus-00/assign_span
echo 4:6:20 >/sys/bus/dahdi_devices/devices/pci:0000:00:09.0/assign_span
echo 3:2:5 >/sys/bus/dahdi_devices/devices/astribanks:xbus-00/assign_span
As you can see, the order of span numbers or local span number is
insignificant. However the order of channel numbers must be the same as
that of span numbers.
Which indeed produced:
# head -n3 -q /proc/dahdi/*
Span 1: XBUS-00/XPD-00 "Xorcom XPD [usb:LAB-0003].1: BRI_NT"
1 XPP_BRI_NT/00/00/0
Span 2: XBUS-00/XPD-02 "Xorcom XPD [usb:LAB-0003].3: BRI_TE"
5 XPP_BRI_TE/00/02/0
Span 5: XBUS-00/XPD-10 "Xorcom XPD [usb:LAB-0003].9: FXS" (MASTER)
10 XPP_FXS/00/10/0
Span 6: B4/0/4 "B4XXP (PCI) Card 0 Span 4" RED
23 B4/0/4/1 YELLOW
Span 8: B4/0/2 "B4XXP (PCI) Card 0 Span 2" RED
40 B4/0/2/1 RED
Likewise spans can be unassigned by writing to the 'unassign-span'
"file".
Dynamic Spans
~~~~~~~~~~~~~
Dynamic spans are spans that are not represented by real hardware.
@@ -721,103 +644,6 @@ see an extra '(In use)':
2 XPP_FXS/0/0/1 FXOLS (In use)
SysFS Interface
~~~~~~~~~~~~~~~
DAHDI exposes several interfaces under the SysFS virtual file system.
SysFS represents kernel objects in nodes - directories. There properties
are often files. They may also contain other nodes or include symlinks
to other nodes.
Class DAHDI
^^^^^^^^^^^
under /sys/class/dadhi there exists a node for each DAHDI device file
under /dev/dahdi. The name is 'dahdi!foo' for the file '/dev/dahdi/foo'
(udev translates exclamation marks to slashes). Those nodes are not, for
the most part, proper SysFS nodes, and don't include any interesting
properties.
Devices Bus
^^^^^^^^^^^
Each DAHDI device (a physical device, such as a PCI card) is represented
by a node under /sys/bus/dahdi_devices/devices named with the name of
its device.
Its attributes include:
===== /sys/bus/dahdi_devices/devices/DEVICE/assgin-span
Write-only attribute: this device's spans should now be assigned
("registered"). See section about <<_span_assignments>>.
===== /sys/bus/dahdi_devices/devices/DEVICE/auto-assign
Write-only attribute. Spans in the device auto-assign ("register" as in
the original interface). See section about <<_span_assignments>>.
===== /sys/bus/dahdi_devices/devices/DEVICE/hardware_id
A unique hardware-level identifier (e.g. serial number), if available.
===== /sys/bus/dahdi_devices/devices/DEVICE/manufacturer
The name of the manufacturer. Freeform-string.
===== /sys/bus/dahdi_devices/devices/DEVICE/spantype
A line for each available span: <num>:<type>. This has to be provided
here as in the case of manual assignment, userspace may need to know
it before span nodes are created.
===== /sys/bus/dahdi_devices/devices/DEVICE/spantype
Device type.
===== /sys/bus/dahdi_devices/devices/DEVICE/unassign-span
Write-only attribute: the span whose device-local number is written
should now be unassigned ("unregistered"). See section about
<<_span_assignments>>.
Spans Bus
^^^^^^^^^
Each DAHDI span is represented by a node under
/sys/bus/dahdi_spans/devices with the name 'span-N' (where N is the
number of the span). Spans of each device also reside under the node of
the device.
Useful attributes in the span node:
===== /sys/bus/dahdi_spans/devices/span-N/alarms
The alarms of the span. Currently this is a numeric representation.
This may change in the future.
===== /sys/bus/dahdi_spans/devices/span-N/basechan
The channel number of the first channel. The channel numbers of the
following channels are guaranteed to follow it.
===== /sys/bus/dahdi_spans/devices/span-N/channels
The number of the channels in the span.
===== /sys/bus/dahdi_spans/devices/span-N/desc
A free-form description of the span.
===== /sys/bus/dahdi_spans/devices/span-N/is_digital
1 if the span is digital, 0 if it isn't.
===== /sys/bus/dahdi_spans/devices/span-N/is_sync_master
1 if the span is the sync master, 0 if it isn't.
===== /sys/bus/dahdi_spans/devices/span-N/lbo
LBO setting for the channel.
===== /sys/bus/dahdi_spans/devices/span-N/local_spanno
The number of the span within the DAHDI device.
===== /sys/bus/dahdi_spans/devices/span-N/name
A concise name for this span.
===== /sys/bus/dahdi_spans/devices/span-N/spantype
A very short type string.
===== /sys/bus/dahdi_spans/devices/span-N/syncsrc
Current sync source.
User-space Interface
~~~~~~~~~~~~~~~~~~~~
User-space programs can only work with DAHDI channels. The basic
@@ -895,7 +721,7 @@ standard HDLC rate of 64k).
Low-Level Drivers
~~~~~~~~~~~~~~~~~
Low-level drivers create spans ('struct dahdi_span'). They register the
spans with the DAHDI core using 'dahdi_device_register()'.
spans with the DAHDI core using 'dahdi_register()'.
'struct dahdi_span' has a number of informative members that are updated
solely by the low-level driver:

View File

@@ -293,10 +293,6 @@ load)
# TODO: A local copy of Asterisk, configured with dahdi_gnconf.
# doable, but trickier.
run_asterisk
if [ "$LIVE_DAHDI_FREEPBXDB" = 'yes' ]; then
GENCONF_PARAMETERS=$DESTDIR/etc/dahdi/genconf_parameters \
dahdi_genconf freepbxdb
fi
;;
genconf)
genconf

File diff suppressed because it is too large Load Diff

View File

@@ -49,311 +49,6 @@ static struct class_simple *dahdi_class = NULL;
#define class_destroy class_simple_destroy
#endif
/*
* Very old hotplug support
*/
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 9)
#define OLD_HOTPLUG_SUPPORT /* for older kernels */
#define OLD_HOTPLUG_SUPPORT_269
#endif
#ifdef OLD_HOTPLUG_SUPPORT_269
/* Copy from new kernels lib/kobject_uevent.c */
enum kobject_action {
KOBJ_ADD,
KOBJ_REMOVE,
KOBJ_CHANGE,
KOBJ_MOUNT,
KOBJ_UMOUNT,
KOBJ_OFFLINE,
KOBJ_ONLINE,
};
#endif
/*
* Hotplug replaced with uevent in 2.6.16
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
#define OLD_HOTPLUG_SUPPORT /* for older kernels */
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
#define DEVICE_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, struct device_attribute *attr,\
char *buf)
#define DEVICE_ATTR_WRITER(name, dev, buf, count) \
ssize_t name(struct device *dev, struct device_attribute *attr,\
const char *buf, size_t count)
#define BUS_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, struct device_attribute *attr, \
char *buf)
#define BUS_ATTR_WRITER(name, dev, buf, count) \
ssize_t name(struct device *dev, struct device_attribute *attr,\
const char *buf, size_t count)
#else
#define DEVICE_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, char *buf)
#define DEVICE_ATTR_WRITER(name, dev, buf, count) \
ssize_t name(struct device *dev, const char *buf, size_t count)
#define BUS_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, char *buf)
#define BUS_ATTR_WRITER(name, dev, buf, count) \
ssize_t name(struct device *dev, const char *buf, size_t count)
#endif
#define DRIVER_ATTR_READER(name, drv, buf) \
ssize_t name(struct device_driver *drv, char * buf)
static char *initdir = "/usr/share/dahdi";
module_param(initdir, charp, 0644);
static int span_match(struct device *dev, struct device_driver *driver)
{
return 1;
}
static inline struct dahdi_span *dev_to_span(struct device *dev)
{
return dev_get_drvdata(dev);
}
#ifdef OLD_HOTPLUG_SUPPORT
static int span_hotplug(struct device *dev, char **envp, int envnum,
char *buff, int bufsize)
{
struct dahdi_span *span;
if (!dev)
return -ENODEV;
span = dev_to_span(dev);
envp[0] = buff;
if (snprintf(buff, bufsize, "SPAN_NAME=%s", span->name) >= bufsize)
return -ENOMEM;
envp[1] = NULL;
return 0;
}
#else
#define SPAN_VAR_BLOCK \
do { \
DAHDI_ADD_UEVENT_VAR("DAHDI_INIT_DIR=%s", initdir); \
DAHDI_ADD_UEVENT_VAR("SPAN_NUM=%d", span->spanno); \
DAHDI_ADD_UEVENT_VAR("SPAN_NAME=%s", span->name); \
} while (0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
#define DAHDI_ADD_UEVENT_VAR(fmt, val...) \
do { \
int err = add_uevent_var(envp, num_envp, &i, \
buffer, buffer_size, &len, \
fmt, val); \
if (err) \
return err; \
} while (0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
#define dev_name(dev) ((dev)->bus_id)
#define dev_set_name(dev, format, ...) \
snprintf((dev)->bus_id, BUS_ID_SIZE, format, ## __VA_ARGS__);
#endif
static int span_uevent(struct device *dev, char **envp, int num_envp,
char *buffer, int buffer_size)
{
struct dahdi_span *span;
int i = 0;
int len = 0;
if (!dev)
return -ENODEV;
span = dev_to_span(dev);
if (!span)
return -ENODEV;
dahdi_dbg(GENERAL, "SYFS dev_name=%s span=%s\n",
dev_name(dev), span->name);
SPAN_VAR_BLOCK;
envp[i] = NULL;
return 0;
}
#else
#define DAHDI_ADD_UEVENT_VAR(fmt, val...) \
do { \
int err = add_uevent_var(kenv, fmt, val); \
if (err) \
return err; \
} while (0)
static int span_uevent(struct device *dev, struct kobj_uevent_env *kenv)
{
struct dahdi_span *span;
if (!dev)
return -ENODEV;
span = dev_to_span(dev);
if (!span)
return -ENODEV;
dahdi_dbg(GENERAL, "SYFS dev_name=%s span=%s\n",
dev_name(dev), span->name);
SPAN_VAR_BLOCK;
return 0;
}
#endif
#endif /* OLD_HOTPLUG_SUPPORT */
#define span_attr(field, format_string) \
static BUS_ATTR_READER(field##_show, dev, buf) \
{ \
struct dahdi_span *span; \
\
span = dev_to_span(dev); \
return sprintf(buf, format_string, span->field); \
}
span_attr(name, "%s\n");
span_attr(desc, "%s\n");
span_attr(spantype, "%s\n");
span_attr(alarms, "0x%x\n");
span_attr(lbo, "%d\n");
span_attr(syncsrc, "%d\n");
static BUS_ATTR_READER(local_spanno_show, dev, buf)
{
struct dahdi_span *span;
span = dev_to_span(dev);
return sprintf(buf, "%d\n", local_spanno(span));
}
static BUS_ATTR_READER(is_digital_show, dev, buf)
{
struct dahdi_span *span;
span = dev_to_span(dev);
return sprintf(buf, "%d\n", dahdi_is_digital_span(span));
}
static BUS_ATTR_READER(is_sync_master_show, dev, buf)
{
struct dahdi_span *span;
span = dev_to_span(dev);
return sprintf(buf, "%d\n", dahdi_is_sync_master(span));
}
static BUS_ATTR_READER(basechan_show, dev, buf)
{
struct dahdi_span *span;
span = dev_to_span(dev);
return sprintf(buf, "%d\n", span->chans[0]->channo);
}
static BUS_ATTR_READER(channels_show, dev, buf)
{
struct dahdi_span *span;
span = dev_to_span(dev);
return sprintf(buf, "%d\n", span->channels);
}
static struct device_attribute span_dev_attrs[] = {
__ATTR_RO(name),
__ATTR_RO(desc),
__ATTR_RO(spantype),
__ATTR_RO(local_spanno),
__ATTR_RO(alarms),
__ATTR_RO(lbo),
__ATTR_RO(syncsrc),
__ATTR_RO(is_digital),
__ATTR_RO(is_sync_master),
__ATTR_RO(basechan),
__ATTR_RO(channels),
__ATTR_NULL,
};
static struct driver_attribute dahdi_attrs[] = {
__ATTR_NULL,
};
static struct bus_type spans_bus_type = {
.name = "dahdi_spans",
.match = span_match,
#ifdef OLD_HOTPLUG_SUPPORT
.hotplug = span_hotplug,
#else
.uevent = span_uevent,
#endif
.dev_attrs = span_dev_attrs,
.drv_attrs = dahdi_attrs,
};
static int span_probe(struct device *dev)
{
struct dahdi_span *span;
span = dev_to_span(dev);
span_dbg(DEVICES, span, "\n");
return 0;
}
static int span_remove(struct device *dev)
{
struct dahdi_span *span;
span = dev_to_span(dev);
span_dbg(DEVICES, span, "\n");
return 0;
}
static struct device_driver dahdi_driver = {
.name = "generic_lowlevel",
.bus = &spans_bus_type,
.probe = span_probe,
.remove = span_remove,
#ifndef OLD_HOTPLUG_SUPPORT
.owner = THIS_MODULE
#endif
};
static void span_uevent_send(struct dahdi_span *span, enum kobject_action act)
{
struct kobject *kobj;
kobj = &span->span_device->kobj;
span_dbg(DEVICES, span, "SYFS dev_name=%s action=%d\n",
dev_name(span->span_device), act);
#if defined(OLD_HOTPLUG_SUPPORT_269)
{
/* Copy from new kernels lib/kobject_uevent.c */
static const char *const str[] = {
[KOBJ_ADD] "add",
[KOBJ_REMOVE] "remove",
[KOBJ_CHANGE] "change",
[KOBJ_MOUNT] "mount",
[KOBJ_UMOUNT] "umount",
[KOBJ_OFFLINE] "offline",
[KOBJ_ONLINE] "online"
};
kobject_hotplug(str[act], kobj);
}
#elif defined(OLD_HOTPLUG_SUPPORT)
kobject_hotplug(kobj, act);
#else
kobject_uevent(kobj, act);
#endif
}
static void span_release(struct device *dev)
{
dahdi_dbg(DEVICES, "%s: %s\n", __func__, dev_name(dev));
}
int dahdi_register_chardev(struct dahdi_chardev *dev)
{
@@ -383,15 +78,7 @@ EXPORT_SYMBOL(dahdi_unregister_chardev);
void span_sysfs_remove(struct dahdi_span *span)
{
struct device *span_device;
int x;
span_dbg(DEVICES, span, "\n");
span_device = span->span_device;
if (!span_device)
return;
for (x = 0; x < span->channels; x++) {
struct dahdi_chan *chan = span->chans[x];
if (!test_bit(DAHDI_FLAGBIT_DEVFILE, &chan->flags))
@@ -401,55 +88,13 @@ void span_sysfs_remove(struct dahdi_span *span)
MKDEV(DAHDI_MAJOR, chan->channo));
clear_bit(DAHDI_FLAGBIT_DEVFILE, &chan->flags);
}
if (!dev_get_drvdata(span_device))
return;
/* Grab an extra reference to the device since we'll still want it
* after we've unregistered it */
get_device(span_device);
span_uevent_send(span, KOBJ_OFFLINE);
device_unregister(span->span_device);
dev_set_drvdata(span_device, NULL);
span_device->parent = NULL;
put_device(span_device);
memset(&span->span_device, 0, sizeof(span->span_device));
kfree(span->span_device);
span->span_device = NULL;
}
int span_sysfs_create(struct dahdi_span *span)
{
struct device *span_device;
int res = 0;
int x;
if (span->span_device) {
WARN_ON(1);
return -EEXIST;
}
span->span_device = kzalloc(sizeof(*span->span_device), GFP_KERNEL);
if (!span->span_device)
return -ENOMEM;
span_device = span->span_device;
span_dbg(DEVICES, span, "\n");
span_device->bus = &spans_bus_type;
span_device->parent = &span->parent->dev;
dev_set_name(span_device, "span-%d", span->spanno);
dev_set_drvdata(span_device, span);
span_device->release = span_release;
res = device_register(span_device);
if (res) {
span_err(span, "%s: device_register failed: %d\n", __func__,
res);
kfree(span->span_device);
span->span_device = NULL;
goto cleanup;
}
for (x = 0; x < span->channels; x++) {
struct dahdi_chan *chan = span->chans[x];
char chan_name[32];
@@ -492,246 +137,10 @@ static struct {
unsigned int timer:1;
unsigned int channel:1;
unsigned int pseudo:1;
unsigned int sysfs_driver_registered:1;
unsigned int sysfs_spans_bus_type:1;
unsigned int dahdi_device_bus_registered:1;
} dummy_dev;
static inline struct dahdi_device *to_ddev(struct device *dev)
{
return container_of(dev, struct dahdi_device, dev);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t dahdi_device_manufacturer_show(struct device *dev, char *buf)
#else
static ssize_t
dahdi_device_manufacturer_show(struct device *dev,
struct device_attribute *attr, char *buf)
#endif
{
struct dahdi_device *ddev = to_ddev(dev);
return sprintf(buf, "%s\n", ddev->manufacturer);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t dahdi_device_type_show(struct device *dev, char *buf)
#else
static ssize_t
dahdi_device_type_show(struct device *dev,
struct device_attribute *attr, char *buf)
#endif
{
struct dahdi_device *ddev = to_ddev(dev);
return sprintf(buf, "%s\n", ddev->devicetype);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t dahdi_device_span_count_show(struct device *dev, char *buf)
#else
static ssize_t
dahdi_device_span_count_show(struct device *dev,
struct device_attribute *attr, char *buf)
#endif
{
struct dahdi_device *ddev = to_ddev(dev);
unsigned int count = 0;
struct list_head *pos;
list_for_each(pos, &ddev->spans)
++count;
return sprintf(buf, "%d\n", count);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t dahdi_device_hardware_id_show(struct device *dev, char *buf)
#else
static ssize_t
dahdi_device_hardware_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
#endif
{
struct dahdi_device *ddev = to_ddev(dev);
return sprintf(buf, "%s\n",
(ddev->hardware_id) ? ddev->hardware_id : "");
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t
dahdi_device_auto_assign(struct device *dev, const char *buf, size_t count)
#else
static ssize_t
dahdi_device_auto_assign(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
#endif
{
struct dahdi_device *ddev = to_ddev(dev);
dahdi_assign_device_spans(ddev);
return count;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t
dahdi_device_assign_span(struct device *dev, const char *buf, size_t count)
#else
static ssize_t
dahdi_device_assign_span(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
#endif
{
int ret;
struct dahdi_span *span;
unsigned int local_span_number;
unsigned int desired_spanno;
unsigned int desired_basechanno;
struct dahdi_device *const ddev = to_ddev(dev);
ret = sscanf(buf, "%u:%u:%u", &local_span_number, &desired_spanno,
&desired_basechanno);
if (ret != 3)
return -EINVAL;
if (desired_spanno && !desired_basechanno) {
dev_notice(dev, "Must set span number AND base chan number\n");
return -EINVAL;
}
list_for_each_entry(span, &ddev->spans, device_node) {
if (local_span_number == local_spanno(span)) {
ret = dahdi_assign_span(span, desired_spanno,
desired_basechanno, 1);
return (ret) ? ret : count;
}
}
dev_notice(dev, "no match for local span number %d\n", local_span_number);
return -EINVAL;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t
dahdi_device_unassign_span(struct device *dev, const char *buf, size_t count)
#else
static ssize_t
dahdi_device_unassign_span(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
#endif
{
int ret;
unsigned int local_span_number;
struct dahdi_span *span;
struct dahdi_device *const ddev = to_ddev(dev);
ret = sscanf(buf, "%u", &local_span_number);
if (ret != 1)
return -EINVAL;
ret = -ENODEV;
list_for_each_entry(span, &ddev->spans, device_node) {
if (local_span_number == local_spanno(span))
ret = dahdi_unassign_span(span);
}
if (-ENODEV == ret) {
if (printk_ratelimit()) {
dev_info(dev, "'%d' is an invalid local span number.\n",
local_span_number);
}
return -EINVAL;
}
return (ret < 0) ? ret : count;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t dahdi_spantype_show(struct device *dev, char *buf)
#else
static ssize_t
dahdi_spantype_show(struct device *dev,
struct device_attribute *attr, char *buf)
#endif
{
struct dahdi_device *ddev = to_ddev(dev);
int count = 0;
ssize_t total = 0;
struct dahdi_span *span;
/* TODO: Make sure this doesn't overflow the page. */
list_for_each_entry(span, &ddev->spans, device_node) {
count = sprintf(buf, "%d:%s\n", local_spanno(span), span->spantype);
buf += count;
total += count;
}
return total;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
static ssize_t
dahdi_spantype_store(struct device *dev, const char *buf, size_t count)
#else
static ssize_t
dahdi_spantype_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
#endif
{
struct dahdi_device *const ddev = to_ddev(dev);
int ret;
struct dahdi_span *span;
unsigned int local_span_number;
char desired_spantype[80];
ret = sscanf(buf, "%u:%70s", &local_span_number, desired_spantype);
if (ret != 2)
return -EINVAL;
list_for_each_entry(span, &ddev->spans, device_node) {
if (local_spanno(span) == local_span_number)
break;
}
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) {
module_printk(KERN_WARNING, "Span %s is already assigned.\n",
span->name);
return -EINVAL;
}
if (local_spanno(span) != local_span_number) {
module_printk(KERN_WARNING, "%d is not a valid local span number "
"for this device.\n", local_span_number);
return -EINVAL;
}
if (!span->ops->set_spantype) {
module_printk(KERN_WARNING, "Span %s does not support "
"setting type.\n", span->name);
return -EINVAL;
}
ret = span->ops->set_spantype(span, &desired_spantype[0]);
return (ret < 0) ? ret : count;
}
static struct device_attribute dahdi_device_attrs[] = {
__ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL),
__ATTR(type, S_IRUGO, dahdi_device_type_show, NULL),
__ATTR(span_count, S_IRUGO, dahdi_device_span_count_show, NULL),
__ATTR(hardware_id, S_IRUGO, dahdi_device_hardware_id_show, NULL),
__ATTR(auto_assign, S_IWUSR, NULL, dahdi_device_auto_assign),
__ATTR(assign_span, S_IWUSR, NULL, dahdi_device_assign_span),
__ATTR(unassign_span, S_IWUSR, NULL, dahdi_device_unassign_span),
__ATTR(spantype, S_IWUSR | S_IRUGO, dahdi_spantype_show,
dahdi_spantype_store),
__ATTR_NULL,
};
static struct bus_type dahdi_device_bus = {
.name = "dahdi_devices",
.dev_attrs = dahdi_device_attrs,
};
void dahdi_sysfs_exit(void)
{
dahdi_dbg(DEVICES, "SYSFS\n");
if (dummy_dev.pseudo) {
dahdi_dbg(DEVICES, "Removing /dev/dahdi/pseudo:\n");
DEL_DAHDI_DEV(DAHDI_PSEUDO);
@@ -757,60 +166,7 @@ void dahdi_sysfs_exit(void)
class_destroy(dahdi_class);
dahdi_class = NULL;
}
if (dummy_dev.sysfs_driver_registered) {
dahdi_dbg(DEVICES, "Unregister driver\n");
driver_unregister(&dahdi_driver);
dummy_dev.sysfs_driver_registered = 0;
}
if (dummy_dev.sysfs_spans_bus_type) {
dahdi_dbg(DEVICES, "Unregister span bus type\n");
bus_unregister(&spans_bus_type);
dummy_dev.sysfs_spans_bus_type = 0;
}
unregister_chrdev(DAHDI_MAJOR, "dahdi");
if (dummy_dev.dahdi_device_bus_registered) {
bus_unregister(&dahdi_device_bus);
dummy_dev.dahdi_device_bus_registered = 0;
}
}
static void dahdi_device_release(struct device *dev)
{
struct dahdi_device *ddev = container_of(dev, struct dahdi_device, dev);
kfree(ddev);
}
/**
* dahdi_sysfs_add_device - Add the dahdi_device into the sysfs hierarchy.
* @ddev: The device to add.
* @parent: The physical device that is implementing this device.
*
* By adding the dahdi_device to the sysfs hierarchy user space can control
* how spans are numbered.
*
*/
int dahdi_sysfs_add_device(struct dahdi_device *ddev, struct device *parent)
{
int ret;
struct device *const dev = &ddev->dev;
dev->parent = parent;
dev->bus = &dahdi_device_bus;
dev_set_name(dev, "%s:%s", parent->bus->name, dev_name(parent));
ret = device_add(dev);
return ret;
}
void dahdi_sysfs_init_device(struct dahdi_device *ddev)
{
device_initialize(&ddev->dev);
ddev->dev.release = dahdi_device_release;
}
void dahdi_sysfs_unregister_device(struct dahdi_device *ddev)
{
device_del(&ddev->dev);
}
int __init dahdi_sysfs_init(const struct file_operations *dahdi_fops)
@@ -818,12 +174,6 @@ int __init dahdi_sysfs_init(const struct file_operations *dahdi_fops)
int res = 0;
void *dev;
res = bus_register(&dahdi_device_bus);
if (res)
return res;
dummy_dev.dahdi_device_bus_registered = 1;
res = register_chrdev(DAHDI_MAJOR, "dahdi", dahdi_fops);
if (res) {
module_printk(KERN_ERR, "Unable to register DAHDI character device handler on %d\n", DAHDI_MAJOR);
@@ -870,20 +220,6 @@ int __init dahdi_sysfs_init(const struct file_operations *dahdi_fops)
goto cleanup;
}
dummy_dev.ctl = 1;
res = bus_register(&spans_bus_type);
if (res != 0) {
dahdi_err("%s: bus_register(%s) failed. Error number %d",
__func__, spans_bus_type.name, res);
goto cleanup;
}
dummy_dev.sysfs_spans_bus_type = 1;
res = driver_register(&dahdi_driver);
if (res < 0) {
dahdi_err("%s: driver_register(%s) failed. Error number %d",
__func__, dahdi_driver.name, res);
goto cleanup;
}
dummy_dev.sysfs_driver_registered = 1;
return 0;

View File

@@ -34,28 +34,4 @@ void span_sysfs_remove(struct dahdi_span *span);
int __init dahdi_sysfs_init(const struct file_operations *dahdi_fops);
void dahdi_sysfs_exit(void);
void dahdi_sysfs_init_device(struct dahdi_device *ddev);
int dahdi_sysfs_add_device(struct dahdi_device *ddev, struct device *parent);
void dahdi_sysfs_unregister_device(struct dahdi_device *ddev);
int dahdi_assign_span(struct dahdi_span *span, unsigned int spanno,
unsigned int basechan, int prefmaster);
int dahdi_unassign_span(struct dahdi_span *span);
int dahdi_assign_device_spans(struct dahdi_device *ddev);
static inline int get_span(struct dahdi_span *span)
{
return try_module_get(span->ops->owner);
}
static inline void put_span(struct dahdi_span *span)
{
module_put(span->ops->owner);
}
static inline int local_spanno(struct dahdi_span *span)
{
return span->offset + 1;
}
#endif /* _DAHDI_H */

View File

@@ -200,9 +200,16 @@ static void __dahdi_dynamic_run(void)
{
struct dahdi_dynamic *d;
struct dahdi_dynamic_driver *drv;
int y;
rcu_read_lock();
list_for_each_entry_rcu(d, &dspan_list, list) {
for (y = 0; y < d->span.channels; y++) {
struct dahdi_chan *const c = d->span.chans[y];
/* Echo cancel double buffered data */
dahdi_ec_chunk(c, c->readchunk, c->writechunk);
}
dahdi_receive(&d->span);
dahdi_transmit(&d->span);
/* Handle all transmissions now */
dahdi_dynamic_sendmessage(d);
@@ -363,9 +370,6 @@ void dahdi_dynamic_receive(struct dahdi_span *span, unsigned char *msg, int msgl
if (unlikely(rxpos != rxcnt))
printk(KERN_NOTICE "Span %s: Expected seq no %d, but received %d instead\n", span->name, rxcnt, rxpos);
dahdi_ec_span(span);
dahdi_receive(span);
/* If this is our master span, then run everything */
if (master)
dahdi_dynamic_run();
@@ -400,7 +404,6 @@ static void dahdi_dynamic_release(struct kref *kref)
for (x = 0; x < d->span.channels; x++)
kfree(d->chans[x]);
dahdi_free_device(d->ddev);
kfree(d);
}
@@ -470,7 +473,7 @@ static int _destroy_dynamic(struct dahdi_dynamic_span *dds)
return -EBUSY;
}
dahdi_unregister_device(d->ddev);
dahdi_unregister(&d->span);
spin_lock_irqsave(&dspan_lock, flags);
list_del_rcu(&d->list);
@@ -579,8 +582,8 @@ static int _create_dynamic(struct dahdi_dynamic_span *dds)
d = kzalloc(sizeof(*d), GFP_KERNEL);
if (!d)
return -ENOMEM;
kref_init(&d->kref);
d->ddev = dahdi_create_device();
for (x = 0; x < dds->numchans; x++) {
d->chans[x] = kzalloc(sizeof(*d->chans[x]), GFP_KERNEL);
@@ -658,9 +661,8 @@ static int _create_dynamic(struct dahdi_dynamic_span *dds)
return res;
}
list_add_tail(&d->span.device_node, &d->ddev->spans);
/* Whee! We're created. Now register the span */
if (dahdi_register_device(d->ddev, d->dev)) {
if (dahdi_register(&d->span, 0)) {
printk(KERN_NOTICE "Unable to register span '%s'\n",
d->span.name);
dynamic_put(d);
@@ -771,7 +773,7 @@ void dahdi_dynamic_unregister_driver(struct dahdi_dynamic_driver *dri)
WARN_ON(1);
}
}
dahdi_unregister_device(d->ddev);
dahdi_unregister(&d->span);
spin_lock_irqsave(&dspan_lock, flags);
list_del_rcu(&d->list);
spin_unlock_irqrestore(&dspan_lock, flags);

View File

@@ -24,16 +24,14 @@
OCT6114_064_VERSION:=1.05.01
OCT6114_128_VERSION:=1.05.01
OCT6114_256_VERSION:=1.05.01
TC400M_VERSION:=MR6.12
VPMADT032_VERSION:=1.25.0
HX8_VERSION:=2.06
VPMOCT032_VERSION:=1.12.0
WCT820_VERSION:=1.76
VPMOCT032_VERSION:=1.8.0
FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-OCT6114-256 FIRMWARE-TC400M FIRMWARE-HX8 FIRMWARE-VPMOCT032 FIRMWARE-TE820
ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-TC400M FIRMWARE-HX8 FIRMWARE-VPMOCT032
# Firmware files should use the naming convention: dahdi-fw-<base name>-<sub name>-<version> or dahdi-fw-<base name>-<version>
# First example: dahdi-fw-oct6114-064-1.05.01
@@ -44,18 +42,15 @@ ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-OCT6114-256 FIRM
# Build a list of firmware package filenames we need
FIRMWARE:=$(ALL_FIRMWARE:FIRMWARE-OCT6114-064=dahdi-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-OCT6114-128=dahdi-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-OCT6114-256=dahdi-fw-oct6114-256-$(OCT6114_256_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-TC400M=dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-HX8=dahdi-fw-hx8-$(HX8_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-VPMOCT032=dahdi-fw-vpmoct032-$(VPMOCT032_VERSION).tar.gz)
FIRMWARE:=$(FIRMWARE:FIRMWARE-TE820=dahdi-fw-te820-$(WCT820_VERSION).tar.gz)
FWLOADERS:=dahdi-fwload-vpmadt032-$(VPMADT032_VERSION).tar.gz
# Build a list of object files if hotplug will not be used
OBJECT_FILES:=$(ALL_FIRMWARE:FIRMWARE-OCT6114-064=dahdi-fw-oct6114-064.o)
OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCT6114-128=dahdi-fw-oct6114-128.o)
OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCT6114-256=dahdi-fw-oct6114-256.o)
OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-TC400M=dahdi-fw-tc400m.o)
OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-HX8=dahdi-fw-hx8.o)
@@ -128,17 +123,6 @@ ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-12
else
@echo "Firmware dahdi-fw-oct6114-128.bin is already installed with required version $(OCT6114_128_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-256-$(OCT6114_256_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-256-$(OCT6114_256_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-oct6114-256.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-oct6114-256.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-256-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-oct6114-256-$(OCT6114_256_VERSION)
@install -m 644 dahdi-fw-oct6114-256.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-256-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-oct6114-256-$(OCT6114_256_VERSION)
else
@echo "Firmware dahdi-fw-oct6114-256.bin is already installed with required version $(OCT6114_256_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-tc400m-$(TC400M_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-tc400m.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-tc400m.bin $(DESTDIR)/usr/lib/hotplug/firmware
@@ -172,17 +156,6 @@ ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-vpmoct032-
else
@echo "Firmware dahdi-fw-vpmoct032.bin is already installed with required version $(VPMOCT032_VERSION)"
endif
ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te820-$(WCT820_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.dahdi-fw-te820-$(WCT820_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes)
@echo "Installing dahdi-fw-te820.bin to hotplug firmware directories"
@install -m 644 dahdi-fw-te820.bin $(DESTDIR)/usr/lib/hotplug/firmware
@rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te820-*
@touch $(DESTDIR)/usr/lib/hotplug/firmware/.dahdi-fw-te820-$(WCT820_VERSION)
@install -m 644 dahdi-fw-te820.bin $(DESTDIR)/lib/firmware
@rm -rf $(DESTDIR)/lib/firmware/.dahdi-fw-te820-*
@touch $(DESTDIR)/lib/firmware/.dahdi-fw-te820-$(WCT820_VERSION)
else
@echo "Firmware dahdi-fw-te820.bin is already installed with required version $(WCT820_VERSION)"
endif
# Uninstall any installed dahdi firmware images from hotplug firmware directories
hotplug-uninstall:
@@ -211,11 +184,6 @@ dahdi-fw-oct6114-128.o: dahdi-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz dahdi
@echo Making firmware object file for dahdi-fw-oct6114-128.bin
./make_firmware_object dahdi-fw-oct6114-128.bin $@
# Build object file of an oct6114 256 firmware image for linking
dahdi-fw-oct6114-256.o: dahdi-fw-oct6114-256-$(OCT6114_256_VERSION).tar.gz dahdi-fw-oct6114-256.bin make_firmware_object
@echo Making firmware object file for dahdi-fw-oct6114-256.bin
./make_firmware_object dahdi-fw-oct6114-256.bin $@
# Build object file of a TC400M firmware image for linking
dahdi-fw-tc400m.o: dahdi-fw-tc400m-$(TC400M_VERSION).tar.gz dahdi-fw-tc400m.bin make_firmware_object
@echo Making firmware object file for dahdi-fw-tc400m.bin

View File

@@ -397,7 +397,7 @@ $Octasic_Revision: 171 $
/* Max defines.*/
#ifndef cOCT6100_MAX_ECHO_CHANNELS
#define cOCT6100_MAX_ECHO_CHANNELS 256
#define cOCT6100_MAX_ECHO_CHANNELS 128
#endif
#define cOCT6100_MAX_TSI_CNCTS 1530
#define cOCT6100_MAX_CALLER_ID_PLAYOUT_BUFFERS ( 3328 + 6 )

View File

@@ -146,7 +146,6 @@ struct encdec
struct pciradio {
struct pci_dev *dev;
struct dahdi_device *ddev;
struct dahdi_span span;
unsigned char ios;
int usecount;
@@ -1489,7 +1488,7 @@ static int pciradio_initialize(struct pciradio *rad)
rad->span.flags = DAHDI_FLAG_RBS;
rad->span.ops = &pciradio_span_ops;
if (dahdi_register_device(rad->ddev, &rad->dev->dev)) {
if (dahdi_register(&rad->span, 0)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
}
@@ -1778,7 +1777,7 @@ static int __devinit pciradio_init_one(struct pci_dev *pdev, const struct pci_de
release_region(rad->ioaddr, 0xff);
pci_free_consistent(pdev, DAHDI_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)rad->writechunk, rad->writedma);
pci_set_drvdata(pdev, NULL);
dahdi_free_device(rad->ddev);
dahdi_unregister(&rad->span);
kfree(rad);
return -EIO;
@@ -1811,7 +1810,7 @@ static int __devinit pciradio_init_one(struct pci_dev *pdev, const struct pci_de
static void pciradio_release(struct pciradio *rad)
{
dahdi_unregister_device(rad->ddev);
dahdi_unregister(&rad->span);
if (rad->freeregion)
release_region(rad->ioaddr, 0xff);
kfree(rad);

View File

@@ -97,7 +97,6 @@ struct tor2 {
unsigned long xilinx8_region; /* 8 bit Region allocated to Xilinx */
unsigned long xilinx8_len; /* Length of 8 bit Xilinx region */
__iomem volatile unsigned char *mem8; /* Virtual representation of 8 bit Xilinx memory area */
struct dahdi_device *ddev;
struct tor2_span tspans[SPANS_PER_CARD]; /* Span data */
struct dahdi_chan **chans[SPANS_PER_CARD]; /* Pointers to card channels */
struct tor2_chan tchans[32 * SPANS_PER_CARD]; /* Channel user data */
@@ -286,6 +285,10 @@ static void init_spans(struct tor2 *tor)
snprintf(s->desc, sizeof(s->desc) - 1,
"Tormenta 2 (PCI) Quad %s Card %d Span %d",
(tor->cardtype == TYPE_T1) ? "T1" : "E1", tor->num, x + 1);
s->manufacturer = "Digium";
strlcpy(s->devicetype, tor->type, sizeof(s->devicetype));
snprintf(s->location, sizeof(s->location) - 1,
"PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1);
if (tor->cardtype == TYPE_T1) {
s->channels = 24;
s->deflaw = DAHDI_LAW_MULAW;
@@ -319,31 +322,19 @@ static void init_spans(struct tor2 *tor)
static int __devinit tor2_launch(struct tor2 *tor)
{
int res;
struct dahdi_span *s;
int i;
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->tspans[0].dahdi_span.flags))
return 0;
tor->ddev = dahdi_create_device();
tor->ddev->location = kasprintf(GFP_KERNEL, "PCI Bus %02d Slot %02d",
tor->pci->bus->number,
PCI_SLOT(tor->pci->devfn) + 1);
if (!tor->ddev->location)
return -ENOMEM;
printk(KERN_INFO "Tor2: Launching card: %d\n", tor->order);
for (i = 0; i < SPANS_PER_CARD; ++i) {
s = &tor->tspans[i].dahdi_span;
list_add_tail(&s->device_node, &tor->ddev->spans);
}
res = dahdi_register_device(tor->ddev, &tor->pci->dev);
if (res) {
dev_err(&tor->pci->dev, "Unable to register with DAHDI.\n");
return res;
if (dahdi_register(s, 0)) {
printk(KERN_ERR "Unable to register span %s\n", s->name);
goto error_exit;
}
}
writew(PLX_INTENA, &tor->plx[INTCSR]); /* enable PLX interrupt */
@@ -351,6 +342,14 @@ static int __devinit tor2_launch(struct tor2 *tor)
tasklet_init(&tor->tor2_tlet, tor2_tasklet, (unsigned long)tor);
#endif
return 0;
error_exit:
for (i = 0; i < SPANS_PER_CARD; ++i) {
s = &tor->tspans[i].dahdi_span;
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &s->flags))
dahdi_unregister(s);
}
return -1;
}
static void free_tor(struct tor2 *tor)
@@ -366,8 +365,6 @@ static void free_tor(struct tor2 *tor)
if (tor->chans[x])
kfree(tor->chans[x]);
}
kfree(tor->ddev->location);
dahdi_free_device(tor->ddev);
kfree(tor);
}
@@ -634,6 +631,7 @@ static struct pci_driver tor2_driver;
static void __devexit tor2_remove(struct pci_dev *pdev)
{
struct tor2 *tor;
int i;
tor = pci_get_drvdata(pdev);
if (!tor)
@@ -643,7 +641,11 @@ static void __devexit tor2_remove(struct pci_dev *pdev)
writeb(0, &tor->mem8[LEDREG]);
writew(0, &tor->plx[INTCSR]);
free_irq(tor->irq, tor);
dahdi_unregister_device(tor->ddev);
for (i = 0; i < SPANS_PER_CARD; ++i) {
struct dahdi_span *s = &tor->tspans[i].dahdi_span;
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &s->flags))
dahdi_unregister(s);
}
release_mem_region(tor->plx_region, tor->plx_len);
release_mem_region(tor->xilinx32_region, tor->xilinx32_len);
release_mem_region(tor->xilinx8_region, tor->xilinx8_len);

View File

@@ -126,8 +126,8 @@ static int vpmadt032_getreg_full_return(struct vpmadt032 *vpm, int pagechange,
unsigned long ret;
BUG_ON(!cmd);
/* We'll wait for 2s */
ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
/* We'll wait for 200ms */
ret = wait_for_completion_timeout(&cmd->complete, HZ/5);
if (unlikely(!ret)) {
spin_lock_irqsave(&vpm->list_lock, flags);
list_del(&cmd->node);

View File

@@ -1683,7 +1683,6 @@ vb_isr(int irq, void *dev_id)
#endif
{
struct voicebus *vb = dev_id;
unsigned long flags;
u32 int_status;
int_status = __vb_getctl(vb, SR_CSR5);
@@ -1694,8 +1693,6 @@ vb_isr(int irq, void *dev_id)
if (!int_status)
return IRQ_NONE;
local_irq_save(flags);
if (unlikely((int_status &
(TX_UNAVAILABLE_INTERRUPT|RX_UNAVAILABLE_INTERRUPT)) &&
!test_bit(VOICEBUS_STOP, &vb->flags) &&
@@ -1736,7 +1733,6 @@ vb_isr(int irq, void *dev_id)
/* Clear the interrupt(s) */
__vb_setctl(vb, SR_CSR5, int_status);
}
local_irq_restore(flags);
return IRQ_HANDLED;
}
@@ -1885,7 +1881,7 @@ __voicebus_init(struct voicebus *vb, const char *board_name,
goto cleanup;
#if !defined(CONFIG_VOICEBUS_TIMER)
retval = request_irq(vb->pdev->irq, vb_isr, DAHDI_IRQ_SHARED,
retval = request_irq(vb->pdev->irq, vb_isr, DAHDI_IRQ_SHARED_DISABLED,
board_name, vb);
if (retval) {
dev_warn(&vb->pdev->dev, "Failed to request interrupt line.\n");
@@ -2030,7 +2026,7 @@ static int __init voicebus_module_init(void)
* defined, but it will make sure that this module is a dependency of
* dahdi.ko, so that when it is being unloded, this module will be
* unloaded as well. */
dahdi_register_device(NULL, NULL);
dahdi_register(NULL, 0);
spin_lock_init(&loader_list_lock);
return 0;
}

View File

@@ -35,16 +35,22 @@
#ifdef VOICEBUS_NET_DEBUG
#ifdef HAVE_NETDEV_PRIV
struct voicebus_netdev_priv {
struct voicebus *vb;
};
#endif
static inline struct voicebus *
voicebus_from_netdev(struct net_device *netdev)
{
#ifdef HAVE_NETDEV_PRIV
struct voicebus_netdev_priv *priv;
priv = netdev_priv(netdev);
return priv->vb;
#else
return netdev->priv;
#endif
}
static void *
@@ -203,14 +209,23 @@ int vb_net_register(struct voicebus *vb, const char *board_name)
{
int res;
struct net_device *netdev;
# ifdef HAVE_NETDEV_PRIV
struct voicebus_netdev_priv *priv;
# endif
const char our_mac[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
# ifdef HAVE_NETDEV_PRIV
netdev = alloc_netdev(sizeof(*priv), board_name, ether_setup);
if (!netdev)
return -ENOMEM;
priv = netdev_priv(netdev);
priv->vb = vb;
# else
netdev = alloc_netdev(0, vb->board_name, ether_setup);
if (!netdev)
return -ENOMEM;
netdev->priv = vb;
# endif
memcpy(netdev->dev_addr, our_mac, sizeof(our_mac));
# ifdef HAVE_NET_DEVICE_OPS
netdev->netdev_ops = &vb_netdev_ops;

View File

@@ -72,7 +72,7 @@ static int _vpmoct_read(struct vpmoct *vpm, u8 address,
list_del(&cmd->node);
spin_unlock_irqrestore(&vpm->list_lock, flags);
kfree(cmd);
dev_err(vpm->dev, "vpmoct_read_byte cmd timed out\n");
dev_err(vpm->dev, "vpmoct_read_byte cmd timed out :O(\n");
return 0;
}

View File

@@ -2205,7 +2205,7 @@ static const char *b4xxp_echocan_name(const struct dahdi_chan *chan)
{
struct b4xxp_span *bspan = container_of(chan->span, struct b4xxp_span,
span);
if (vpmsupport && (B410P == bspan->parent->card_type))
if (bspan->parent->card_type == B410P)
return "LASVEGAS2";
return NULL;
}
@@ -2475,6 +2475,7 @@ static void init_spans(struct b4xxp *b4)
bspan = &b4->spans[i];
bspan->parent = b4;
bspan->span.irq = b4->pdev->irq;
bspan->span.spantype = (bspan->te_mode) ? "TE" : "NT";
bspan->span.offset = i;
bspan->span.channels = WCB4XXP_CHANNELS_PER_SPAN;
@@ -2493,6 +2494,11 @@ static void init_spans(struct b4xxp *b4)
sprintf(bspan->span.name, "B4/%d/%d", b4->cardno, i+1);
sprintf(bspan->span.desc, "B4XXP (PCI) Card %d Span %d", b4->cardno, i+1);
bspan->span.manufacturer = "Digium";
strlcpy(bspan->span.devicetype, b4->variety,
sizeof(bspan->span.devicetype));
sprintf(bspan->span.location, "PCI Bus %02d Slot %02d",
b4->pdev->bus->number, PCI_SLOT(b4->pdev->devfn) + 1);
bspan->span.ops = &b4xxp_span_ops;
/* HDLC stuff */
@@ -2924,27 +2930,14 @@ static int __devinit b4xx_probe(struct pci_dev *pdev, const struct pci_device_id
hfc_init_all_st(b4);
/* initialize the DAHDI structures, and let DAHDI know it has some new hardware to play with */
b4->ddev = dahdi_create_device();
init_spans(b4);
for (x=0; x < b4->numspans; x++) {
struct dahdi_span *const s = &b4->spans[x].span;
list_add_tail(&s->device_node, &b4->ddev->spans);
}
b4->ddev->manufacturer = "Digium";
b4->ddev->devicetype = b4->variety;
b4->ddev->location = kasprintf(GFP_KERNEL, "PCI Bus %02d Slot %02d",
b4->pdev->bus->number,
PCI_SLOT(b4->pdev->devfn) + 1);
if (!b4->ddev->location) {
ret = -ENOMEM;
goto err_out_del_from_card_array;
}
if (dahdi_register_device(b4->ddev, &b4->pdev->dev)) {
dev_err(&b4->pdev->dev, "Unable to register device.\n");
goto err_out_unreg_spans;
if (dahdi_register(&b4->spans[x].span, 0)) {
dev_err(&b4->pdev->dev,
"Unable to register span %s\n",
b4->spans[x].span.name);
goto err_out_unreg_spans;
}
}
@@ -2980,7 +2973,10 @@ static int __devinit b4xx_probe(struct pci_dev *pdev, const struct pci_device_id
/* 'x' will have the failing span #. (0-3). We need to unregister everything before it. */
err_out_unreg_spans:
dahdi_unregister_device(b4->ddev);
while (x) {
dahdi_unregister(&b4->spans[x].span);
x--;
};
b4xxp_init_stage1(b4); /* full reset, re-init to "no-irq" state */
free_irq(pdev->irq, b4);
@@ -3001,8 +2997,6 @@ err_out_free_mem:
pci_set_drvdata(pdev, NULL);
pci_iounmap(pdev, b4->ioaddr);
pci_iounmap(pdev, b4->addr);
kfree(b4->ddev->location);
dahdi_free_device(b4->ddev);
kfree(b4);
err_out_release_regions:
@@ -3017,11 +3011,14 @@ err_out_disable_pdev:
static void __devexit b4xxp_remove(struct pci_dev *pdev)
{
struct b4xxp *b4 = pci_get_drvdata(pdev);
int i;
if (b4) {
b4->shutdown = 1;
dahdi_unregister_device(b4->ddev);
for (i=b4->numspans - 1; i >= 0; i--) {
dahdi_unregister(&b4->spans[i].span);
}
b4xxp_init_stage1(b4);
remove_sysfs_files(b4);
@@ -3036,8 +3033,6 @@ static void __devexit b4xxp_remove(struct pci_dev *pdev)
tasklet_kill(&b4->b4xxp_tlet);
kfree(b4->ddev->location);
dahdi_free_device(b4->ddev);
kfree(b4);
}

View File

@@ -474,7 +474,6 @@ struct b4xxp {
/* Flags for our bottom half */
unsigned int shutdown; /* 1=bottom half doesn't process anything, just returns */
struct tasklet_struct b4xxp_tlet;
struct dahdi_device *ddev;
};
/* CPLD access bits */

View File

@@ -135,7 +135,6 @@ static int wecareregs[] =
struct wcfxo {
struct pci_dev *dev;
char *variety;
struct dahdi_device *ddev;
struct dahdi_span span;
struct dahdi_chan _chan;
struct dahdi_chan *chan;
@@ -648,24 +647,19 @@ static const struct dahdi_span_ops wcfxo_span_ops = {
static int wcfxo_initialize(struct wcfxo *wc)
{
wc->ddev = dahdi_create_device();
/* DAHDI stuff */
sprintf(wc->span.name, "WCFXO/%d", wc->pos);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Board %d", wc->variety, wc->pos + 1);
sprintf(wc->chan->name, "WCFXO/%d/%d", wc->pos, 0);
wc->ddev->location = kasprintf(GFP_KERNEL, "PCI Bus %02d Slot %02d",
wc->dev->bus->number,
PCI_SLOT(wc->dev->devfn) + 1);
if (!wc->ddev->location)
return -ENOMEM;
wc->ddev->manufacturer = "Digium";
wc->ddev->devicetype = wc->variety;
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.manufacturer = "Digium";
strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
wc->chan->sigcap = DAHDI_SIG_FXSKS | DAHDI_SIG_FXSLS | DAHDI_SIG_SF;
wc->chan->chanpos = 1;
wc->span.chans = &wc->chan;
wc->span.channels = 1;
wc->span.irq = wc->dev->irq;
wc->span.flags = DAHDI_FLAG_RBS;
wc->span.deflaw = DAHDI_LAW_MULAW;
#ifdef ENABLE_TASKLETS
@@ -674,8 +668,7 @@ static int wcfxo_initialize(struct wcfxo *wc)
wc->chan->pvt = wc;
wc->span.ops = &wcfxo_span_ops;
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
if (dahdi_register(&wc->span, 0)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
}
@@ -983,7 +976,7 @@ static int __devinit wcfxo_init_one(struct pci_dev *pdev, const struct pci_devic
printk(KERN_NOTICE "Failed to initailize DAA, giving up...\n");
wcfxo_stop_dma(wc);
wcfxo_disable_interrupts(wc);
dahdi_unregister_device(wc->ddev);
dahdi_unregister(&wc->span);
free_irq(pdev->irq, wc);
/* Reset PCI chip and registers */
@@ -991,8 +984,6 @@ static int __devinit wcfxo_init_one(struct pci_dev *pdev, const struct pci_devic
if (wc->freeregion)
release_region(wc->ioaddr, 0xff);
kfree(wc->ddev->location);
dahdi_free_device(wc->ddev);
kfree(wc);
return -EIO;
}
@@ -1004,11 +995,9 @@ static int __devinit wcfxo_init_one(struct pci_dev *pdev, const struct pci_devic
static void wcfxo_release(struct wcfxo *wc)
{
dahdi_unregister_device(wc->ddev);
dahdi_unregister(&wc->span);
if (wc->freeregion)
release_region(wc->ioaddr, 0xff);
kfree(wc->ddev->location);
dahdi_free_device(wc->ddev);
kfree(wc);
printk(KERN_INFO "Freed a Wildcard\n");
}

View File

@@ -159,7 +159,6 @@ struct t1xxp {
unsigned char ec_chunk2[31][DAHDI_CHUNKSIZE];
unsigned char tempo[32];
struct dahdi_span span; /* Span */
struct dahdi_device *ddev;
struct dahdi_chan *chans[31]; /* Channels */
};
@@ -273,11 +272,10 @@ static void t1xxp_release(struct t1xxp *wc)
{
unsigned int x;
dahdi_unregister_device(wc->ddev);
dahdi_unregister(&wc->span);
for (x = 0; x < (wc->ise1 ? 31 : 24); x++) {
kfree(wc->chans[x]);
}
dahdi_free_device(wc->ddev);
kfree(wc);
printk(KERN_INFO "Freed a Wildcard\n");
}
@@ -772,20 +770,14 @@ static int t1xxp_software_init(struct t1xxp *wc)
}
if (x >= WC_MAX_CARDS)
return -1;
wc->ddev = dahdi_create_device();
wc->num = x;
sprintf(wc->span.name, "WCT1/%d", wc->num);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, wc->num);
wc->ddev->manufacturer = "Digium";
wc->ddev->devicetype = wc->variety;
wc->ddev->location = kasprintf(GFP_KERNEL, "PCI Bus %02d Slot %02d",
wc->dev->bus->number,
PCI_SLOT(wc->dev->devfn) + 1);
if (!wc->ddev->location)
return -ENOMEM;
wc->span.manufacturer = "Digium";
strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.irq = wc->dev->irq;
wc->span.chans = wc->chans;
wc->span.flags = DAHDI_FLAG_RBS;
if (wc->ise1) {
@@ -809,8 +801,7 @@ static int t1xxp_software_init(struct t1xxp *wc)
wc->chans[x]->chanpos = x + 1;
}
wc->span.ops = &t1xxp_span_ops;
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
if (dahdi_register(&wc->span, 0)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
}
@@ -917,10 +908,10 @@ static void t1xxp_receiveprep(struct t1xxp *wc, int ints)
if (((oldcan & 0xffff0000) >> 16) != CANARY) {
/* Check top part */
if (debug) printk(KERN_DEBUG "Expecting top %04x, got %04x\n", CANARY, (oldcan & 0xffff0000) >> 16);
wc->ddev->irqmisses++;
wc->span.irqmisses++;
} else if ((oldcan & 0xffff) != ((wc->canary - 1) & 0xffff)) {
if (debug) printk(KERN_DEBUG "Expecting bottom %d, got %d\n", wc->canary - 1, oldcan & 0xffff);
wc->ddev->irqmisses++;
wc->span.irqmisses++;
}
for (y=0;y<DAHDI_CHUNKSIZE;y++) {
for (x=0;x<wc->span.channels;x++) {

View File

@@ -17,7 +17,7 @@ endif
wct4xxp-objs := base.o vpm450m.o $(shell $(src)/../oct612x/octasic-helper objects ../oct612x)
ifneq ($(HOTPLUG_FIRMWARE),yes)
wct4xxp-objs += $(FIRM_DIR)/dahdi-fw-oct6114-064.o $(FIRM_DIR)/dahdi-fw-oct6114-128.o $(FIRM_DIR)/dahdi-fw-oct6114-256.o
wct4xxp-objs += $(FIRM_DIR)/dahdi-fw-oct6114-064.o $(FIRM_DIR)/dahdi-fw-oct6114-128.o
endif
$(obj)/$(FIRM_DIR)/dahdi-fw-oct6114-064.o: $(obj)/base.o
@@ -25,6 +25,3 @@ $(obj)/$(FIRM_DIR)/dahdi-fw-oct6114-064.o: $(obj)/base.o
$(obj)/$(FIRM_DIR)/dahdi-fw-oct6114-128.o: $(obj)/base.o
$(MAKE) -C $(obj)/$(FIRM_DIR) dahdi-fw-oct6114-128.o
$(obj)/$(FIRM_DIR)/dahdi-fw-oct6114-256.o: $(obj)/base.o
$(MAKE) -C $(obj)/$(FIRM_DIR) dahdi-fw-oct6114-256.o

File diff suppressed because it is too large Load Diff

View File

@@ -172,9 +172,9 @@ UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams)
struct vpm450m {
tPOCT6100_INSTANCE_API pApiInstance;
UINT32 aulEchoChanHndl[256];
int chanflags[256];
int ecmode[256];
UINT32 aulEchoChanHndl[128];
int chanflags[128];
int ecmode[128];
int numchans;
};
@@ -422,7 +422,6 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct f
tOCT6100_GET_INSTANCE_SIZE InstanceSize;
tOCT6100_CHANNEL_OPEN *ChannelOpen;
UINT32 ulResult;
unsigned int sout_stream, rout_stream;
struct vpm450m *vpm450m;
int x,y,law;
@@ -468,22 +467,15 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct f
ChipOpen->ulMemoryType = cOCT6100_MEM_TYPE_DDR;
ChipOpen->ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_32MB;
ChipOpen->ulNumMemoryChips = 1;
ChipOpen->ulMaxTdmStreams = 4;
ChipOpen->aulTdmStreamFreqs[0] = cOCT6100_TDM_STREAM_FREQ_8MHZ;
ChipOpen->ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE;
ChipOpen->ulMaxFlexibleConfParticipants = 0;
ChipOpen->ulMaxConfBridges = 0;
ChipOpen->ulMaxRemoteDebugSessions = 0;
ChipOpen->fEnableChannelRecording = FALSE;
ChipOpen->ulSoftToneEventsBufSize = 64;
if (vpm450m->numchans <= 128) {
ChipOpen->ulMaxTdmStreams = 4;
ChipOpen->ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE;
} else {
ChipOpen->ulMaxTdmStreams = 32;
ChipOpen->fEnableFastH100Mode = TRUE;
ChipOpen->ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_RISING_EDGE;
}
#if 0
ChipOpen->fEnableAcousticEcho = TRUE;
#endif
@@ -515,11 +507,7 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct f
kfree(ChannelOpen);
return NULL;
}
sout_stream = (8 == numspans) ? 29 : 2;
rout_stream = (8 == numspans) ? 24 : 3;
for (x = 0; x < ((8 == numspans) ? 256 : 128); x++) {
for (x = 0; x < ARRAY_SIZE(vpm450m->aulEchoChanHndl); x++) {
/* execute this loop always on 4 span cards but
* on 2 span cards only execute for the channels related to our spans */
if (( numspans > 2) || ((x & 0x03) <2)) {
@@ -527,7 +515,7 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct f
* therefore, the lower 2 bits tell us which span this
* timeslot/channel
*/
if (isalaw[x & 0x07])
if (isalaw[x & 0x03])
law = cOCT6100_PCM_A_LAW;
else
law = cOCT6100_PCM_U_LAW;
@@ -541,13 +529,11 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct f
ChannelOpen->TdmConfig.ulSinStream = 1;
ChannelOpen->TdmConfig.ulSinTimeslot = x;
ChannelOpen->TdmConfig.ulSoutPcmLaw = law;
ChannelOpen->TdmConfig.ulSoutStream = sout_stream;
ChannelOpen->TdmConfig.ulSoutStream = 2;
ChannelOpen->TdmConfig.ulSoutTimeslot = x;
#if 1
ChannelOpen->TdmConfig.ulRoutPcmLaw = law;
ChannelOpen->TdmConfig.ulRoutStream = rout_stream;
ChannelOpen->TdmConfig.ulRoutStream = 3;
ChannelOpen->TdmConfig.ulRoutTimeslot = x;
#endif
ChannelOpen->VqeConfig.fEnableNlp = TRUE;
ChannelOpen->VqeConfig.fRinDcOffsetRemoval = TRUE;
ChannelOpen->VqeConfig.fSinDcOffsetRemoval = TRUE;
@@ -557,7 +543,7 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct f
ulResult = Oct6100ChannelOpen(vpm450m->pApiInstance, ChannelOpen);
if (ulResult != GENERIC_OK) {
printk(KERN_NOTICE "Failed to open channel %d %x!\n", x, ulResult);
printk(KERN_NOTICE "Failed to open channel %d!\n", x);
continue;
}
for (y = 0; y < ARRAY_SIZE(tones); y++) {

View File

@@ -54,12 +54,6 @@
#define FRMR_SIC3 0x40
#define FRMR_CMR1 0x44
#define FRMR_CMR2 0x45
/* OctalFALC Only */
#define FRMR_CMR4 0x41
#define FRMR_CMR5 0x42
#define FRMR_CMR6 0x43
#define FRMR_GPC2 0x8a
/* End Octal */
#define FRMR_GCR 0x46
#define FRMR_ISR0 0x68
#define FRMR_ISR0_RME 0x80
@@ -82,13 +76,6 @@
#define FRMR_CIS_GIS2 0x02
#define FRMR_CIS_GIS3 0x04
#define FRMR_CIS_GIS4 0x08
/* CIS - Octal falc bits */
#define FRMR_CIS_GIS5 0x10
#define FRMR_CIS_GIS6 0x20
#define FRMR_CIS_GIS7 0x40
#define FRMR_CIS_GIS8 0x80
#define FRMR_CMDR 0x02
#define FRMR_CMDR_SRES 0x01
#define FRMR_CMDR_XRES 0x10
@@ -126,11 +113,6 @@ struct t4_regs {
unsigned char regs[NUM_REGS];
};
struct t4_reg {
unsigned int reg;
unsigned int val;
};
#define T4_CHECK_VPM 0
#define T4_LOADING_FW 1
#define T4_STOP_DMA 2
@@ -138,7 +120,5 @@ struct t4_reg {
#define T4_CHANGE_LATENCY 4
#define T4_IGNORE_LATENCY 5
#define WCT4_GET_REGS _IOW(DAHDI_CODE, 60, struct t4_regs)
#define WCT4_GET_REG _IOW(DAHDI_CODE, 61, struct t4_reg)
#define WCT4_SET_REG _IOW(DAHDI_CODE, 62, struct t4_reg)
#define WCT4_GET_REGS _IOW (DAHDI_CODE, 60, struct t4_regs)

View File

@@ -73,6 +73,20 @@
dev_info(&(wc)->pdev->dev, _fmt, ## _args); \
} \
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
#ifndef WARN_ON_ONCE
#define WARN_ON_ONCE(__condition) do { \
static int __once = 1; \
if (unlikely(__condition)) { \
if (__once) { \
__once = 0; \
WARN_ON(0); \
} \
} \
} while (0)
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
/* also added in RHEL kernels with the OpenInfiniband backport: */
#if LINUX_VERSION_CODE != KERNEL_VERSION(2, 6, 9) || !defined(DEFINE_SPINLOCK)
@@ -380,16 +394,22 @@ struct wcdte {
#endif
};
#ifdef HAVE_NETDEV_PRIV
struct wcdte_netdev_priv {
struct wcdte *wc;
};
#endif
static inline struct wcdte *
wcdte_from_netdev(struct net_device *netdev)
{
#ifdef HAVE_NETDEV_PRIV
struct wcdte_netdev_priv *priv;
priv = netdev_priv(netdev);
return priv->wc;
#else
return netdev->priv;
#endif
}
@@ -666,14 +686,23 @@ wctc4xxp_net_register(struct wcdte *wc)
{
int res;
struct net_device *netdev;
# ifdef HAVE_NETDEV_PRIV
struct wcdte_netdev_priv *priv;
# endif
const char our_mac[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
# ifdef HAVE_NETDEV_PRIV
netdev = alloc_netdev(sizeof(*priv), wc->board_name, ether_setup);
if (!netdev)
return -ENOMEM;
priv = netdev_priv(netdev);
priv->wc = wc;
# else
netdev = alloc_netdev(0, wc->board_name, ether_setup);
if (!netdev)
return -ENOMEM;
netdev->priv = wc;
# endif
memcpy(netdev->dev_addr, our_mac, sizeof(our_mac));
# ifdef HAVE_NET_DEVICE_OPS
@@ -2144,13 +2173,12 @@ wctc4xxp_write(struct file *file, const char __user *frame,
}
if (DAHDI_FORMAT_G723_1 == dtc->srcfmt) {
if ((G723_5K_BYTES != count) && (G723_6K_BYTES != count) &&
(G723_SID_BYTES != count)) {
if ((G723_5K_BYTES != count) && (G723_6K_BYTES != count)) {
DTE_DEBUG(DTE_DEBUG_GENERAL,
"Trying to transcode packet into G723 format " \
"that is %Zu bytes instead of the expected " \
"%d/%d/%d bytes.\n", count, G723_5K_BYTES,
G723_6K_BYTES, G723_SID_BYTES);
"%d/%d bytes.\n", count, G723_5K_BYTES,
G723_6K_BYTES);
return -EINVAL;
}
cpvt->timestamp += G723_SAMPLES;
@@ -3308,7 +3336,6 @@ wctc4xxp_watchdog(unsigned long data)
"Board malfunctioning. " \
"Halting operation.\n");
reschedule_timer = 0;
spin_lock(&wc->cmd_list_lock);
break;
}
/* ERROR: We've retried the command and

View File

@@ -205,7 +205,6 @@ struct wctdm {
struct pci_dev *dev;
char *variety;
struct dahdi_span span;
struct dahdi_device *ddev;
unsigned char ios;
int usecount;
unsigned int intcount;
@@ -1711,7 +1710,7 @@ static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual,
/* Misc. DAA parameters */
if (fastpickup)
reg31 = 0xe3;
reg31 = 0xb3;
else
reg31 = 0xa3;
@@ -2363,26 +2362,13 @@ static int wctdm_initialize(struct wctdm *wc)
{
int x;
wc->ddev = dahdi_create_device();
if (!wc->ddev)
return -ENOMEM;
/* DAHDI stuff */
sprintf(wc->span.name, "WCTDM/%d", wc->pos);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Board %d", wc->variety, wc->pos + 1);
wc->ddev->location = kasprintf(GFP_KERNEL,
"PCI Bus %02d Slot %02d",
wc->dev->bus->number,
PCI_SLOT(wc->dev->devfn) + 1);
if (!wc->ddev->location) {
dahdi_free_device(wc->ddev);
wc->ddev = NULL;
return -ENOMEM;
}
wc->ddev->manufacturer = "Digium";
wc->ddev->devicetype = wc->variety;
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.manufacturer = "Digium";
strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
if (alawoverride) {
printk(KERN_INFO "ALAW override parameter detected. Device will be operating in ALAW\n");
wc->span.deflaw = DAHDI_LAW_ALAW;
@@ -2398,15 +2384,12 @@ static int wctdm_initialize(struct wctdm *wc)
}
wc->span.chans = wc->chans;
wc->span.channels = NUM_CARDS;
wc->span.irq = wc->dev->irq;
wc->span.flags = DAHDI_FLAG_RBS;
wc->span.ops = &wctdm_span_ops;
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
if (dahdi_register(&wc->span, 0)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
kfree(wc->ddev->location);
dahdi_free_device(wc->ddev);
wc->ddev = NULL;
return -1;
}
return 0;
@@ -2694,9 +2677,7 @@ static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_devic
release_region(wc->ioaddr, 0xff);
pci_free_consistent(pdev, DAHDI_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)wc->writechunk, wc->writedma);
pci_set_drvdata(pdev, NULL);
dahdi_unregister_device(wc->ddev);
kfree(wc->ddev->location);
dahdi_free_device(wc->ddev);
dahdi_unregister(&wc->span);
kfree(wc);
return -EIO;
@@ -2727,14 +2708,10 @@ static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_devic
static void wctdm_release(struct wctdm *wc)
{
dahdi_unregister_device(wc->ddev);
dahdi_unregister(&wc->span);
if (wc->freeregion)
release_region(wc->ioaddr, 0xff);
kfree(wc->ddev->location);
dahdi_free_device(wc->ddev);
kfree(wc);
printk(KERN_INFO "Freed a Wildcard\n");
}

File diff suppressed because it is too large Load Diff

View File

@@ -45,6 +45,7 @@
* \brief Default ringer debounce (in ms)
*/
#define DEFAULT_RING_DEBOUNCE 1024
#define POLARITY_DEBOUNCE 64 /* Polarity debounce (in ms) */
#define OHT_TIMER 6000 /* How long after RING to retain OHT */
@@ -84,6 +85,7 @@
#define NUM_CAL_REGS 12
#define ISR_COMMANDS 2
#define QRV_DEBOUNCETIME 20
#define VPM150M_HPI_CONTROL 0x00
@@ -105,30 +107,10 @@ struct calregs {
enum battery_state {
BATTERY_UNKNOWN = 0,
BATTERY_DEBOUNCING_PRESENT,
BATTERY_DEBOUNCING_PRESENT_ALARM,
BATTERY_PRESENT,
BATTERY_DEBOUNCING_LOST,
BATTERY_DEBOUNCING_LOST_ALARM,
BATTERY_LOST,
};
enum ring_detector_state {
RINGOFF = 0,
DEBOUNCING_RINGING_POSITIVE,
DEBOUNCING_RINGING_NEGATIVE,
RINGING,
DEBOUNCING_RINGOFF,
};
enum polarity_state {
UNKNOWN_POLARITY = 0,
POLARITY_DEBOUNCE_POSITIVE,
POLARITY_POSITIVE,
POLARITY_DEBOUNCE_NEGATIVE,
POLARITY_NEGATIVE,
};
struct wctdm_cmd {
struct list_head node;
struct completion *complete;
@@ -164,26 +146,29 @@ struct wctdm_chan {
};
struct fxo {
enum ring_detector_state ring_state:4;
enum battery_state battery_state:4;
enum polarity_state polarity_state:4;
u8 ring_polarity_change_count:4;
u8 hook_ring_shadow;
s8 line_voltage_status;
int wasringing;
int lastrdtx;
int lastrdtx_count;
int ringdebounce;
int offhook;
int battdebounce;
int battalarm;
enum battery_state battery;
int lastpol;
int polarity;
int polaritydebounce;
int neonmwi_state;
int neonmwi_last_voltage;
unsigned int neonmwi_debounce;
unsigned int neonmwi_offcounter;
unsigned long display_fxovoltage;
unsigned long ringdebounce_timer;
unsigned long battdebounce_timer;
unsigned long poldebounce_timer;
};
struct fxs {
u8 oht_active:1;
u8 off_hook:1;
int oldrxhook;
int debouncehook;
int lastrxhook;
int debounce;
int ohttimer;
int idletxhookstate; /* IDLE changing hook state */
/* lasttxhook reflects the last value written to the proslic's reg
* 64 (LINEFEED_CONTROL) in bits 0-2. Bit 4 indicates if the last
@@ -195,18 +180,13 @@ struct fxs {
* voicebus ISR.
*/
int lasttxhook;
u8 linefeed_control_shadow;
u8 hook_state_shadow;
int oppending_ms;
int palarms;
struct dahdi_vmwi_info vmwisetting;
int vmwi_active_messages;
int vmwi_linereverse;
int reversepolarity; /* polarity reversal */
struct calregs calregs;
unsigned long check_alarm;
unsigned long check_proslic;
unsigned long oppending_timeout;
unsigned long ohttimer;
};
struct qrv {
@@ -223,7 +203,6 @@ struct qrv {
int radmode;
signed short rxgain;
signed short txgain;
u8 isrshadow[3];
};
enum module_type {
@@ -236,7 +215,7 @@ enum module_type {
};
struct wctdm_module {
union modtypes {
union {
struct fxo fxo;
struct fxs fxs;
struct qrv qrv;
@@ -248,6 +227,7 @@ struct wctdm_module {
struct list_head active_cmds;
u8 offsets[3];
u8 subaddr;
u8 isrshadow[ISR_COMMANDS];
u8 card;
enum module_type type;
@@ -262,7 +242,7 @@ struct wctdm {
spinlock_t frame_list_lock;
struct list_head frame_list;
unsigned long framecount;
unsigned int intcount;
unsigned char txident;
unsigned char rxident;
@@ -275,7 +255,6 @@ struct wctdm {
spinlock_t reglock; /* held when accessing anything affecting the module array */
wait_queue_head_t regq;
struct list_head free_isr_commands;
struct wctdm_module mods[NUM_MODULES];
@@ -297,7 +276,6 @@ struct wctdm {
int not_ready; /* 0 when the entire card is ready to go */
unsigned long checkflag; /* Internal state flags and task bits */
int companding;
struct dahdi_device *ddev;
};
static inline bool is_initialized(struct wctdm *wc)

View File

@@ -174,7 +174,6 @@ struct t1 {
unsigned char ec_chunk1[32][DAHDI_CHUNKSIZE];
unsigned char ec_chunk2[32][DAHDI_CHUNKSIZE];
unsigned char tempo[33];
struct dahdi_device *ddev;
struct dahdi_span span; /* Span */
struct dahdi_chan *chans[32]; /* Channels */
};
@@ -341,12 +340,10 @@ static void t1xxp_release(struct t1 *wc)
{
unsigned int x;
dahdi_unregister_device(wc->ddev);
dahdi_unregister(&wc->span);
for (x = 0; x < (wc->spantype == TYPE_E1 ? 31 : 24); x++) {
kfree(wc->chans[x]);
}
kfree(wc->ddev->location);
dahdi_free_device(wc->ddev);
kfree(wc);
printk(KERN_INFO "Freed a Wildcard\n");
}
@@ -979,21 +976,15 @@ static int t1xxp_software_init(struct t1 *wc)
}
if (x >= WC_MAX_CARDS)
return -1;
wc->ddev = dahdi_create_device();
t4_serial_setup(wc);
wc->num = x;
sprintf(wc->span.name, "WCT1/%d", wc->num);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, wc->num);
wc->ddev->manufacturer = "Digium";
wc->ddev->devicetype = wc->variety;
wc->ddev->location = kasprintf(GFP_KERNEL, "PCI Bus %02d Slot %02d",
wc->dev->bus->number,
PCI_SLOT(wc->dev->devfn) + 1);
if (!wc->ddev->location)
return -ENOMEM;
wc->span.manufacturer = "Digium";
strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.irq = wc->dev->irq;
if (wc->spantype == TYPE_E1) {
if (unchannelized)
wc->span.channels = 32;
@@ -1020,8 +1011,7 @@ static int t1xxp_software_init(struct t1 *wc)
wc->chans[x]->chanpos = x + 1;
}
wc->span.ops = &t1xxp_span_ops;
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
if (dahdi_register(&wc->span, 0)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
}
@@ -1128,10 +1118,10 @@ static void t1xxp_receiveprep(struct t1 *wc, int ints)
if (((oldcan & 0xffff0000) >> 16) != CANARY) {
/* Check top part */
if (debug) printk(KERN_DEBUG "Expecting top %04x, got %04x\n", CANARY, (oldcan & 0xffff0000) >> 16);
wc->ddev->irqmisses++;
wc->span.irqmisses++;
} else if ((oldcan & 0xffff) != ((wc->canary - 1) & 0xffff)) {
if (debug) printk(KERN_DEBUG "Expecting bottom %d, got %d\n", wc->canary - 1, oldcan & 0xffff);
wc->ddev->irqmisses++;
wc->span.irqmisses++;
}
for (y=0;y<DAHDI_CHUNKSIZE;y++) {
for (x=0;x<wc->span.channels;x++) {

View File

@@ -55,18 +55,13 @@
#error VOICEBUS_SFRAME_SIZE != SFRAME_SIZE
#endif
#ifndef pr_fmt
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#endif
static int debug;
static int j1mode = 0;
static int alarmdebounce = 2500; /* LOF/LFA def to 2.5s AT&T TR54016*/
static int losalarmdebounce = 2500; /* LOS def to 2.5s AT&T TR54016*/
static int aisalarmdebounce = 2500; /* AIS(blue) def to 2.5s AT&T TR54016*/
static int yelalarmdebounce = 500; /* RAI(yellow) def to 0.5s AT&T devguide */
static int t1e1override = -1; /* deprecated */
static char *default_linemode = "auto"; /* 'auto', 'e1', or 't1' */
static int t1e1override = -1;
static int latency = VOICEBUS_DEFAULT_LATENCY;
static unsigned int max_latency = VOICEBUS_DEFAULT_MAXLATENCY;
static int vpmsupport = 1;
@@ -755,7 +750,7 @@ static void __t1xxp_set_clear(struct t1 *wc)
/* Calculate all states on all 24 channels using the channel
flags, then write all 3 clear channel registers at once */
for (i = 0; i < wc->span.channels; i++) {
for (i = 0; i < 24; i++) {
offset = i/8;
if (wc->span.chans[i]->flags & DAHDI_FLAG_CLEAR)
reg[offset] |= 1 << (7 - (i % 8));
@@ -776,31 +771,19 @@ static void __t1xxp_set_clear(struct t1 *wc)
t1_info(wc, "Unable to set clear/rbs mode!\n");
}
/**
* _t1_free_channels - Free the memory allocated for the channels.
*
* Must be called with wc->reglock held.
*
*/
static void _t1_free_channels(struct t1 *wc)
{
int x;
for (x = 0; x < ARRAY_SIZE(wc->chans); x++) {
kfree(wc->chans[x]);
kfree(wc->ec[x]);
wc->chans[x] = NULL;
wc->ec[x] = NULL;
}
}
static void free_wc(struct t1 *wc)
{
unsigned int x;
unsigned long flags;
struct command *cmd;
LIST_HEAD(list);
for (x = 0; x < (wc->spantype == TYPE_E1 ? 31 : 24); x++) {
kfree(wc->chans[x]);
kfree(wc->ec[x]);
}
spin_lock_irqsave(&wc->reglock, flags);
_t1_free_channels(wc);
list_splice_init(&wc->active_cmds, &list);
list_splice_init(&wc->pending_cmds, &list);
spin_unlock_irqrestore(&wc->reglock, flags);
@@ -820,14 +803,14 @@ static void free_wc(struct t1 *wc)
}
#endif
kfree(wc->ddev->location);
kfree(wc->ddev->devicetype);
dahdi_free_device(wc->ddev);
kfree(wc);
}
static void t4_serial_setup(struct t1 *wc)
{
t1_info(wc, "Setting up global serial parameters for %s\n",
((wc->spantype == TYPE_E1) ? "E1" : "T1"));
t1_setreg(wc, 0x85, 0xe0); /* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from channel 0 */
t1_setreg(wc, 0x08, 0x05); /* IPC: Interrupt push/pull active low */
@@ -1021,12 +1004,12 @@ static void t1_configure_e1(struct t1 *wc, int lineconfig)
t1_info(wc, "Span configured for %s/%s%s\n", framing, line, crc4);
}
static void t1xxp_framer_start(struct t1 *wc)
static void t1xxp_framer_start(struct t1 *wc, struct dahdi_span *span)
{
if (dahdi_is_e1_span(&wc->span)) {
t1_configure_e1(wc, wc->span.lineconfig);
if (wc->spantype == TYPE_E1) { /* if this is an E1 card */
t1_configure_e1(wc, span->lineconfig);
} else { /* is a T1 card */
t1_configure_t1(wc, wc->span.lineconfig, wc->span.txlevel);
t1_configure_t1(wc, span->lineconfig, span->txlevel);
__t1xxp_set_clear(wc);
}
@@ -1035,28 +1018,14 @@ static void t1xxp_framer_start(struct t1 *wc)
static void set_span_devicetype(struct t1 *wc)
{
const char *olddevicetype;
olddevicetype = wc->ddev->devicetype;
strncpy(wc->span.devicetype, wc->variety,
sizeof(wc->span.devicetype) - 1);
#if defined(VPM_SUPPORT)
if (wc->vpmadt032) {
wc->ddev->devicetype = kasprintf(GFP_KERNEL,
"%s (VPMADT032)", wc->variety);
} else if (wc->vpmoct) {
wc->ddev->devicetype = kasprintf(GFP_KERNEL,
"%s (VPMOCT032)", wc->variety);
} else {
wc->ddev->devicetype = kasprintf(GFP_KERNEL, "%s", wc->variety);
}
#else
wc->ddev->devicetype = kasprintf(GFP_KERNEL, "%s", wc->variety);
if (wc->vpmadt032)
strncat(wc->span.devicetype, " (VPMADT032)",
sizeof(wc->span.devicetype) - 1);
#endif
/* On the off chance that we were able to allocate it previously. */
if (!wc->ddev->devicetype)
wc->ddev->devicetype = olddevicetype;
else
kfree(olddevicetype);
}
static int t1xxp_startup(struct file *file, struct dahdi_span *span)
@@ -1077,7 +1046,7 @@ static int t1xxp_startup(struct file *file, struct dahdi_span *span)
#endif
/* Reset framer with proper parameters and start */
t1xxp_framer_start(wc);
t1xxp_framer_start(wc, span);
debug_printk(wc, 1, "Calling startup (flags is %lu)\n", span->flags);
return 0;
@@ -1117,7 +1086,7 @@ static int t1xxp_chanconfig(struct file *file,
}
if (test_bit(DAHDI_FLAGBIT_RUNNING, &chan->span->flags) &&
dahdi_is_t1_span(&wc->span)) {
(wc->spantype != TYPE_E1)) {
__t1xxp_set_clear(wc);
}
return 0;
@@ -1132,7 +1101,7 @@ static int t1xxp_rbsbits(struct dahdi_chan *chan, int bits)
debug_printk(wc, 2, "Setting bits to %d on channel %s\n",
bits, chan->name);
if (dahdi_is_e1_span(&wc->span)) { /* do it E1 way */
if (wc->spantype == TYPE_E1) { /* do it E1 way */
if (chan->chanpos == 16)
return 0;
@@ -1185,7 +1154,7 @@ static inline void t1_check_sigbits(struct t1 *wc)
if (!(test_bit(DAHDI_FLAGBIT_RUNNING, &wc->span.flags)))
return;
if (dahdi_is_e1_span(&wc->span)) {
if (wc->spantype == TYPE_E1) {
for (i = 0; i < 15; i++) {
a = t1_getreg(wc, 0x71 + i);
if (a > -1) {
@@ -1280,7 +1249,7 @@ static void t1xxp_maint_work(struct work_struct *work)
int reg = 0;
int cmd = w->cmd;
if (dahdi_is_e1_span(&wc->span)) {
if (wc->spantype == TYPE_E1) {
switch (cmd) {
case DAHDI_MAINT_NONE:
t1_info(wc, "Clearing all maint modes\n");
@@ -1352,7 +1321,7 @@ static int t1xxp_maint(struct dahdi_span *span, int cmd)
struct maint_work_struct *work;
struct t1 *wc = container_of(span, struct t1, span);
if (dahdi_is_e1_span(&wc->span)) {
if (wc->spantype == TYPE_E1) {
switch (cmd) {
case DAHDI_MAINT_NONE:
case DAHDI_MAINT_LOCALLOOP:
@@ -1601,7 +1570,6 @@ static int vpm_start_load(struct t1 *wc)
work->wc = wc;
queue_work(wc->wq, &work->work);
wc->not_ready++;
return 0;
}
@@ -1648,23 +1616,12 @@ static void check_and_load_vpm(struct t1 *wc)
options.vpmnlptype = vpmnlptype;
options.vpmnlpthresh = vpmnlpthresh;
options.vpmnlpmaxsupp = vpmnlpmaxsupp;
options.channels = dahdi_is_t1_span(&wc->span) ? 24 : 32;
options.channels = (TYPE_T1 == wc->spantype) ? 24 : 32;
/* We do not want to check that the VPM is alive until after we're
* done setting it up here, an hour should cover it... */
wc->vpm_check = jiffies + HZ*3600;
/* If there was one already allocated, let's free it. */
if (wc->vpmadt032) {
vpmadt = wc->vpmadt032;
clear_bit(VPM150M_ACTIVE, &vpmadt->control);
flush_workqueue(vpmadt->wq);
spin_lock_irqsave(&wc->reglock, flags);
wc->vpmadt032 = NULL;
spin_unlock_irqrestore(&wc->reglock, flags);
vpmadt032_free(vpmadt);
}
vpmadt = vpmadt032_alloc(&options);
if (!vpmadt)
return;
@@ -1703,8 +1660,6 @@ static void check_and_load_vpm(struct t1 *wc)
vpmoct_init(vpmoct, t1_vpm_load_complete);
}
set_span_devicetype(wc);
}
#else
static inline void check_and_load_vpm(const struct t1 *wc)
@@ -1719,7 +1674,7 @@ static void t1_chan_set_sigcap(struct dahdi_span *span, int x)
struct dahdi_chan *chan = wc->chans[x];
chan->sigcap = DAHDI_SIG_CLEAR;
/* E&M variant supported depends on span type */
if (dahdi_is_e1_span(&wc->span)) {
if (wc->spantype == TYPE_E1) {
/* E1 sigcap setup */
if (span->lineconfig & DAHDI_CONFIG_CCS) {
/* CCS setup */
@@ -1802,46 +1757,54 @@ static void t1xxp_disable_hw_preechocan(struct dahdi_chan *chan)
vpmoct_preecho_disable(wc->vpmoct, chan->chanpos - 1);
}
/**
* t1_software_init - Initialize the board for the given type.
* @wc: The board to initialize.
* @type: The type of board we are, T1 / E1
*
* This function is called at startup and when the type of the span is changed
* via the dahdi_device before the span is assigned a number.
*
*/
static int t1_software_init(struct t1 *wc, enum linemode type)
static const struct dahdi_span_ops t1_span_ops = {
.owner = THIS_MODULE,
.spanconfig = t1xxp_spanconfig,
.chanconfig = t1xxp_chanconfig,
.startup = t1xxp_startup,
.rbsbits = t1xxp_rbsbits,
.maint = t1xxp_maint,
.ioctl = t1xxp_ioctl,
#ifdef VPM_SUPPORT
.enable_hw_preechocan = t1xxp_enable_hw_preechocan,
.disable_hw_preechocan = t1xxp_disable_hw_preechocan,
.echocan_create = t1xxp_echocan_create,
.echocan_name = t1xxp_echocan_name,
#endif
};
static int t1_software_init(struct t1 *wc)
{
int x;
struct dahdi_chan *chans[32] = {NULL,};
struct dahdi_echocan_state *ec[32] = {NULL,};
unsigned long flags;
int res = 0;
int num;
struct pci_dev *pdev = wc->vb.pdev;
/* We may already be setup properly. */
if (wc->span.channels == ((E1 == type) ? 31 : 24))
return 0;
for (x = 0; x < ((E1 == type) ? 31 : 24); x++) {
chans[x] = kzalloc(sizeof(*chans[x]), GFP_KERNEL);
ec[x] = kzalloc(sizeof(*ec[x]), GFP_KERNEL);
if (!chans[x] || !ec[x])
goto error_exit;
/* Find position */
for (x = 0; x < ARRAY_SIZE(ifaces); ++x) {
if (ifaces[x] == wc) {
debug_printk(wc, 1, "software init for card %d\n", x);
break;
}
}
if (x == ARRAY_SIZE(ifaces))
return -1;
t4_serial_setup(wc);
num = x;
sprintf(wc->span.name, "WCT1/%d", num);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, num);
wc->span.manufacturer = "Digium";
set_span_devicetype(wc);
/* Because the interrupt handler is running, we need to atomically
* swap the channel arrays. */
spin_lock_irqsave(&wc->reglock, flags);
_t1_free_channels(wc);
memcpy(wc->chans, chans, sizeof(wc->chans));
memcpy(wc->ec, ec, sizeof(wc->ec));
memset(chans, 0, sizeof(chans));
memset(ec, 0, sizeof(ec));
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", pdev->bus->number,
PCI_SLOT(pdev->devfn) + 1);
if (type == E1) {
wc->span.irq = pdev->irq;
if (wc->spantype == TYPE_E1) {
wc->span.channels = 31;
wc->span.spantype = "E1";
wc->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_HDB3 |
@@ -1854,89 +1817,24 @@ static int t1_software_init(struct t1 *wc, enum linemode type)
DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF;
wc->span.deflaw = DAHDI_LAW_MULAW;
}
spin_unlock_irqrestore(&wc->reglock, flags);
if (!wc->ddev->location)
return -ENOMEM;
t1_info(wc, "Setting up global serial parameters for %s\n",
(dahdi_is_e1_span(&wc->span) ? "E1" : "T1"));
t4_serial_setup(wc);
wc->span.chans = wc->chans;
set_bit(DAHDI_FLAGBIT_RBS, &wc->span.flags);
for (x = 0; x < wc->span.channels; x++) {
sprintf(wc->chans[x]->name, "%s/%d", wc->span.name, x + 1);
sprintf(wc->chans[x]->name, "WCT1/%d/%d", num, x + 1);
t1_chan_set_sigcap(&wc->span, x);
wc->chans[x]->pvt = wc;
wc->chans[x]->chanpos = x + 1;
}
check_and_load_vpm(wc);
set_span_devicetype(wc);
wc->span.ops = &t1_span_ops;
if (dahdi_register(&wc->span, 0)) {
t1_info(wc, "Unable to register span with DAHDI\n");
return -1;
}
return 0;
error_exit:
for (x = 0; x < ARRAY_SIZE(chans); ++x) {
kfree(chans[x]);
kfree(ec[x]);
}
return res;
}
/**
* t1xx_set_linemode - Change the type of span before assignment.
* @span: The span to change.
* @linemode: Text string for the line mode.
*
* This function may be called after the dahdi_device is registered but
* before the spans are assigned numbers (and are visible to the rest of
* DAHDI).
*
*/
static int t1xxp_set_linemode(struct dahdi_span *span, const char *linemode)
{
int res;
struct t1 *wc = container_of(span, struct t1, span);
/* We may already be set to the requested type. */
if (!strcasecmp(span->spantype, linemode))
return 0;
res = t1_wait_for_ready(wc);
if (res)
return res;
/* Stop the processing of the channels since we're going to change
* them. */
clear_bit(INITIALIZED, &wc->bit_flags);
smp_mb__after_clear_bit();
del_timer_sync(&wc->timer);
flush_workqueue(wc->wq);
if (!strcasecmp(linemode, "t1")) {
dev_info(&wc->vb.pdev->dev,
"Changing from E1 to T1 line mode.\n");
res = t1_software_init(wc, T1);
} else if (!strcasecmp(linemode, "e1")) {
dev_info(&wc->vb.pdev->dev,
"Changing from T1 to E1 line mode.\n");
res = t1_software_init(wc, E1);
} else {
dev_err(&wc->vb.pdev->dev,
"'%s' is an unknown linemode.\n", linemode);
res = -EINVAL;
}
/* Since we probably reallocated the channels we need to make
* sure they are configured before setting INITIALIZED again. */
if (!res) {
dahdi_init_span(span);
set_bit(INITIALIZED, &wc->bit_flags);
mod_timer(&wc->timer, jiffies + HZ/5);
}
return res;
}
#if 0
@@ -1955,53 +1853,39 @@ static inline unsigned char t1_vpm_out(struct t1 *wc, int unit, const unsigned i
#endif
#endif
static int t1_hardware_post_init(struct t1 *wc, enum linemode *type)
static int t1_hardware_post_init(struct t1 *wc)
{
int res;
int reg;
unsigned int reg;
int x;
/* T1 or E1 */
if (-1 != t1e1override) {
pr_info("t1e1override is deprecated. Please use 'default_linemode'.\n");
*type = (t1e1override) ? E1 : T1;
if (t1e1override > -1) {
if (t1e1override)
wc->spantype = TYPE_E1;
else
wc->spantype = TYPE_T1;
} else {
if (!strcasecmp(default_linemode, "e1")) {
*type = E1;
} else if (!strcasecmp(default_linemode, "t1")) {
*type = T1;
} else {
u8 pins;
res = t1_getpins(wc, &pins);
if (res)
return res;
*type = (pins & 0x01) ? T1 : E1;
}
u8 pins;
res = t1_getpins(wc, &pins);
if (res)
return res;
wc->spantype = (pins & 0x01) ? TYPE_T1 : TYPE_E1;
}
debug_printk(wc, 1, "linemode: %s\n", (*type == T1) ? "T1" : "E1");
debug_printk(wc, 1, "spantype: %s\n", 1 == wc->spantype ? "T1" : "E1");
/* what version of the FALC are we using? */
reg = t1_setreg(wc, 0x4a, 0xaa);
reg = t1_getreg(wc, 0x4a);
if (reg < 0) {
t1_info(wc, "Failed to read FALC version (%d)\n", reg);
return -EIO;
}
debug_printk(wc, 1, "FALC version: %08x\n", reg);
/* make sure reads and writes work */
for (x = 0; x < 256; x++) {
t1_setreg(wc, 0x14, x);
reg = t1_getreg(wc, 0x14);
if (reg < 0) {
t1_info(wc, "Failed register read (%d)\n", reg);
return -EIO;
}
if (reg != x) {
t1_info(wc, "Register test failed. "
"Wrote '%x' but read '%x'\n", x, reg);
return -EIO;
}
if (reg != x)
t1_info(wc, "Wrote '%x' but read '%x'\n", x, reg);
}
t1_setleds(wc, wc->ledstate);
@@ -2029,7 +1913,7 @@ static inline void t1_check_alarms(struct t1 *wc)
/* And consider only carrier alarms */
wc->span.alarms &= (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE | DAHDI_ALARM_NOTOPEN);
if (dahdi_is_e1_span(&wc->span)) {
if (wc->spantype == TYPE_E1) {
if (c & 0x04) {
/* No multiframe found, force RAI high after 400ms only if
we haven't found a multiframe since last loss
@@ -2355,7 +2239,7 @@ static inline void t1_receiveprep(struct t1 *wc, const u8* sframe)
wc->rxident = eframe[EFRAME_SIZE + 1];
wc->statreg = eframe[EFRAME_SIZE + 2];
if (wc->rxident != expected) {
wc->ddev->irqmisses++;
wc->span.irqmisses++;
_resend_cmds(wc);
if (unlikely(debug)) {
t1_info(wc, "oops: rxident=%d "
@@ -2638,31 +2522,14 @@ static inline void remove_sysfs_files(struct t1 *wc) { return; }
#endif /* CONFIG_VOICEBUS_SYSFS */
static const struct dahdi_span_ops t1_span_ops = {
.owner = THIS_MODULE,
.spanconfig = t1xxp_spanconfig,
.chanconfig = t1xxp_chanconfig,
.startup = t1xxp_startup,
.rbsbits = t1xxp_rbsbits,
.maint = t1xxp_maint,
.ioctl = t1xxp_ioctl,
.set_spantype = t1xxp_set_linemode,
#ifdef VPM_SUPPORT
.enable_hw_preechocan = t1xxp_enable_hw_preechocan,
.disable_hw_preechocan = t1xxp_disable_hw_preechocan,
.echocan_create = t1xxp_echocan_create,
.echocan_name = t1xxp_echocan_name,
#endif
};
static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct t1 *wc;
const struct t1_desc *d = (struct t1_desc *) ent->driver_data;
struct t1_desc *d = (struct t1_desc *) ent->driver_data;
unsigned int x;
int res;
unsigned int index = -1;
enum linemode type;
for (x = 0; x < ARRAY_SIZE(ifaces); x++) {
if (!ifaces[x]) {
@@ -2681,22 +2548,18 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
if (!wc)
return -ENOMEM;
/* Set the performance counters to -1 since this card currently does
* not support collecting them. */
memset(&wc->span.count, -1, sizeof(wc->span.count));
wc->not_ready = 1;
ifaces[index] = wc;
sprintf(wc->span.name, "WCT1/%d", index);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d",
d->name, index);
wc->not_ready = 1;
wc->ledstate = -1;
wc->variety = d->name;
wc->txident = 1;
spin_lock_init(&wc->reglock);
INIT_LIST_HEAD(&wc->active_cmds);
INIT_LIST_HEAD(&wc->pending_cmds);
wc->variety = d->name;
wc->txident = 1;
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
wc->timer.function = te12xp_timer;
wc->timer.data = (unsigned long)wc;
@@ -2717,22 +2580,6 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
INIT_WORK(&wc->vpm_check_work, vpm_check_func);
# endif
wc->ddev = dahdi_create_device();
if (!wc->ddev) {
ifaces[index] = NULL;
kfree(wc);
return -ENOMEM;
}
wc->ddev->manufacturer = "Digium";
wc->ddev->location = kasprintf(GFP_KERNEL, "PCI Bus %02d Slot %02d",
pdev->bus->number,
PCI_SLOT(pdev->devfn) + 1);
if (!wc->ddev->location) {
ifaces[index] = NULL;
kfree(wc);
return -ENOMEM;
}
#ifdef CONFIG_VOICEBUS_ECREFERENCE
for (x = 0; x < ARRAY_SIZE(wc->ec_reference); ++x) {
/* 256 is used here since it is the largest power of two that
@@ -2764,7 +2611,6 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
wc->wq = create_singlethread_workqueue(wc->name);
if (!wc->wq) {
kfree(wc);
ifaces[index] = NULL;
return -ENOMEM;
}
@@ -2778,33 +2624,36 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
if (voicebus_start(&wc->vb)) {
voicebus_release(&wc->vb);
free_wc(wc);
ifaces[index] = NULL;
return -EIO;
}
res = t1_hardware_post_init(wc, &type);
res = t1_hardware_post_init(wc);
if (res) {
voicebus_release(&wc->vb);
free_wc(wc);
ifaces[index] = NULL;
return res;
}
wc->span.chans = wc->chans;
for (x = 0; x < (wc->spantype == TYPE_E1 ? 31 : 24); x++) {
wc->chans[x] = kzalloc(sizeof(*wc->chans[x]), GFP_KERNEL);
if (!wc->chans[x]) {
free_wc(wc);
ifaces[index] = NULL;
return -ENOMEM;
}
res = t1_software_init(wc, type);
wc->ec[x] = kzalloc(sizeof(*wc->ec[x]), GFP_KERNEL);
if (!wc->ec[x]) {
free_wc(wc);
ifaces[index] = NULL;
return -ENOMEM;
}
}
res = t1_software_init(wc);
if (res) {
voicebus_release(&wc->vb);
free_wc(wc);
ifaces[index] = NULL;
return res;
}
wc->span.ops = &t1_span_ops;
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
res = dahdi_register_device(wc->ddev, &wc->vb.pdev->dev);
if (res) {
t1_info(wc, "Unable to register with DAHDI\n");
return res;
}
@@ -2814,7 +2663,10 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
t1_info(wc, "Found a %s\n", wc->variety);
voicebus_unlock_latency(&wc->vb);
wc->not_ready--;
/* If there is VPMADT032 module attached to this device, it will
* signal ready after the channels are configured and ready for use. */
if (!wc->vpmadt032)
wc->not_ready--;
return 0;
}
@@ -2829,7 +2681,7 @@ static void __devexit te12xp_remove_one(struct pci_dev *pdev)
if (!wc)
return;
dahdi_unregister_device(wc->ddev);
dahdi_unregister(&wc->span);
remove_sysfs_files(wc);
@@ -2920,16 +2772,6 @@ static int __init te12xp_init(void)
if (!cmd_cache)
return -ENOMEM;
if (-1 != t1e1override) {
pr_info("'t1e1override' is deprecated. "
"Please use 'default_linemode' instead\n");
} else if (strcasecmp(default_linemode, "auto") &&
strcasecmp(default_linemode, "t1") &&
strcasecmp(default_linemode, "e1")) {
pr_err("'%s' is an unknown span type.", default_linemode);
default_linemode = "auto";
return -EINVAL;
}
res = dahdi_pci_module(&te12xp_driver);
if (res) {
kmem_cache_destroy(cmd_cache);
@@ -2948,9 +2790,6 @@ static void __exit te12xp_cleanup(void)
module_param(debug, int, S_IRUGO | S_IWUSR);
module_param(t1e1override, int, S_IRUGO | S_IWUSR);
module_param(default_linemode, charp, S_IRUGO);
MODULE_PARM_DESC(default_linemode, "\"auto\"(default), \"e1\", or \"t1\". "
"\"auto\" will use the value from the hardware jumpers.");
module_param(j1mode, int, S_IRUGO | S_IWUSR);
module_param(alarmdebounce, int, S_IRUGO | S_IWUSR);
module_param(losalarmdebounce, int, S_IRUGO | S_IWUSR);

View File

@@ -74,10 +74,8 @@
#define CMD_BYTE(slot, a, is_vpm) (slot*6)+(a*2)+is_vpm /* only even slots */
//TODO: make a separate macro
enum linemode {
T1 = 1,
E1,
};
#define TYPE_T1 1
#define TYPE_E1 2
struct command {
struct list_head node;
@@ -96,6 +94,7 @@ struct t1 {
unsigned char txident;
unsigned char rxident;
unsigned char statreg; /* bit 0 = vpmadt032 int */
int spantype;
struct {
unsigned int nmf:1;
unsigned int sendingyellow:1;
@@ -117,7 +116,6 @@ struct t1 {
unsigned long alarmtimer;
unsigned char ledstate;
unsigned char vpm_check_count;
struct dahdi_device *ddev;
struct dahdi_span span; /* Span */
struct dahdi_chan *chans[32]; /* Channels */
struct dahdi_echocan_state *ec[32]; /* Echocan state for channels */

View File

@@ -863,7 +863,6 @@ static const struct dahdi_span_ops BRI_span_ops = {
.maint = xpp_maint,
.echocan_create = xpp_echocan_create,
.echocan_name = xpp_echocan_name,
.assigned = xpp_span_assigned,
#ifdef DAHDI_SYNC_TICK
.sync_tick = dahdi_sync_tick,
#endif

View File

@@ -28,6 +28,7 @@ enum fxo_opcodes {
XPROTO_NAME(FXO, SIG_CHANGED) = 0x06,
/**/
XPROTO_NAME(FXO, DAA_WRITE) = 0x0F, /* Write to DAA */
XPROTO_NAME(FXO, XPD_STATE) = 0x0F, /* Write to DAA */
XPROTO_NAME(FXO, CHAN_CID) = 0x0F, /* Write to DAA */
XPROTO_NAME(FXO, LED) = 0x0F, /* Write to DAA */
};

View File

@@ -386,8 +386,6 @@ static xpd_t *FXS_card_new(xbus_t *xbus, int unit, int subunit, const xproto_tab
int regular_channels;
struct FXS_priv_data *priv;
int i;
int d_inputs = 0;
int d_outputs = 0;
if(!to_phone) {
XBUS_NOTICE(xbus,
@@ -400,30 +398,16 @@ static xpd_t *FXS_card_new(xbus_t *xbus, int unit, int subunit, const xproto_tab
else
regular_channels = min(8, subunit_ports);
channels = regular_channels;
/* Calculate digital inputs/outputs */
if(unit == 0 && subtype != 4) {
if(unit == 0)
channels += 6; /* 2 DIGITAL OUTPUTS, 4 DIGITAL INPUTS */
d_inputs = LINES_DIGI_INP;
d_outputs = LINES_DIGI_OUT;
}
xpd = xpd_alloc(xbus, unit, subunit, subtype, subunits, sizeof(struct FXS_priv_data), proto_table, channels);
if(!xpd)
return NULL;
/* Initialize digital inputs/outputs */
if (d_inputs) {
XBUS_DBG(GENERAL, xbus, "Initialize %d digital inputs\n",
d_inputs);
PHONEDEV(xpd).digital_inputs =
BITMASK(d_inputs) << (regular_channels + d_outputs);
} else
XBUS_DBG(GENERAL, xbus, "No digital inputs\n");
if (d_outputs) {
XBUS_DBG(GENERAL, xbus, "Initialize %d digital outputs\n",
d_outputs);
PHONEDEV(xpd).digital_outputs =
BITMASK(d_outputs) << regular_channels;
} else
XBUS_DBG(GENERAL, xbus, "No digital outputs\n");
if(unit == 0) {
XBUS_DBG(GENERAL, xbus, "First XPD detected. Initialize digital outputs/inputs\n");
PHONEDEV(xpd).digital_outputs = BITMASK(LINES_DIGI_OUT) << regular_channels;
PHONEDEV(xpd).digital_inputs = BITMASK(LINES_DIGI_INP) << (regular_channels + LINES_DIGI_OUT);
}
PHONEDEV(xpd).direction = TO_PHONE;
xpd->type_name = "FXS";
if(fxs_proc_create(xbus, xpd) < 0)
@@ -1158,7 +1142,7 @@ static int FXS_card_tick(xbus_t *xbus, xpd_t *xpd)
priv = xpd->priv;
BUG_ON(!priv);
#ifdef POLL_DIGITAL_INPUTS
if (poll_digital_inputs && PHONEDEV(xpd).digital_inputs) {
if(poll_digital_inputs && xpd->xbus_idx == 0) {
if((xpd->timer_count % poll_digital_inputs) == 0)
poll_inputs(xpd);
}
@@ -1270,13 +1254,6 @@ static void process_digital_inputs(xpd_t *xpd, const reg_cmd_t *info)
bool offhook = (REG_FIELD(info, data_low) & 0x1) == 0;
xpp_line_t lines = BIT(info->portnum);
/* Sanity check */
if (!PHONEDEV(xpd).digital_inputs) {
XPD_NOTICE(xpd,
"%s called without digital inputs. Ignored\n",
__func__);
return;
}
/* Map SLIC number into line number */
for(i = 0; i < ARRAY_SIZE(input_channels); i++) {
int channo = input_channels[i];
@@ -1300,8 +1277,7 @@ static void process_digital_inputs(xpd_t *xpd, const reg_cmd_t *info)
#endif
static const char dtmf_digits[] = {
'D', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '*', '#',
'A', 'B', 'C'
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '*', '#', 'A', 'B', 'C', 'D'
};
/*
@@ -1323,6 +1299,12 @@ static void process_dtmf(xpd_t *xpd, uint portnum, byte val)
return;
priv = xpd->priv;
val &= 0xF;
if(val <= 0) {
if(key_down)
XPD_NOTICE(xpd, "Bad DTMF value %d. Ignored\n", val);
return;
}
val--;
digit = dtmf_digits[val];
want_mute = IS_SET(priv->want_dtmf_mute, portnum);
want_event = IS_SET(priv->want_dtmf_events, portnum);
@@ -1384,7 +1366,7 @@ static int FXS_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info)
/*
* Process digital inputs polling results
*/
else if (!indirect && regnum == REG_DIGITAL_IOCTRL) {
else if(xpd->xbus_idx == 0 && !indirect && regnum == REG_DIGITAL_IOCTRL) {
process_digital_inputs(xpd, info);
}
#endif

View File

@@ -27,6 +27,7 @@
enum fxs_opcodes {
XPROTO_NAME(FXS, SIG_CHANGED) = 0x06,
/**/
XPROTO_NAME(FXS, XPD_STATE) = 0x0F, /* Write to SLIC */
XPROTO_NAME(FXS, CHAN_POWER) = 0x0F, /* Write to SLIC */
XPROTO_NAME(FXS, CHAN_CID) = 0x0F, /* Write to SLIC */
XPROTO_NAME(FXS, LED) = 0x0F, /* Write to SLIC */

View File

@@ -642,6 +642,7 @@ static void global_packet_dump(const char *msg, xpacket_t *pack)
DBG(GENERAL, "%s\n", msg);
}
#define MAX_ENV_STR 40
#define MAX_PATH_STR 128
int run_initialize_registers(xpd_t *xpd)
@@ -650,7 +651,6 @@ int run_initialize_registers(xpd_t *xpd)
xbus_t *xbus;
char busstr[MAX_ENV_STR];
char busnumstr[MAX_ENV_STR];
char modelstr[MAX_ENV_STR];
char unitstr[MAX_ENV_STR];
char subunitsstr[MAX_ENV_STR];
char typestr[MAX_ENV_STR];
@@ -668,7 +668,6 @@ int run_initialize_registers(xpd_t *xpd)
char *envp[] = {
busstr,
busnumstr,
modelstr,
unitstr,
subunitsstr,
typestr,
@@ -704,7 +703,6 @@ int run_initialize_registers(xpd_t *xpd)
}
snprintf(busstr, MAX_ENV_STR, "XBUS_NAME=%s", xbus->busname);
snprintf(busnumstr, MAX_ENV_STR, "XBUS_NUMBER=%d", xbus->num);
snprintf(modelstr, MAX_ENV_STR, "XBUS_MODEL_STRING=%s", xbus->transport.model_string);
snprintf(unitstr, MAX_ENV_STR, "UNIT_NUMBER=%d", xpd->addr.unit);
snprintf(typestr, MAX_ENV_STR, "UNIT_TYPE=%d", xpd->type);
snprintf(subunitsstr, MAX_ENV_STR, "UNIT_SUBUNITS=%d", xpd->subunits);

View File

@@ -80,7 +80,6 @@ static int pri_shutdown(struct dahdi_span *span);
static int pri_rbsbits(struct dahdi_chan *chan, int bits);
static int pri_lineconfig(xpd_t *xpd, int lineconfig);
static void send_idlebits(xpd_t *xpd, bool saveold);
static int apply_pri_protocol(xpd_t *xpd);
#define PROC_REGISTER_FNAME "slics"
@@ -91,29 +90,17 @@ enum pri_protocol {
PRI_PROTO_J1 = 3
};
static const char *protocol_names[] = {
[PRI_PROTO_0] = "??", /* unknown */
[PRI_PROTO_E1] = "E1",
[PRI_PROTO_T1] = "T1",
[PRI_PROTO_J1] = "J1"
};
static const char *pri_protocol_name(enum pri_protocol pri_protocol)
{
static const char *protocol_names[] = {
[PRI_PROTO_0] = "??", /* unknown */
[PRI_PROTO_E1] = "E1",
[PRI_PROTO_T1] = "T1",
[PRI_PROTO_J1] = "J1"
};
return protocol_names[pri_protocol];
}
static enum pri_protocol pri_protocol_bystr(const char *spantype)
{
int i;
for (i = 0; i < ARRAY_SIZE(protocol_names); i++) {
if (strcasecmp(protocol_names[i], spantype) == 0)
return i;
}
return PRI_PROTO_0;
}
static int pri_num_channels(enum pri_protocol pri_protocol)
{
static int num_channels[] = {
@@ -564,14 +551,12 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
unsigned int dchan_num;
int default_lineconfig = 0;
int ret;
struct phonedev *phonedev;
BUG_ON(!xpd);
priv = xpd->priv;
phonedev = &PHONEDEV(xpd);
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &phonedev->span.flags)) {
XPD_NOTICE(xpd, "%s: %s already assigned as span %d\n",
__func__, phonedev->span.name, phonedev->span.spanno);
if(SPAN_REGISTERED(xpd)) {
XPD_NOTICE(xpd, "Registered as span %d. Cannot do setup pri protocol (%s)\n",
PHONEDEV(xpd).span.spanno, __FUNCTION__);
return -EBUSY;
}
if(priv->pri_protocol != PRI_PROTO_0) {
@@ -611,8 +596,8 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
}
priv->pri_protocol = set_proto;
priv->is_cas = -1;
phonedev->channels = pri_num_channels(set_proto);
phonedev->offhook_state = BITMASK(phonedev->channels);
PHONEDEV(xpd).channels = pri_num_channels(set_proto);
PHONEDEV(xpd).offhook_state = BITMASK(PHONEDEV(xpd).channels);
CALL_PHONE_METHOD(card_pcm_recompute, xpd, 0);
priv->deflaw = deflaw;
priv->dchan_num = dchan_num;
@@ -620,7 +605,7 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
xpd->type_name = type_name(priv->pri_protocol);
XPD_DBG(GENERAL, xpd, "%s, channels=%d, dchan_num=%d, deflaw=%d\n",
pri_protocol_name(set_proto),
phonedev->channels,
PHONEDEV(xpd).channels,
priv->dchan_num,
priv->deflaw
);
@@ -633,7 +618,7 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
XPD_NOTICE(xpd, "Failed setting PRI default line config\n");
return ret;
}
return apply_pri_protocol(xpd);
return 0;
}
static void dahdi_update_syncsrc(xpd_t *xpd)
@@ -1044,17 +1029,6 @@ bad_lineconfig:
return -EINVAL;
}
static int pri_set_spantype(struct dahdi_span *span, const char *spantype)
{
struct phonedev *phonedev = container_of(span, struct phonedev, span);
xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
enum pri_protocol set_proto = PRI_PROTO_0;
XPD_INFO(xpd, "%s: %s\n", __func__, spantype);
set_proto = pri_protocol_bystr(spantype);
return set_pri_proto(xpd, set_proto);
}
/*
* Called only for 'span' keyword in /etc/dahdi/system.conf
*/
@@ -1230,7 +1204,6 @@ static int pri_audio_notify(struct dahdi_chan *chan, int on)
static const struct dahdi_span_ops PRI_span_ops = {
.owner = THIS_MODULE,
.set_spantype = pri_set_spantype,
.spanconfig = pri_spanconfig,
.chanconfig = pri_chanconfig,
.startup = pri_startup,
@@ -1242,7 +1215,6 @@ static const struct dahdi_span_ops PRI_span_ops = {
.maint = xpp_maint,
.echocan_create = xpp_echocan_create,
.echocan_name = xpp_echocan_name,
.assigned = xpp_span_assigned,
#ifdef DAHDI_SYNC_TICK
.sync_tick = dahdi_sync_tick,
#endif
@@ -1255,7 +1227,7 @@ static const struct dahdi_span_ops PRI_span_ops = {
#endif
};
static int apply_pri_protocol(xpd_t *xpd)
static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
{
xbus_t *xbus;
struct PRI_priv_data *priv;
@@ -1265,7 +1237,15 @@ static int apply_pri_protocol(xpd_t *xpd)
xbus = xpd->xbus;
priv = xpd->priv;
BUG_ON(!xbus);
XPD_DBG(GENERAL, xpd, "\n");
XPD_DBG(GENERAL, xpd, "%s (proto=%s, channels=%d, deflaw=%d)\n",
(on)?"on":"off",
pri_protocol_name(priv->pri_protocol),
PHONEDEV(xpd).channels,
priv->deflaw);
if(!on) {
/* Nothing to do yet */
return 0;
}
PHONEDEV(xpd).span.spantype = pri_protocol_name(priv->pri_protocol);
PHONEDEV(xpd).span.linecompat = pri_linecompat(priv->pri_protocol);
PHONEDEV(xpd).span.deflaw = priv->deflaw;
@@ -1288,32 +1268,9 @@ static int apply_pri_protocol(xpd_t *xpd)
}
PHONEDEV(xpd).offhook_state = PHONEDEV(xpd).wanted_pcm_mask;
PHONEDEV(xpd).span.ops = &PRI_span_ops;
PHONEDEV(xpd).span.channels = PHONEDEV(xpd).channels;
xpd_set_spanname(xpd);
return 0;
}
static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
{
xbus_t *xbus;
struct PRI_priv_data *priv;
BUG_ON(!xpd);
xbus = xpd->xbus;
priv = xpd->priv;
BUG_ON(!xbus);
XPD_DBG(GENERAL, xpd, "%s (proto=%s, channels=%d, deflaw=%d)\n",
(on)?"on":"off",
pri_protocol_name(priv->pri_protocol),
PHONEDEV(xpd).channels,
priv->deflaw);
if(!on) {
/* Nothing to do yet */
return 0;
}
return apply_pri_protocol(xpd);
}
static int PRI_card_dahdi_postregistration(xpd_t *xpd, bool on)
{
xbus_t *xbus;
@@ -2243,7 +2200,41 @@ static DEVICE_ATTR_READER(pri_protocol_show, dev, buf)
return len;
}
static DEVICE_ATTR(pri_protocol, S_IRUGO, pri_protocol_show, NULL);
static DEVICE_ATTR_WRITER(pri_protocol_store, dev, buf, count)
{
xpd_t *xpd;
enum pri_protocol new_protocol = PRI_PROTO_0;
int i;
int ret;
BUG_ON(!dev);
xpd = dev_to_xpd(dev);
XPD_DBG(GENERAL, xpd, "%s\n", buf);
if(!xpd)
return -ENODEV;
if((i = strcspn(buf, " \r\n")) != 2) {
XPD_NOTICE(xpd,
"Protocol name '%s' has %d characters (should be 2). Ignored.\n",
buf, i);
return -EINVAL;
}
if(strnicmp(buf, "E1", 2) == 0)
new_protocol = PRI_PROTO_E1;
else if(strnicmp(buf, "T1", 2) == 0)
new_protocol = PRI_PROTO_T1;
else if(strnicmp(buf, "J1", 2) == 0)
new_protocol = PRI_PROTO_J1;
else {
XPD_NOTICE(xpd,
"Unknown PRI protocol '%s' (should be E1|T1|J1). Ignored.\n",
buf);
return -EINVAL;
}
ret = set_pri_proto(xpd, new_protocol);
return (ret < 0) ? ret : count;
}
static DEVICE_ATTR(pri_protocol, S_IRUGO | S_IWUSR, pri_protocol_show, pri_protocol_store);
static DEVICE_ATTR_READER(pri_localloop_show, dev, buf)
{

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
#
# $Id: PIC_TYPE_1.hex 9732 2011-08-24 19:13:55Z dima $
# $Id: PIC_TYPE_1.hex 7498 2009-11-17 11:38:56Z dima $
#
:03000000A1EA4A28
:03000100C41C41DB
@@ -99,394 +99,369 @@
:03005F009011807D
:03006000C11E704E
:0300610019074339
:03006200643A728B
:03006200643A6D90
:03006300A68C0266
:03006400C2218036
:03006500190E076A
:03006500190E036E
:03006600743643AA
:03006700A8CA75AF
:03006700A8CA70B4
:03006800209C03D6
:0300690002118001
:03006A00C44E077A
:03006A00C44E037E
:03006B00D8064371
:03006C00024A75D0
:03006D00C00C04C0
:03006E00022180EC
:03006F00201E0749
:0300700003064341
:03007100901A756D
:03007200204C011E
:030073000300384F
:03007400901A746B
:03007500202C1824
:03006C00024A70D5
:03006D00C00C01C3
:03006E0002203835
:03006F00201A6FE5
:03007000030C1866
:03007100901038B4
:0300720020421910
:03007300030E0F6A
:0300740090103DAC
:03007500202C003C
:030076000300384C
:03007700901219CB
:03007800210E0F47
:03007900E0303D37
:03007A00743C00D3
:03007B00C040384A
:03007C00190C025A
:03007D007481800B
:03007E00A8CE0702
:03007F00C0474334
:03008000FFFA85FF
:03008100150C3F1C
:03008200643031B6
:03008300A87C1640
:03008400209A922D
:0300850013EC0376
:03008600A8A180AE
:03008700209E07B1
:03008800FFF7433C
:0300890017EA8EE5
:03008A0021ECFF67
:03008B00035031EE
:03008C00C14C184C
:03008D00D80A92FC
:03008E00024C031E
:03008F00C000317D
:03009000022C122D
:03009100201A92A0
:0300920003003C2C
:03009300901E0FAD
:0300940020409D6C
:030095000307035B
:03009600901A9C21
:03009700202C0F0B
:03009800030FFF54
:0300990090115C67
:03009A0021011D24
:03009B00E01A9DCB
:03009C0002721CD1
:03009D00C18030EF
:03009E00D80E0F6A
:03009F0002403CE0
:0300A000C00C028F
:0300A10002203901
:0300A200201C001F
:0300A3000300391E
:0300A400901C802D
:0300A500204024D4
:0300A600030C0840
:0300A700901104B1
:0300A800202039DC
:0300A900030C0045
:0300AA009010397A
:0300AB00210C0025
:0300AC0003B02678
:0300AD00C140252A
:0300AE0002403ECF
:0300AF00C0102B53
:0300B000022C031C
:0300B10020102CF0
:0300B200030C40FC
:0300B30090103971
:0300B4002047D909
:0300B500030AB487
:0300B600901C009B
:0300B700207208AC
:0300B80003003012
:0300B9009019019A
:0300BA0021AC80F6
:0300BB0014120814
:0300BC0070703031
:0300BD00AC09018A
:0300BE00181C40CB
:0300BF00AC303929
:0300C00069BC0117
:0300C100AFA037B6
:0300C200F00C60DF
:0300C3002282C8CE
:0300C400643AC3D8
:0300C500AFAC00DD
:0300C6001BA03745
:0300C700C106D996
:0300C800FFFACC70
:0300C90017B6F96E
:0300CA0021ABCF98
:0300CB00141AC73D
:0300CC0064394252
:0300CD00AD0C0275
:0300CE00C10180ED
:0300CF0013BE0756
:0300D000C507431E
:0300D100039AEDA2
:0300D200799C0610
:0300D300AD2195C7
:0300D40020B7430F
:0300D500D00AED61
:0300D6000387D3CA
:0300D700219AED7E
:0300D800E07C06C3
:0300D900348187E8
:0300DA0034874325
:0300DB00348ADE86
:0300DC00348C035E
:0300DD00030AEB28
:0300DE00206C078C
:0300DF00348187E2
:0300E0003487431F
:0300E100348AE47A
:0300E200348C015A
:0300E300D05AEB05
:0300E400031C03F7
:0300E500C00187D0
:0300E600032743AA
:0300E700033AEAEF
:0300E800C70C0042
:0300E900039AEB8C
:0300EA00C5020745
:0300EB0003902758
:0300EC00C18AFACC
:0300ED00030C06FB
:0300EE00C00195B9
:0300EF00031643B2
:0300F00021BAFA38
:0300F100032C01DC
:0300F200C001C783
:0300F30003309C3B
:0300F400C7070338
:0300F500039AFA71
:0300F600C50CFF37
:0300F70003902251
:0300F800C400271A
:0300F900039B6204
:0300FA00369C0031
:0300FB00C016F339
:0300FC001E6CFF78
:0300FD0021C021FE
:0300FE00086C018A
:0300FF0074302436
:03010000A1E90A68
:030101000266B3E0
:03010200C02B8986
:03010300FFFC01FD
:0301040016B02F03
:03010500C0221500
:0301060023E6D31A
:03010700743D80C4
:0301080012B0240E
:0301090020B2170A
:03010A000380224D
:03010B00C44C06DB
:03010C00039195C7
:03010D00C40743E1
:03010E00039B51FF
:03010F00C006D354
:03011000023B515E
:03011100ABECE074
:03011200B12157C1
:03011300000643A0
:03011400000B518C
:03011500000C00DB
:030116000007B728
:03011700000C05D4
:030118000007D706
:03011900000C10C7
:03011A000007F7E4
:03011B00000C02D3
:03011C00000027B9
:03011D00000C10C3
:03011E00000D02CF
:03011F00000FFFCF
:0301200000014299
:030121000006973E
:03012200000D02CB
:030123000006379C
:03012400000D10BB
:03012500000022B5
:03012600000C804A
:03012700000124B0
:03012800000C02C6
:0301290000018052
:03012A00000E07BD
:03012B0000074387
:03012C00000B3F86
:03012D00000C05BE
:03012E0000014786
:03012F0000064384
:03013000000B3F82
:03013100000C01BE
:0301320000018148
:030133000007437F
:03013400000B3885
:03013500000C10AB
:03013600000021A5
:03013700000B3F7B
:03013800000C10A8
:0301390000018141
:03013A0000074378
:03013B00000B3F77
:03013C00000C2094
:03013D000000219E
:03013E00000B3F74
:03013F00000201BA
:030140000000308C
:03014100000901B1
:03014200000204B4
:0301430000003089
:03014400000901AE
:03014500000202B3
:0301460000003086
:03014700000901AB
:03014800000C8028
:03014900000FFFA5
:03014A000001644D
:03014B00000207A8
:03014C000001624D
:03014D00000FFFA1
:03014E000001505D
:03014F00000D0898
:0301500000012289
:03015100000201A8
:030152000000307A
:030153000009019F
:03015400000204A2
:0301550000003077
:030156000009019C
:03015700000202A1
:0301580000003074
:0301590000090199
:03015A00000C0096
:03015B0000002F72
:03015C000007D3C6
:03015D00000B8410
:03015E000002108C
:03015F000000227B
:0301600000020E8C
:0301610000002774
:03016200000C503E
:0301630000003960
:03016400000799F8
:03016500000B6428
:0301660000021282
:0301670000003065
:030168000002147E
:0301690000003162
:03016A000002137D
:03016B000006B3D8
:03016C00000D1073
:03016D000000325D
:03007700901C02D8
:03007800210180E3
:03007900E03E0363
:03007A0074374395
:03007B00C04A80F8
:03007C00190C3F1D
:03007D007480315B
:03007E00A8CC16F5
:03007F00C04A84F0
:03008000FFFCFF83
:0300810015003136
:03008200643C18C3
:03008300A87A84D4
:0300840020903C8D
:0300850013EE0F68
:03008600A8A09D92
:03008700209703BC
:03008800FFFA8EEE
:0300890017EC0F62
:03008A0021EFFF64
:03008B0003515CC2
:03008C00C1411D52
:03008D00D80A8FFF
:03008E0002421C0F
:03008F00C000307E
:03009000022E0F2E
:0300910020103C00
:03009200030C025A
:0300930090103991
:03009400204C00FD
:030095000300392C
:03009600901C803B
:0300970020202402
:03009800030C084E
:03009900901104BF
:03009A0021003909
:03009B00E01C0066
:03009C00027039B6
:03009D00C18C0013
:03009E00D8002661
:03009F00024025F7
:0300A000C0003E5F
:0300A10002202B0F
:0300A200201C031C
:0300A30003002C2B
:0300A400901C00AD
:0300A500204208EE
:0300A60003003024
:0300A700901901AC
:0300A800202C8089
:0300A90003020847
:0300AA0090103083
:0300AB0021090127
:0300AC0003BC4052
:0300AD00C1403916
:0300AE000246D92E
:0300AF00C01AB3C1
:0300B0000226F92C
:0300B100201BB65B
:0300B200030AAE90
:0300B3009019425F
:0300B400204C02DB
:0300B500030180C4
:0300B600901E0396
:0300B7002077436C
:0300B800030AD464
:0300B900901C0692
:0300BA0021A195EC
:0300BB00141743D4
:0300BC00707AD483
:0300BD00AC07D3BA
:0300BE00181AD439
:0300BF00AC3C0650
:0300C00069B1879C
:0300C100AFA743A3
:0300C200F00AC57C
:0300C300228C0389
:0300C400643AD2C9
:0300C500AFAC07D6
:0300C6001BA187F4
:0300C700C107432B
:0300C800FFFACB71
:0300C90017BC0160
:0300CA0021AAD296
:0300CB00141C03FF
:0300CC0064318715
:0300CD00AD074339
:0300CE00C10AD193
:0300CF0013BC005F
:0300D000C50AD28C
:0300D10003920790
:0300D200799027FB
:0300D300AD2AE172
:0300D40020BC0647
:0300D500D00195C2
:0300D6000386435B
:0300D700219AE18A
:0300D800E07C01C8
:0300D9003481C7A8
:0300DA0034809CD3
:0300DB0034870364
:0300DC00348AE182
:0300DD00030CFF12
:0300DE002060227D
:0300DF0034802743
:0300E000348B4915
:0300E100348C005C
:0300E2003486F36E
:0300E300D05CFFEF
:0300E400031021E5
:0300E500C00C014B
:0300E600032024D0
:0300E70003390AD0
:0300E800C706B395
:0300E900039B7006
:0300EA00C50C0141
:0300EB0003902F50
:0300EC00C18215B9
:0300ED000306D334
:0300EE00C00D80C2
:0300EF00031024D7
:0300F00021B21723
:0300F100032022C7
:0300F200C00C0639
:0300F30003319541
:0300F400C70743F8
:0300F500039B3832
:0300F600C506D369
:0300F700039B3830
:0300F800C40CE055
:0300F90003915719
:0300FA00369643F4
:0300FB00C01B38EF
:0300FC001E6C0077
:0300FD0021C7B761
:0300FE00086C0586
:0300FF007437D77C
:03010000A1EC105F
:030101000267F79B
:03010200C02C020C
:03010300FFF027E3
:0301040016BC1016
:03010500C02D0208
:0301060023EFFFE5
:030107007431420E
:0301080012B69795
:0301090020BD0214
:03010A0003863732
:03010B00C44D10D0
:03010C000390223B
:03010D00C40C809F
:03010E0003912436
:03010F00C00C021F
:0301100002318039
:03011100AACE0370
:03011200B12743CF
:03011300000B26B8
:03011400000C05D7
:030115000001479F
:030116000006439D
:03011700000B26B4
:03011800000C01D7
:0301190000018161
:03011A0000074398
:03011B00000B1FB7
:03011C00000C10C4
:03011D00000021BE
:03011E00000B26AD
:03011F00000C10C1
:030120000001815A
:0301210000074391
:03012200000B26A9
:03012300000C20AD
:03012400000021B7
:03012500000B26A6
:03012600000201D3
:03012700000030A5
:03012800000901CA
:03012900000204CD
:03012A00000030A2
:03012B00000901C7
:03012C00000202CC
:03012D000000309F
:03012E00000901C4
:03012F00000C8041
:03013000000FFFBE
:0301310000016466
:03013200000207C1
:0301330000016266
:03013400000FFFBA
:0301350000015076
:03013600000D08B1
:03013700000122A2
:03013800000201C1
:0301390000003093
:03013A00000901B8
:03013B00000204BB
:03013C0000003090
:03013D00000901B5
:03013E00000202BA
:03013F000000308D
:03014000000901B2
:03014100000C00AF
:0301420000002F8B
:030143000007D3DF
:03014400000B6B42
:03014500000210A5
:0301460000002294
:0301470000020EA5
:030148000000278D
:03014900000C5057
:03014A0000003979
:03014B0000079911
:03014C00000B4B5A
:03014D000002129B
:03014E000000307E
:03014F0000021497
:030150000000317B
:0301510000021396
:030152000006B3F1
:03015300000D108C
:0301540000003276
:03015500000C009B
:0301560000003373
:03015700000C7029
:030158000000396B
:03015900000C5047
:03015A0000003969
:03015B000002158A
:03015C0000003070
:03015D0000021687
:03015E000000316D
:03015F0000020299
:030160000000326A
:03016100000C008F
:030162000006B3E1
:0301630000020790
:0301640000003365
:03016500000C701B
:030166000000395D
:03016700000C5039
:030168000000395B
:03016900000C4047
:03016A0000003959
:03016B00000C0085
:03016C0000003957
:03016D00000C0083
:03016E00000C0082
:03016F000000335A
:03017000000C7010
:0301710000003952
:03017200000C502E
:0301730000003950
:0301740000021571
:0301750000003057
:030176000002166E
:0301770000003154
:0301780000020280
:0301790000003251
:03017A00000C0076
:03017B000006B3C8
:03017C0000020777
:03017D000000334C
:03017E00000C7002
:03017F0000003944
:03018000000C5020
:0301810000003942
:03018200000C402E
:0301830000003940
:03018400000C006C
:030185000000393E
:03018600000C006A
:03018700000C0069
:03018800000ABEAC
:03018900000C0265
:03018A0000002F43
:03018B00000C0A5B
:03018C0000002A46
:03018D00000C0063
:03018E000000244A
:03018F000007D393
:03019000000BACB5
:0301910000020168
:030192000000303A
:030193000009015F
:0301940000021551
:0301950000003037
:030196000009015C
:030197000002164D
:03016F00000AACD7
:03017000000C027E
:0301710000002F5C
:03017200000C0A74
:0301730000002A5F
:03017400000C007C
:0301750000002463
:030176000007D3AC
:03017700000B93E7
:0301780000020181
:0301790000003053
:03017A0000090178
:03017B000002156A
:03017C0000003050
:03017D0000090175
:03017E0000021666
:03017F000000304D
:0301800000090172
:03018100000C1F50
:03018200000D80ED
:0301830000002257
:0301840000020175
:0301850000003047
:030186000009016C
:0301870000020271
:0301880000003044
:0301890000090169
:03018A000002046C
:03018B0000003041
:03018C0000090166
:03018D000002EA83
:03018E0000071057
:03018F00000B91D1
:03019000000B84DD
:030191000007D391
:03019200000BB1AE
:03019300000C1D40
:030194000006D38F
:03019500000D80DA
:0301960000002244
:0301970000020162
:0301980000003034
:0301990000090159
:03019A00000C1F37
:03019B00000D80D4
:03019C000000223E
:03019D000002015C
:03019A000002025E
:03019B0000003031
:03019C0000090156
:03019D0000021845
:03019E000000302E
:03019F0000090153
:0301A00000020258
:0301A1000000302B
:0301A20000090150
:0301A30000020453
:0301A40000003028
:0301A5000009014D
:0301A6000002EA6A
:0301A7000007103E
:0301A800000BAA9F
:0301A900000B9DAB
:0301AA000007D378
:0301AB00000BCA7C
:0301AC00000C1D27
:0301AD000006D376
:0301AE00000D80C1
:0301AF000000222B
:0301B00000020149
:0301B1000000301B
:0301B20000090140
:0301B30000020245
:0301B40000003018
:0301B5000009013D
:0301B6000002182C
:0301B70000003015
:0301B8000009013A
:0301B90000021031
:0301BA0000002E14
:0301BB00000C1C19
:0301BC000006D367
:0301BD00000D80B2
:0301BE000000221C
:0301BF000002013A
:0301C0000000300C
:0301C10000090131
:0301C20000020236
:0301C30000003009
:0301C4000009012E
:0301C5000002171E
:0301C60000003006
:0301C7000009012B
:0301C8000007D35A
:0301C900000B9197
:0301CA00000C0026
:0301CB0000002F02
:0301CC000007D356
:0301CD00000B84A0
:0301CE00000B5EC5
:0301CF00000C071A
:0301D00000002FFD
:0301D100000C041B
:0301D20000002109
:0301D300000C001D
:0301D40000091E01
:0301D500000C100B
:0301D60000002105
:0301D700000C0811
:0301D80000091EFD
:0301D900000C40D7
:0301DA0000002101
:0301DB00000C1005
:0301DC0000091EF9
:0301DD00000C0013
:0301DE00000026F8
:0301DF00000C0110
:0301E000000029F3
:0301E100000C000F
:0301E20000002FEB
:0301E300000C20ED
:0301E400000023F5
:0301E500000A000D
:0301E600000ABE4E
:0301E700000BE723
:0301A0000002104A
:0301A10000002E2D
:0301A200000C1C32
:0301A3000006D380
:0301A400000D80CB
:0301A50000002235
:0301A60000020153
:0301A70000003025
:0301A8000009014A
:0301A9000002024F
:0301AA0000003022
:0301AB0000090147
:0301AC0000021737
:0301AD000000301F
:0301AE0000090144
:0301AF000007D373
:0301B000000B78C9
:0301B100000C003F
:0301B20000002F1B
:0301B3000007D36F
:0301B400000B6BD2
:0301B500000B45F7
:0301B600000C0733
:0301B70000002F16
:0301B800000C0434
:0301B90000002122
:0301BA00000C0036
:0301BB0000091E1A
:0301BC00000C1024
:0301BD000000211E
:0301BE00000C082A
:0301BF0000091E16
:0301C000000C40F0
:0301C1000000211A
:0301C200000C101E
:0301C30000091E12
:0301C400000C002C
:0301C50000002611
:0301C600000C0129
:0301C7000000290C
:0301C800000C0028
:0301C90000002F04
:0301CA00000C2006
:0301CB000000230E
:0301CC00000A0026
:0301CD00000AAC79
:0301CE00000BCE55
:00000001FF

View File

@@ -1,5 +1,5 @@
#
# $Id: PIC_TYPE_2.hex 9732 2011-08-24 19:13:55Z dima $
# $Id: PIC_TYPE_2.hex 7107 2009-05-18 12:35:20Z dima $
#
:03000000A57A4896
:03000100C41C41DB
@@ -97,264 +97,243 @@
:03005D00E07180CF
:03005E0002CE705F
:03005F00206743D4
:0300600090AA70F3
:0300600090AA6BF8
:03006100205C021E
:03006200D2018048
:03006300D40E07B1
:03006300D40E03B5
:0300640003D6437D
:03006500C1CA739A
:03006500C1CA6E9F
:03006600022C0366
:03006700C0018055
:03006800024E073E
:03006800024E0342
:0300690021D6435A
:03006A00030A7313
:03006B00901C04E2
:03006C00202180D0
:03006D00030E0778
:03006E00901643A6
:03006F00204A73B1
:03007000030C017D
:03007100901038B4
:03007200210A72EE
:03007300024C1824
:03006A00030A6E18
:03006B00901C01E5
:03006C0020203819
:03006D00030A6D16
:03006E00901C18CB
:03006F00204038F6
:030070000302196F
:03007100901E0FCF
:0300720021002248
:03007300024C003C
:03007400C0303861
:0300750008421925
:03007600603E0FDA
:03007700A7A0221D
:03007800209C00C9
:03007900A7C038E5
:03007A00C00200C1
:03007B00A7CE0706
:03007C00187F02E8
:03007D0014974392
:03007E00643A835E
:03007F00AABC0018
:030080001A7031C2
:03008100C50C1299
:03008200039A904E
:030083007992006F
:03008400A83E078C
:0300850020BF0396
:03008600D007435D
:03008700038A8C5D
:03008800219C00B8
:03008900E07031F3
:03008A00348C189B
:03008B00348A9024
:03008C00348C00B1
:03008D003480318B
:03008E00030C164A
:03008F00206A9054
:0300900034803B7E
:03009100348E0F9B
:0300920034808235
:03009300348703AC
:03009400D05A9AA5
:03009500031C0F3A
:03009600C00FFF99
:0300970003215BE7
:030098000331022F
:03009900C70A9BF8
:03009A0003921BB3
:03009B00C500306D
:03009C00039E0FB1
:03009D00C1C03BA4
:03009E00030C024E
:03009F00C0003965
:0300A000031C003E
:0300A100204039C3
:0300A200032C80AC
:0300A300C00D0885
:0300A400033039ED
:0300A500C70C0085
:0300A6000390398B
:0300A700C50C4045
:0300A80003903989
:0300A900C407D9B0
:0300AA00039AA90D
:0300AB0020CC0066
:0300AC0074302687
:0300AD00B1702708
:0300AE00C0002B64
:0300AF00024020EC
:0300B000C05C032E
:0300B10002202CFE
:0300B200205C20AF
:0300B300D20D80EB
:0300B400D4002550
:0300B50003DC2049
:0300B60021D02432
:0300B700030C0037
:0300B80090102283
:0300B900202205FD
:0300BA0003003010
:0300BB0090190198
:0300BC00204204DB
:0300BD000300300D
:0300BE0090190195
:0300BF00C012026A
:0300C000150030F8
:0300C100024901F0
:0300C20021AC402E
:0300C3009420394D
:0300C400202C01EC
:0300C50003A0375E
:0300C600206C604B
:0300C7007432C8C8
:0300C800AD5AC767
:0300C900C9FC006F
:0300CA0016B03736
:0300CB00C006D993
:0300CC006B0AD0EC
:0300CD00D206F95F
:0300CE006D0B4D6A
:0300CF00D40ACB85
:0300D00012B94022
:0300D100C80C2038
:0300D2001AB195CB
:0300D30020B64311
:0300D400038ADFBD
:0300D500206C019B
:0300D60002A1DFA5
:0300D700C0409B8B
:0300D800086703B3
:0300D900703ADF9B
:0300DA00ADE7D3BC
:0300DB00C00B480F
:0300DC00024CFFD4
:0300DD00AE202230
:0300DE00C04B2AEA
:0300DF000AA21F53
:0300E000C0290A2A
:0300E100024C20AE
:0300E200917125F4
:0300E300C016D371
:0300E40003EAEA42
:0300E500206C206C
:0300E600643095EE
:0300E700AEB6436F
:0300E80037EAF202
:0300E9002C8AEF6F
:0300EA00AE8C4099
:0300EB00C6012526
:0300EC00150C00F0
:0300ED0074302448
:0300EE00AFFB1A4B
:0300EF0021E217F4
:0300F0001AF024DF
:0300F10014FB1AE3
:0300F200743C401B
:0300F300B17105E3
:0300F400C0403DCC
:0300F500124C00AA
:0300F600917024E2
:0300F700C0021D27
:0300F80002403093
:0300F900200901DA
:0300FA0094221538
:0300FB0020203092
:0300FC00020901F5
:0300FD00035204A7
:0300FE00B17030AE
:0300FF00CFF90135
:0301000019E210F1
:0301010016F024D1
:03010200C037F70C
:03010300081B0BCB
:03010400743C0246
:03010500B0EFFF59
:03010600C01164C1
:03010700024C02A5
:030108002001577C
:030109009421241A
:03010A00202B1790
:03010B000207D711
:03010C00035B177B
:03010D00B17C01C1
:03010E00C00FFF20
:03010F0018116460
:03011000643C014B
:030111006B015728
:03011200B14124D4
:03011300B17B17A6
:03011400C01217FF
:0301150012402471
:03011600917B17C3
:03011700369C0211
:03011800C01D0106
:030119001E616400
:03011A0021BC8085
:03011B000866F380
:03011C0074312516
:03011D00A57205C3
:03011E000260304C
:03011F00C02901F3
:03012000FFF215D6
:0301210016B030E5
:03012200C02901F0
:0301230023A20410
:0301240074303004
:0301250012B9010B
:0301260020B7D32C
:03012700038B48FF
:03012800C44210BE
:030129000390221E
:03012A00C40C50B2
:03012B0003903905
:03012C00C0079970
:03012D00023B2C66
:03012E00AC2212EE
:03012F00B2F030FB
:03013000000214B6
:030131000000319A
:03013200000213B5
:0301330000003297
:03013400000C00BC
:0301350000003394
:03013600000C704A
:030137000000398C
:03013800000C5068
:030139000000398A
:03013A00000215AB
:03013B0000003091
:03013C00000C00B4
:03013D000000318E
:03013E00000202BA
:03013F000000328B
:03014000000C00B0
:0301410000003388
:03014200000C703E
:0301430000003980
:03014400000C505C
:030145000000397E
:03014600000C406A
:030147000000397C
:03014800000C00A8
:030149000000397A
:03014A00000C00A6
:03014B00000C00A5
:03014C00000AC2E4
:03014D00000C00A3
:03014E0000002589
:03014F00000C1091
:0301500000003D6F
:030151000009178B
:03015200000C049A
:0301530000002584
:03015400000C009C
:0301550000003D6A
:0301560000091786
:03015700000C0297
:030158000000257F
:03015900000C088F
:03015A0000003D65
:03015B0000091781
:03015C00000C0094
:03015D0000002679
:03015E00000C0191
:03015F0000002974
:03016000000C2070
:0301610000002378
:03016200000A0090
:03016300000B632B
:030075000842003E
:03007600603E03E6
:03007700A7AF022E
:030078002097438B
:03007900A7CA7E95
:03007A00C00C00B7
:03007B00A7C031EA
:03007C00187C12DB
:03007D00149A8250
:03007E00643C00DF
:03007F00AAB031F3
:030080001A7C18CF
:03008100C50A822B
:0300820003903BAD
:03008300799E0F54
:03008400A830821F
:0300850020B7039E
:03008600D00A8C11
:03008700038C0FD8
:03008800219FFFB6
:03008900E0715BC8
:03008A00348102BC
:03008B00348A8D27
:03008C0034821BA0
:03008D003480308C
:03008E00030E0F4F
:03008F0020603BB3
:03009000348C02AB
:030091003480397F
:03009200348C00AB
:030093003480397D
:03009400D05C80BD
:03009500031D0840
:03009600C000396E
:03009700032C0037
:03009800033039F9
:03009900C70C4051
:03009A0003903997
:03009B00C507D9BD
:03009C00039A9B29
:03009D00C1CC00D3
:03009E0003002636
:03009F00C0002777
:0300A00003102B1F
:0300A100204020DC
:0300A200032C0329
:0300A300C0002C6E
:0300A400033C20FA
:0300A500C70D8004
:0300A6000390259F
:0300A700C50C2065
:0300A8000390249E
:0300A900C40C0084
:0300AA000390229E
:0300AB0020C2056B
:0300AC007430307D
:0300AD00B1790125
:0300AE00C0020489
:0300AF00024030DC
:0300B000C0590133
:0300B10002220226
:0300B200205030AB
:0300B300D209016E
:0300B400D40C4029
:0300B50003D0393C
:0300B60021D6D977
:0300B700030ABB7E
:0300B8009016F9A6
:0300B900202B38C1
:0300BA00030AB680
:0300BB0090194059
:0300BC00204C20B5
:0300BD00030195A7
:0300BE0090164356
:0300BF00C01ACA9A
:0300C000150C011B
:0300C1000241DF1A
:0300C20021A09BDF
:0300C3009427037C
:0300C400202ACA25
:0300C50003A7D3BB
:0300C600206B3379
:0300C700743CFF87
:0300C800AD502216
:0300C900C9FB155B
:0300CA0016B21F4C
:0300CB00C0090A5F
:0300CC006B0C209A
:0300CD00D2012538
:0300CE006D06D3E9
:0300CF00D40AD57B
:0300D00012BC203F
:0300D100C80095CF
:0300D2001AB64318
:0300D30020BADD73
:0300D400038ADAC2
:0300D500206C405C
:0300D60002A1255F
:0300D700C04C001A
:0300D80008602499
:0300D900703B0574
:0300DA00ADE2177D
:0300DB00C000243E
:0300DC00024B05CF
:0300DD00AE2C4006
:0300DE00C0410519
:0300DF000AA03D37
:0300E000C02C0031
:0300E100024024B6
:0300E20091721DFB
:0300E300C010301A
:0300E40003E9012C
:0300E50020621581
:0300E60064303053
:0300E700AEB901AE
:0300E80037E204F8
:0300E9002C803038
:0300EA00AE8901DB
:0300EB00C602103A
:0300EC00150024D8
:0300ED007437F76E
:0300EE00AFFAF670
:0300EF0021EC02FF
:0300F0001AFFFFF5
:0300F10014F164A3
:0300F200743C0259
:0300F300B1715791
:0300F400C04124E4
:0300F500124B02A9
:0300F6009177D728
:0300F700C00B0239
:0300F800024C01B6
:0300F900200FFFD6
:0300FA00942164EA
:0300FB00202C01B5
:0300FC00020157A7
:0300FD0003512488
:0300FE00B17B02D1
:0300FF00CFF21726
:0301000019E024DF
:0301010016FB02E8
:03010200C03C02FC
:03010300081D01D3
:03010400743164EF
:03010500B0EC80DB
:03010600C016F32D
:030107000241258D
:03010800200205CD
:030109009420300F
:03010A00202901A8
:03010B00020215D8
:03010C000350306D
:03010D00B17901C4
:03010E00C0020428
:03010F0018103095
:030110006439014E
:030111006B07D3A6
:03011200B14B33BB
:03011300B17210B6
:03011400C01022F6
:03011500124C5039
:03011600917039AC
:030117003697997F
:03011800C01B17F2
:030119001E621251
:03011A0021B030E1
:03011B0008621463
:03011C007430310B
:03011D00A57213B5
:03011E000260324A
:03011F00C02C00F1
:03012000FFF033BA
:0301210016BC7099
:03012200C02039C1
:0301230023AC50BA
:03012400743039FB
:0301250012B215FE
:0301260020B030D6
:03012700038C0046
:03012800C440319F
:030129000392023C
:03012A00C40032DC
:03012B00039C0032
:03012C00C00033DD
:03012D00023C7021
:03012E00AB4039AA
:03012F00B2FC50CF
:0301300000003993
:03013100000C407F
:0301320000003991
:03013300000C00BD
:030134000000398F
:03013500000C00BB
:03013600000C00BA
:03013700000AB407
:03013800000C04B4
:030139000000259E
:03013A00000C00B6
:03013B0000003D84
:03013C00000917A0
:03013D00000C02B1
:03013E0000002599
:03013F00000C08A9
:0301400000003D7F
:030141000009179B
:03014200000C06A8
:0301430000002594
:03014400000C109C
:0301450000003D7A
:0301460000091796
:03014700000C00A9
:030148000000268E
:03014900000C01A6
:03014A0000002989
:03014B00000C2085
:03014C000000238D
:03014D00000A00A5
:03014E00000B4E55
:00000001FF

View File

@@ -51,7 +51,6 @@ BEGIN { $init_dir = dirname($0); unshift(@INC, "$init_dir"); }
use XppConfig $init_dir;
my $unit_id;
my %opts;
my $vbat_48 = 0;
getopts('o:', \%opts);
@@ -79,7 +78,6 @@ if (-t STDERR) {
foreach my $k (qw(
XBUS_NAME
XBUS_NUMBER
XBUS_MODEL_STRING
UNIT_NUMBER
UNIT_TYPE
UNIT_SUBUNITS
@@ -92,10 +90,6 @@ if (-t STDERR) {
die;
}
}
logit "XBUS_MODEL_STRING='$ENV{XBUS_MODEL_STRING}'";
if ($ENV{XBUS_MODEL_STRING} =~ m{.*/.*/201}) {
$vbat_48 = 1;
}
$chipregs = sprintf "/sys/bus/xpds/devices/%02d:%1d:0/chipregs",
$ENV{XBUS_NUMBER}, $ENV{UNIT_NUMBER};
if(! -f $chipregs) {
@@ -292,15 +286,11 @@ sub init_indirect_registers() {
}
sub init_early_direct_regs() {
my $lbv = ($vbat_48) ? "20" : "10";
my $vcm = ($vbat_48) ? "02" : "03";
return write_to_slic_file("#
* WD 08 00 # Audio Path Loopback Control
* WD 6C 01
* WD 4A 3F # High Battery Voltage
* WD 4B $lbv # Low Battery Voltage
* WD 49 $vcm # Common Mode Voltage (VCM)
* WD 4B 10 # Low Battery Voltage
* WD 40 00 # Line Feed Control
#")
}
@@ -588,6 +578,9 @@ __DATA__
# On-Hook Line Voltage (VOC)
* WD 48 20
# Common Mode Voltage (VCM)
* WD 49 03
* WS 1E 23 00 80
* WS 1E 24 20 03
* WS 1E 25 8C 00

View File

@@ -776,6 +776,7 @@ static int xpd_initialize(xpd_t *xpd)
goto out;
}
XPD_INFO(xpd, "Initialized: %s\n", xpd->type_name);
xpd_post_init(xpd);
ret = 0;
out:
return ret;
@@ -870,90 +871,6 @@ err:
goto out;
}
static int xbus_register_dahdi_device(xbus_t *xbus)
{
int i;
int offset = 0;
XBUS_DBG(DEVICES, xbus, "Entering %s\n", __func__);
xbus->ddev = dahdi_create_device();
/*
* This actually describe the dahdi_spaninfo version 3
* A bunch of unrelated data exported via a modified ioctl()
* What a bummer...
*/
xbus->ddev->manufacturer = "Xorcom Inc."; /* OK, that's obvious */
/* span->spantype = "...."; set in card_dahdi_preregistration() */
/*
* Yes, this basically duplicates information available
* from the description field. If some more is needed
* why not add it there?
* OK, let's add to the kernel more useless info.
*/
xbus->ddev->devicetype = kasprintf(GFP_KERNEL, "Astribank2");
if (!xbus->ddev->devicetype)
return -ENOMEM;
/*
* location is the only usefull new data item.
* For our devices it was available for ages via:
* - The legacy "/proc/xpp/XBUS-??/summary" (CONNECTOR=...)
* - The same info in "/proc/xpp/xbuses"
* - The modern "/sys/bus/astribanks/devices/xbus-??/connector" attribute
* So let's also export it via the newfangled "location" field.
*/
xbus->ddev->location = xbus->connector;
xbus->ddev->hardware_id = xbus->label;
/*
* Prepare the span list
*/
for (i = 0; i < MAX_XPDS; i++) {
xpd_t *xpd = xpd_of(xbus, i);
if (xpd && IS_PHONEDEV(xpd)) {
XPD_DBG(DEVICES, xpd, "offset=%d\n", offset);
xpd_dahdi_preregister(xpd, offset++);
}
}
if (dahdi_register_device(xbus->ddev, &xbus->astribank)) {
XBUS_ERR(xbus, "Failed to dahdi_register_device()\n");
return -ENODEV;
}
for (i = 0; i < MAX_XPDS; i++) {
xpd_t *xpd = xpd_of(xbus, i);
if (xpd && IS_PHONEDEV(xpd)) {
XPD_DBG(DEVICES, xpd, "\n");
xpd_dahdi_postregister(xpd);
}
}
return 0;
}
static void xbus_unregister_dahdi_device(xbus_t *xbus)
{
int i;
XBUS_NOTICE(xbus, "%s\n", __func__);
for(i = 0; i < MAX_XPDS; i++) {
xpd_t *xpd = xpd_of(xbus, i);
xpd_dahdi_preunregister(xpd);
}
if (xbus->ddev) {
dahdi_unregister_device(xbus->ddev);
XBUS_NOTICE(xbus, "%s: finished dahdi_unregister_device()\n", __func__);
kfree(xbus->ddev->devicetype);
xbus->ddev->devicetype = NULL;
xbus->ddev->location = NULL;
xbus->ddev->hardware_id = NULL;
dahdi_free_device(xbus->ddev);
xbus->ddev = NULL;
}
for(i = 0; i < MAX_XPDS; i++) {
xpd_t *xpd = xpd_of(xbus, i);
xpd_dahdi_postunregister(xpd);
}
}
/*
* This must be called from synchronous (non-interrupt) context
* it returns only when all XPD's on the bus are detected and
@@ -1017,7 +934,6 @@ void xbus_populate(void *data)
*/
xbus_request_sync(xbus, SYNC_MODE_PLL);
elect_syncer("xbus_populate(end)"); /* FIXME: try to do it later */
xbus_register_dahdi_device(xbus);
out:
XBUS_DBG(DEVICES, xbus, "Leaving\n");
wake_up_interruptible_all(&worker->wait_for_xpd_initialization);
@@ -1290,12 +1206,12 @@ void xbus_deactivate(xbus_t *xbus)
xbus_request_sync(xbus, SYNC_MODE_NONE); /* no more ticks */
elect_syncer("deactivate");
xbus_echocancel(xbus, 0);
xbus_request_removal(xbus);
XBUS_DBG(DEVICES, xbus, "[%s] Waiting for queues\n", xbus->label);
xbus_command_queue_clean(xbus);
xbus_command_queue_waitempty(xbus);
xbus_setstate(xbus, XBUS_STATE_DEACTIVATED);
worker_reset(xbus);
xbus_unregister_dahdi_device(xbus);
xbus_release_xpds(xbus); /* taken in xpd_alloc() [kref_init] */
}
@@ -1872,6 +1788,10 @@ err:
void xbus_core_shutdown(void)
{
int i;
for(i = 0; i < MAX_BUSES; i++)
BUG_ON(xbus_num(i));
xbus_core_cleanup();
xpp_driver_exit();
}

View File

@@ -29,9 +29,8 @@
#include "xframe_queue.h"
#include "xbus-pcm.h"
#define MAX_BUSES 32
#define XFRAME_DATASIZE 512
#define MAX_ENV_STR 40
#define MAX_BUSES 32
#define XFRAME_DATASIZE 512
/* forward declarations */
struct xbus_workqueue;
@@ -109,7 +108,6 @@ struct xbus_transport {
atomic_t transport_refcount;
wait_queue_head_t transport_unused;
spinlock_t lock;
char model_string[MAX_ENV_STR];
};
#define MAX_SEND_SIZE(xbus) ((xbus)->transport.max_send_size)
@@ -190,7 +188,6 @@ struct xbus {
char label[LABEL_SIZE];
byte revision; /* Protocol revision */
struct xbus_transport transport;
struct dahdi_device *ddev;
int num;
struct xpd *xpds[MAX_XPDS];

View File

@@ -438,6 +438,16 @@ static void astribank_release(struct device *dev)
xbus_free(xbus);
}
static void toplevel_release(struct device *dev)
{
NOTICE("%s\n", __func__);
}
static struct device toplevel_device = {
.release = toplevel_release,
/* No Parent */
};
static struct bus_type toplevel_bus_type = {
.name = "astribanks",
.match = astribank_match,
@@ -613,6 +623,29 @@ static DEVICE_ATTR_READER(span_show, dev, buf)
return len;
}
static DEVICE_ATTR_WRITER(span_store, dev, buf, count)
{
xpd_t *xpd;
int dahdi_reg;
int ret;
BUG_ON(!dev);
xpd = dev_to_xpd(dev);
if(!xpd)
return -ENODEV;
ret = sscanf(buf, "%d", &dahdi_reg);
if(ret != 1)
return -EINVAL;
if(!XBUS_IS(xpd->xbus, READY))
return -ENODEV;
XPD_DBG(GENERAL, xpd, "%s\n", (dahdi_reg) ? "register" : "unregister");
if(dahdi_reg)
ret = dahdi_register_xpd(xpd);
else
ret = dahdi_unregister_xpd(xpd);
return (ret < 0) ? ret : count;
}
static DEVICE_ATTR_READER(type_show, dev, buf)
{
xpd_t *xpd;
@@ -695,7 +728,7 @@ static int xpd_match(struct device *dev, struct device_driver *driver)
static struct device_attribute xpd_dev_attrs[] = {
__ATTR(chipregs, S_IRUGO | S_IWUSR, chipregs_show, chipregs_store),
__ATTR(blink, S_IRUGO | S_IWUSR, blink_show, blink_store),
__ATTR_RO(span),
__ATTR(span, S_IRUGO | S_IWUSR, span_show, span_store),
__ATTR_RO(type),
__ATTR_RO(offhook),
__ATTR_RO(timing_priority),
@@ -931,7 +964,7 @@ int xbus_sysfs_create(xbus_t *xbus)
astribank = &xbus->astribank;
XBUS_DBG(DEVICES, xbus, "\n");
astribank->bus = &toplevel_bus_type;
astribank->parent = xbus->transport.transport_device;
astribank->parent = &toplevel_device;
dev_set_name(astribank, "xbus-%02d", xbus->num);
dev_set_drvdata(astribank, xbus);
astribank->release = astribank_release;
@@ -948,10 +981,16 @@ int __init xpp_driver_init(void)
int ret;
DBG(DEVICES, "SYSFS\n");
dev_set_name(&toplevel_device, "astribanks");
ret = device_register(&toplevel_device);
if (ret) {
ERR("%s: toplevel device_register failed: %d\n", __func__, ret);
goto failed_toplevel;
}
if((ret = bus_register(&toplevel_bus_type)) < 0) {
ERR("%s: bus_register(%s) failed. Error number %d",
__FUNCTION__, toplevel_bus_type.name, ret);
goto failed_toplevel;
goto failed_bus;
}
if((ret = driver_register(&xpp_driver)) < 0) {
ERR("%s: driver_register(%s) failed. Error number %d",
@@ -968,6 +1007,8 @@ failed_xpd_bus:
driver_unregister(&xpp_driver);
failed_xpp_driver:
bus_unregister(&toplevel_bus_type);
failed_bus:
device_unregister(&toplevel_device);
failed_toplevel:
return ret;
}
@@ -978,6 +1019,7 @@ void xpp_driver_exit(void)
bus_unregister(&xpd_type);
driver_unregister(&xpp_driver);
bus_unregister(&toplevel_bus_type);
device_unregister(&toplevel_device);
}
EXPORT_SYMBOL(xpd_driver_register);

View File

@@ -57,6 +57,7 @@ struct proc_dir_entry *xpp_proc_toplevel = NULL;
#define DELAY_UNTIL_DIALTONE 3000
DEF_PARM(int, debug, 0, 0644, "Print DBG statements");
static DEF_PARM_BOOL(dahdi_autoreg, 0, 0644, "Register spans automatically (1) or not (0)");
static DEF_PARM_BOOL(prefmaster, 0, 0644, "Do we want to be dahdi preferred sync master");
// DEF_ARRAY(int, pcmtx, 4, 0, "Forced PCM values to transmit");
@@ -252,6 +253,13 @@ int create_xpd(xbus_t *xbus, const xproto_table_t *proto_table,
return 0;
}
void xpd_post_init(xpd_t *xpd)
{
XPD_DBG(DEVICES, xpd, "\n");
if(dahdi_autoreg)
dahdi_register_xpd(xpd);
}
#ifdef CONFIG_PROC_FS
/**
@@ -560,6 +568,46 @@ err:
return NULL;
}
/*
* Try our best to make asterisk close all channels related to
* this Astribank:
* - Set span state to DAHDI_ALARM_NOTOPEN in all relevant spans.
* - Notify dahdi afterwards about spans (so it can see all changes at once).
* - Also send DAHDI_EVENT_REMOVED on all channels.
*/
void xbus_request_removal(xbus_t *xbus)
{
unsigned long flags;
int i;
for(i = 0; i < MAX_XPDS; i++) {
xpd_t *xpd = xpd_of(xbus, i);
if(xpd) {
XPD_DBG(DEVICES, xpd, "\n");
spin_lock_irqsave(&xpd->lock, flags);
xpd->card_present = 0;
xpd_setstate(xpd, XPD_STATE_NOHW);
PHONEDEV(xpd).span.alarms = DAHDI_ALARM_NOTOPEN;
spin_unlock_irqrestore(&xpd->lock, flags);
}
}
/* Now notify dahdi */
for(i = 0; i < MAX_XPDS; i++) {
xpd_t *xpd = xpd_of(xbus, i);
if(xpd) {
if(SPAN_REGISTERED(xpd)) {
int j;
dahdi_alarm_notify(&PHONEDEV(xpd).span);
XPD_DBG(DEVICES, xpd, "Queuing DAHDI_EVENT_REMOVED on all channels to ask user to release them\n");
for (j=0; j<PHONEDEV(xpd).span.channels; j++) {
dahdi_qevent_lock(XPD_CHAN(xpd, j),DAHDI_EVENT_REMOVED);
}
}
}
}
}
/*
* The xpd isn't open by anyone, we can unregister it and free it
*/
@@ -567,6 +615,7 @@ void xpd_remove(xpd_t *xpd)
{
BUG_ON(!xpd);
XPD_INFO(xpd, "Remove\n");
dahdi_unregister_xpd(xpd);
CALL_XMETHOD(card_remove, xpd);
xpd_free(xpd);
}
@@ -685,6 +734,7 @@ int xpp_open(struct dahdi_chan *chan)
return -EINVAL;
}
xpd = chan->pvt;
xpd = get_xpd(__FUNCTION__, xpd); /* Returned in xpp_close() */
if (!xpd) {
NOTICE("open called on a chan with no pvt (xpd)\n");
BUG();
@@ -726,6 +776,7 @@ int xpp_close(struct dahdi_chan *chan)
current->comm, current->pid,
atomic_read(&PHONEDEV(xpd).open_counter));
atomic_dec(&PHONEDEV(xpd).open_counter); /* from xpp_open() */
put_xpd(__FUNCTION__, xpd); /* from xpp_open() */
return 0;
}
@@ -864,7 +915,6 @@ static void echocan_free(struct dahdi_chan *chan,
LINE_DBG(GENERAL, xpd, pos, "mode=0x%X\n", ec->status.mode);
CALL_EC_METHOD(ec_set, xbus, xpd, pos, 0);
CALL_EC_METHOD(ec_update, xbus, xbus);
put_xpd(__FUNCTION__, xpd); /* aquired in xpp_echocan_create() */
}
static const struct dahdi_echocan_features xpp_ec_features = {
@@ -887,7 +937,7 @@ const char *xpp_echocan_name(const struct dahdi_chan *chan)
xpd = chan->pvt;
xbus = xpd->xbus;
pos = chan->chanpos - 1;
LINE_DBG(GENERAL, xpd, pos, "\n");
LINE_DBG(GENERAL, xpd, pos, "%s:\n", __func__);
if (!ECHOOPS(xbus))
return NULL;
/*
@@ -936,7 +986,6 @@ int xpp_echocan_create(struct dahdi_chan *chan,
*ec = phonedev->ec[pos];
(*ec)->ops = &xpp_ec_ops;
(*ec)->features = xpp_ec_features;
xpd = get_xpd(__FUNCTION__, xpd); /* Returned in echocan_free() */
LINE_DBG(GENERAL, xpd, pos, "(tap=%d, param_count=%d)\n",
ecp->tap_length, ecp->param_count);
ret = CALL_EC_METHOD(ec_set, xbus, xpd, pos, 1);
@@ -945,18 +994,53 @@ int xpp_echocan_create(struct dahdi_chan *chan,
}
EXPORT_SYMBOL(xpp_echocan_create);
void xpp_span_assigned(struct dahdi_span *span)
{
struct phonedev *phonedev = container_of(span, struct phonedev, span);
xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
XPD_INFO(xpd, "Span assigned: %d\n", span->spanno);
if (xpd->card_present) {
span->alarms &= ~DAHDI_ALARM_NOTOPEN;
dahdi_alarm_notify(&phonedev->span);
/**
* Unregister an xpd from dahdi and release related resources
* @xpd The xpd to be unregistered
* @returns 0 on success, errno otherwise
*
* Checks that nobody holds an open channel.
*
* Called by:
* - User action through /proc
* - During xpd_remove()
*/
int dahdi_unregister_xpd(xpd_t *xpd)
{
unsigned long flags;
BUG_ON(!xpd);
spin_lock_irqsave(&xpd->lock, flags);
if (!IS_PHONEDEV(xpd)) {
XPD_ERR(xpd, "Not a telephony device\n");
spin_unlock_irqrestore(&xpd->lock, flags);
return -EBADF;
}
if(!SPAN_REGISTERED(xpd)) {
XPD_NOTICE(xpd, "Already unregistered\n");
spin_unlock_irqrestore(&xpd->lock, flags);
return -EIDRM;
}
update_xpd_status(xpd, DAHDI_ALARM_NOTOPEN);
/* We should now have only a ref from the xbus (from create_xpd()) */
if(atomic_read(&PHONEDEV(xpd).open_counter)) {
XPD_NOTICE(xpd, "Busy (open_counter=%d). Skipping.\n", atomic_read(&PHONEDEV(xpd).open_counter));
spin_unlock_irqrestore(&xpd->lock, flags);
return -EBUSY;
}
mdelay(2); // FIXME: This is to give chance for transmit/receiveprep to finish.
spin_unlock_irqrestore(&xpd->lock, flags);
if(xpd->card_present)
CALL_PHONE_METHOD(card_dahdi_preregistration, xpd, 0);
atomic_dec(&PHONEDEV(xpd).dahdi_registered);
atomic_dec(&num_registered_spans);
dahdi_unregister(&PHONEDEV(xpd).span);
if(xpd->card_present)
CALL_PHONE_METHOD(card_dahdi_postregistration, xpd, 0);
return 0;
}
EXPORT_SYMBOL(xpp_span_assigned);
static const struct dahdi_span_ops xpp_span_ops = {
.owner = THIS_MODULE,
@@ -966,7 +1050,6 @@ static const struct dahdi_span_ops xpp_span_ops = {
.maint = xpp_maint,
.echocan_create = xpp_echocan_create,
.echocan_name = xpp_echocan_name,
.assigned = xpp_span_assigned,
};
static const struct dahdi_span_ops xpp_rbs_span_ops = {
@@ -978,54 +1061,14 @@ static const struct dahdi_span_ops xpp_rbs_span_ops = {
.maint = xpp_maint,
.echocan_create = xpp_echocan_create,
.echocan_name = xpp_echocan_name,
.assigned = xpp_span_assigned,
};
void xpd_set_spanname(xpd_t *xpd)
{
struct dahdi_span *span = &PHONEDEV(xpd).span;
snprintf(span->name, MAX_SPANNAME, "%s/%s", xpd->xbus->busname, xpd->xpdname);
/*
* The "Xorcom XPD" is a prefix in one of the regexes we
* use in our dahdi_genconf to match for PRI cards.
* FIXME: After moving completely to sysfs, we can remove
* this horseshit.
*/
snprintf(span->desc, MAX_SPANDESC, "Xorcom XPD [%s].%d: %s",
xpd->xbus->label, span->offset + 1, xpd->type_name);
}
EXPORT_SYMBOL(xpd_set_spanname);
static void xpd_init_span(xpd_t *xpd, unsigned offset, int cn)
int dahdi_register_xpd(xpd_t *xpd)
{
struct dahdi_span *span;
int i;
memset(&PHONEDEV(xpd).span, 0, sizeof(struct dahdi_span));
for (i = 0; i < cn; i++)
memset(XPD_CHAN(xpd, i), 0, sizeof(struct dahdi_chan));
span = &PHONEDEV(xpd).span;
span->deflaw = DAHDI_LAW_MULAW; /* default, may be overriden by card_* drivers */
span->channels = cn;
span->chans = PHONEDEV(xpd).chans;
span->flags = DAHDI_FLAG_RBS;
span->offset = offset;
if (PHONEDEV(xpd).phoneops->card_hooksig)
span->ops = &xpp_rbs_span_ops; /* Only with RBS bits */
else
span->ops = &xpp_span_ops;
xpd_set_spanname(xpd);
list_add_tail(&span->device_node, &xpd->xbus->ddev->spans);
}
int xpd_dahdi_preregister(xpd_t *xpd, unsigned offset)
{
xbus_t *xbus;
int cn;
struct phonedev *phonedev;
int i;
BUG_ON(!xpd);
@@ -1035,26 +1078,70 @@ int xpd_dahdi_preregister(xpd_t *xpd, unsigned offset)
XPD_ERR(xpd, "Not a telephony device\n");
return -EBADF;
}
phonedev = &PHONEDEV(xpd);
if (SPAN_REGISTERED(xpd)) {
XPD_ERR(xpd, "Already registered\n");
return -EEXIST;
}
cn = PHONEDEV(xpd).channels;
xpd_init_span(xpd, offset, cn);
XPD_DBG(DEVICES, xpd, "Preregister local span %d: %d channels.\n",
offset + 1, cn);
XPD_DBG(DEVICES, xpd, "Initializing span: %d channels.\n", cn);
memset(&PHONEDEV(xpd).span, 0, sizeof(struct dahdi_span));
for(i = 0; i < cn; i++) {
memset(XPD_CHAN(xpd, i), 0, sizeof(struct dahdi_chan));
}
span = &PHONEDEV(xpd).span;
snprintf(span->name, MAX_SPANNAME, "%s/%s", xbus->busname, xpd->xpdname);
span->deflaw = DAHDI_LAW_MULAW; /* default, may be overriden by card_* drivers */
span->channels = cn;
span->chans = PHONEDEV(xpd).chans;
span->flags = DAHDI_FLAG_RBS;
if(PHONEDEV(xpd).phoneops->card_hooksig)
span->ops = &xpp_rbs_span_ops; /* Only with RBS bits */
else
span->ops = &xpp_span_ops;
/*
* This actually describe the dahdi_spaninfo version 3
* A bunch of unrelated data exported via a modified ioctl()
* What a bummer...
*/
span->manufacturer = "Xorcom Inc."; /* OK, that's obvious */
/* span->spantype = "...."; set in card_dahdi_preregistration() */
/*
* Yes, this basically duplicates information available
* from the description field. If some more is needed
* why not add it there?
* OK, let's add to the kernel more useless info.
*/
snprintf(span->devicetype, sizeof(span->devicetype) - 1,
"Astribank: Unit %x Subunit %x: %s",
XBUS_UNIT(xpd->xbus_idx), XBUS_SUBUNIT(xpd->xbus_idx),
xpd->type_name);
/*
* location is the only usefull new data item.
* For our devices it was available for ages via:
* - The legacy "/proc/xpp/XBUS-??/summary" (CONNECTOR=...)
* - The same info in "/proc/xpp/xbuses"
* - The modern "/sys/bus/astribanks/devices/xbus-??/connector" attribute
* So let's also export it via the newfangled "location" field.
*/
snprintf(span->location, sizeof(span->location) - 1, "%s", xbus->connector);
/*
* Who said a span and irq have 1-1 relationship?
* Also exporting this low-level detail isn't too wise.
* No irq's for you today!
*/
span->irq = 0;
snprintf(PHONEDEV(xpd).span.desc, MAX_SPANDESC, "Xorcom XPD #%02d/%1d%1d: %s",
xbus->num, xpd->addr.unit, xpd->addr.subunit, xpd->type_name);
XPD_DBG(GENERAL, xpd, "Registering span '%s'\n", PHONEDEV(xpd).span.desc);
CALL_PHONE_METHOD(card_dahdi_preregistration, xpd, 1);
return 0;
}
int xpd_dahdi_postregister(xpd_t *xpd)
{
int cn;
if(dahdi_register(&PHONEDEV(xpd).span, prefmaster)) {
XPD_ERR(xpd, "Failed to dahdi_register span\n");
return -ENODEV;
}
atomic_inc(&num_registered_spans);
atomic_inc(&PHONEDEV(xpd).dahdi_registered);
CALL_PHONE_METHOD(card_dahdi_postregistration, xpd, 1);
@@ -1074,48 +1161,6 @@ int xpd_dahdi_postregister(xpd_t *xpd)
return 0;
}
/*
* Try our best to make asterisk close all channels related to
* this Astribank:
* - Set span state to DAHDI_ALARM_NOTOPEN in all relevant spans.
* - Notify dahdi afterwards about spans (so it can see all changes at once).
* - Also send DAHDI_EVENT_REMOVED on all channels.
*/
void xpd_dahdi_preunregister(xpd_t *xpd)
{
unsigned long flags;
if (!xpd)
return;
XPD_DBG(DEVICES, xpd, "\n");
spin_lock_irqsave(&xpd->lock, flags);
xpd->card_present = 0;
xpd_setstate(xpd, XPD_STATE_NOHW);
spin_unlock_irqrestore(&xpd->lock, flags);
update_xpd_status(xpd, DAHDI_ALARM_NOTOPEN);
if(xpd->card_present)
CALL_PHONE_METHOD(card_dahdi_preregistration, xpd, 0);
/* Now notify dahdi */
if(SPAN_REGISTERED(xpd)) {
int j;
dahdi_alarm_notify(&PHONEDEV(xpd).span);
XPD_DBG(DEVICES, xpd, "Queuing DAHDI_EVENT_REMOVED on all channels to ask user to release them\n");
for (j=0; j<PHONEDEV(xpd).span.channels; j++) {
dahdi_qevent_lock(XPD_CHAN(xpd, j),DAHDI_EVENT_REMOVED);
}
}
}
void xpd_dahdi_postunregister(xpd_t *xpd)
{
if (!xpd)
return;
atomic_dec(&PHONEDEV(xpd).dahdi_registered);
atomic_dec(&num_registered_spans);
if(xpd->card_present)
CALL_PHONE_METHOD(card_dahdi_postregistration, xpd, 0);
}
/*------------------------- Initialization -------------------------*/
static void do_cleanup(void)
@@ -1175,10 +1220,12 @@ static void __exit xpp_dahdi_cleanup(void)
EXPORT_SYMBOL(debug);
EXPORT_SYMBOL(create_xpd);
EXPORT_SYMBOL(xpd_post_init);
EXPORT_SYMBOL(get_xpd);
EXPORT_SYMBOL(put_xpd);
EXPORT_SYMBOL(xpd_alloc);
EXPORT_SYMBOL(xpd_free);
EXPORT_SYMBOL(xbus_request_removal);
EXPORT_SYMBOL(update_xpd_status);
EXPORT_SYMBOL(oht_pcm);
EXPORT_SYMBOL(mark_offhook);

View File

@@ -25,13 +25,12 @@
#include "xpd.h"
#include "xproto.h"
void xpd_set_spanname(xpd_t *xpd);
int xpd_dahdi_preregister(xpd_t *xpd, unsigned offset);
int xpd_dahdi_postregister(xpd_t *xpd);
void xpd_dahdi_preunregister(xpd_t *xpd);
void xpd_dahdi_postunregister(xpd_t *xpd);
int dahdi_register_xpd(xpd_t *xpd);
int dahdi_unregister_xpd(xpd_t *xpd);
void xbus_request_removal(xbus_t *xbus);
int create_xpd(xbus_t *xbus, const xproto_table_t *proto_table,
int unit, int subunit, byte type, byte subtype, int subunits, int subunit_ports, byte port_dir);
void xpd_post_init(xpd_t *xpd);
xpd_t *xpd_alloc(xbus_t *xbus, int unit, int subunit, int subtype, int subunits, size_t privsize, const xproto_table_t *proto_table, int channels);
void xpd_free(xpd_t *xpd);
void xpd_remove(xpd_t *xpd);
@@ -47,7 +46,6 @@ int xpp_close(struct dahdi_chan *chan);
int xpp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long arg);
int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig);
int xpp_maint(struct dahdi_span *span, int cmd);
void xpp_span_assigned(struct dahdi_span *span);
void report_bad_ioctl(const char *msg, xpd_t *xpd, int pos, unsigned int cmd);
int total_registered_spans(void);
void oht_pcm(xpd_t *xpd, int pos, bool pass);

View File

@@ -43,10 +43,11 @@ show_debug() {
list=''
for n in $dbg_names
do
if [ $(( val & (1 << j) )) -ne 0 ]; then
if (( val & (1 << j) ))
then
list="$list $n"
fi
j=$((j+1))
let j++
done
if [ "$list" = "" ]; then
list=' NONE'
@@ -66,19 +67,19 @@ calc_debug() {
for n in $dbg_names
do
if [ "$wanted" = "$n" ]; then
: $(( val |= (1 << j) ))
(( val |= (1 << j) ))
found=1
elif [ "$wanted" = -"$n" ]; then
: $(( val &= ~(1 << j) ))
(( val &= ~(1 << j) ))
found=1
elif [ "$wanted" = "ANY" ]; then
: $(( val = ~0 ))
(( val = ~0 ))
found=1
elif [ "$wanted" = -"ANY" -o "$wanted" = "NONE" ]; then
val=0
(( val = 0 ))
found=1
fi
j=$((j+1))
let j++
done
if [ "$found" -eq 0 ]; then
echo >&2 "$0: Unknown debug flag '$wanted'"

View File

@@ -737,12 +737,6 @@ static int xusb_probe(struct usb_interface *interface, const struct usb_device_i
retval = -ENOMEM;
goto probe_failed;
}
snprintf(xbus->transport.model_string,
ARRAY_SIZE(xbus->transport.model_string),
"usb:%04x/%04x/%x",
udev->descriptor.idVendor,
udev->descriptor.idProduct,
udev->descriptor.bcdDevice);
spin_lock_irqsave(&xusb_lock, flags);
for(i = 0; i < MAX_BUSES; i++) {
if(xusb_array[i] == NULL)

View File

@@ -42,7 +42,7 @@
#include <linux/config.h>
#endif
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/kobject.h>
#include <linux/ioctl.h>
#ifdef CONFIG_DAHDI_NET
@@ -54,8 +54,6 @@
#include <linux/skbuff.h>
#include <linux/interrupt.h>
#endif
#include <linux/device.h>
#include <linux/sysfs.h>
#include <linux/poll.h>
@@ -71,10 +69,6 @@
#define DAHDI_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id, struct pt_regs *regs)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
#define HAVE_NET_DEVICE_OPS
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
#define DAHDI_IRQ_SHARED IRQF_SHARED
#define DAHDI_IRQ_DISABLED IRQF_DISABLED
@@ -887,38 +881,6 @@ struct dahdi_span_ops {
/*! Opt: Provide the name of the echo canceller on a channel */
const char *(*echocan_name)(const struct dahdi_chan *chan);
/*! When using "pinned_spans", this function is called back when this
* span has been assigned with the system. */
void (*assigned)(struct dahdi_span *span);
/*! Called when the spantype / linemode is changed before the span is
* assigned a number. */
int (*set_spantype)(struct dahdi_span *span, const char *spantype);
};
/**
* dahdi_device - Represents a device that can contain one or more spans.
*
* @spans: List of child spans.
* @manufacturer: Device manufacturer.
* @location: The location of this device. This should not change if
* the device is replaced (e.g: in the same PCI slot)
* @hardware_id: The hardware_id of this device (NULL for devices without
* a hardware_id). This should not change if the device is
* relocated to a different location (e.g: different PCI slot)
* @devicetype: What type of device this is.
* @irqmisses: Count of "interrupt misses" for this device.
*
*/
struct dahdi_device {
struct list_head spans;
const char *manufacturer;
const char *location;
const char *hardware_id;
const char *devicetype;
struct device dev;
unsigned int irqmisses;
};
struct dahdi_span {
@@ -926,10 +888,14 @@ struct dahdi_span {
char name[40]; /*!< Span name */
char desc[80]; /*!< Span description */
const char *spantype; /*!< span type in text form */
const char *manufacturer; /*!< span's device manufacturer */
char devicetype[80]; /*!< span's device type */
char location[40]; /*!< span device's location in system */
int deflaw; /*!< Default law (DAHDI_MULAW or DAHDI_ALAW) */
int alarms; /*!< Pending alarms on span */
unsigned long flags;
u8 cannot_provide_timing:1;
int irq; /*!< IRQ for this span's hardware */
int lbo; /*!< Span Line-Buildout */
int lineconfig; /*!< Span line configuration */
int linecompat; /*!< Span line compatibility (0 for
@@ -943,6 +909,7 @@ struct dahdi_span {
int maintstat; /*!< Maintenance state */
int mainttimer; /*!< Maintenance timer */
int irqmisses; /*!< Interrupt misses */
int timingslips; /*!< Clock slips */
struct dahdi_chan **chans; /*!< Member channel structures */
@@ -962,11 +929,7 @@ struct dahdi_span {
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_entry;
#endif
struct list_head spans_node;
struct dahdi_device *parent;
struct list_head device_node;
struct device *span_device;
struct list_head node;
};
struct dahdi_transcoder_channel {
@@ -983,8 +946,6 @@ struct dahdi_transcoder_channel {
u32 srcfmt;
};
int dahdi_is_sync_master(const struct dahdi_span *span);
static inline int
dahdi_tc_is_built(struct dahdi_transcoder_channel *dtc) {
return test_bit(DAHDI_TC_FLAG_CHAN_BUILT, &dtc->flags);
@@ -1066,7 +1027,6 @@ struct dahdi_dynamic {
long rxjif;
unsigned short txcnt;
unsigned short rxcnt;
struct dahdi_device *ddev;
struct dahdi_span span;
struct dahdi_chan *chans[256];
struct dahdi_dynamic_driver *driver;
@@ -1074,7 +1034,6 @@ struct dahdi_dynamic {
int timing;
int master;
unsigned char *msgbuf;
struct device *dev;
struct list_head list;
};
@@ -1138,22 +1097,6 @@ static inline int dahdi_transmit(struct dahdi_span *span)
return ret;
}
static inline int dahdi_is_digital_span(const struct dahdi_span *s)
{
return (s->linecompat > 0);
}
static inline int dahdi_is_t1_span(const struct dahdi_span *s)
{
return (s->linecompat & (DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF |
DAHDI_CONFIG_B8ZS)) > 0;
}
static inline int dahdi_is_e1_span(const struct dahdi_span *s)
{
return dahdi_is_digital_span(s) && !dahdi_is_t1_span(s);
}
/*! Abort the buffer currently being receive with event "event" */
void dahdi_hdlc_abort(struct dahdi_chan *ss, int event);
@@ -1168,12 +1111,10 @@ void dahdi_hdlc_putbuf(struct dahdi_chan *ss, unsigned char *rxb, int bytes);
* and 1 if the currently transmitted message is now done */
int dahdi_hdlc_getbuf(struct dahdi_chan *ss, unsigned char *bufptr, unsigned int *size);
/*! Register a device. Returns 0 on success, -1 on failure. */
struct dahdi_device *dahdi_create_device(void);
int dahdi_register_device(struct dahdi_device *ddev, struct device *parent);
void dahdi_unregister_device(struct dahdi_device *ddev);
void dahdi_free_device(struct dahdi_device *ddev);
void dahdi_init_span(struct dahdi_span *span);
/*! Register a span. Returns 0 on success, -1 on failure. Pref-master is non-zero if
we should have preference in being the master device */
int dahdi_register(struct dahdi_span *span, int prefmaster);
/*! Allocate / free memory for a transcoder */
struct dahdi_transcoder *dahdi_transcoder_alloc(int numchans);
@@ -1188,6 +1129,9 @@ int dahdi_transcoder_unregister(struct dahdi_transcoder *tc);
/*! \brief Alert a transcoder */
int dahdi_transcoder_alert(struct dahdi_transcoder_channel *ztc);
/*! \brief Unregister a span */
int dahdi_unregister(struct dahdi_span *span);
/*! \brief Gives a name to an LBO */
const char *dahdi_lboname(int lbo);
@@ -1416,24 +1360,6 @@ static inline void list_replace(struct list_head *old, struct list_head *new)
new->prev = old->prev;
new->prev->next = new;
}
#ifndef WARN_ON_ONCE
#define WARN_ON_ONCE(__condition) do { \
static int __once = 1; \
if (unlikely(__condition)) { \
if (__once) { \
__once = 0; \
WARN_ON(0); \
} \
} \
} while (0)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
#ifndef POLLRDHUP
#define POLLRDHUP 0
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
#define kzalloc(a, b) kcalloc(1, a, b)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
@@ -1460,17 +1386,12 @@ typedef u32 __bitwise pm_message_t;
#endif /* 2.6.11 */
#endif /* 2.6.12 */
#endif /* 2.6.14 */
#endif /* 2.6.17 */
#endif /* 2.6.18 */
#endif /* 2.6.22 */
#endif /* 2.6.25 */
#endif /* 2.6.26 */
#endif /* 2.6.31 */
#ifndef CONFIG_TRACING
#define trace_printk printk
#endif
#ifndef DEFINE_SPINLOCK
#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
#endif
@@ -1536,26 +1457,6 @@ struct mutex {
#define chan_err(chan, fmt, ...) chan_printk(ERR, "", chan, fmt, \
## __VA_ARGS__)
#ifndef pr_err
#define pr_err(fmt, ...) \
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
#endif
#ifndef pr_warning
#define pr_warning(fmt, ...) \
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
#endif
#ifndef pr_warn
#define pr_warn pr_warning
#endif
#ifndef pr_notice
#define pr_notice(fmt, ...) \
printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
#endif
#ifndef pr_info
#define pr_info(fmt, ...) \
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
#endif
/* The dbg_* ones use a magical variable 'debug' and the user should be
* aware of that.
*/