Compare commits

...

135 Commits

Author SHA1 Message Date
Shaun Ruffell
0a58eef031 Importing files for 2.6.0 release.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/tags/2.6.0@10400 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-03 23:17:39 +00:00
Shaun Ruffell
07a8698f77 Creating tag for the release of dahdi-linux-2.6.0
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/tags/2.6.0@10399 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-03 23:16:50 +00:00
Tzafrir Cohen
6f2a52b764 Avoid building PCI devices if kernel has no PCI
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10397 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-03 22:44:43 +00:00
Shaun Ruffell
b91ec305be wctdm24xxp: Fix bug if hook state on FXS changes before channel configuration.
If the hook state on an FXS port changes before the channel is
configured with dahdi_cfg it is possible to erroneously force the line
feed register open without setting a timer to clear it.

The result would be a "dead" channel that cannot be cleared unless the
driver is reloaded and warning in the kernel log that "0 is an invalid
signaling state for an FXS module".

This change makes the OFF_HOOK to ON_HOOK change behave just as the
ON_HOOK to OFF_HOOK change has.

Internal-Issue-ID: DAHLIN-272
Reported-and-Tested-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10396 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-03 19:25:46 +00:00
Shaun Ruffell
afe3702873 wct4xxp: Reduce time spent waiting for auth done bit on TE820.
It is not necessary to wait a full second for the donebit.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10395 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-03 19:25:42 +00:00
Oron Peled
892e49c356 xpp: BRI: batch D-Channel packets to fix frag.
* We need to split the BRI D-Channel (HDLC) frames to smaller packets,
  limitation of the FPGA.
* This changes batches BRI D-channel packets of the same HDLC frame to a
  single XPP frame.
* Avoids an accidental fragmantion in case we were delayed for a few ms-s.
* Also improves efficiency.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10390 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-02 14:07:14 +00:00
Oron Peled
9fd76d93c9 xpp: BRI: split multibyte functionality
* The zero lenth case (Magic request) was split into
  send_magic_request() function. It was not possible
  to move it into card_bri.c, because it is called
  directly from the general interface we provide for
  register read/write via sysfs/proc.

* The normal case (send_multibyte_request) was moved from
  card_global.c into card_bri.c

* This sets the stage to enable bundling of multibyte
  packets into frames (like we do for PCM).

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10389 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-02 14:06:50 +00:00
Oron Peled
6706b03d9d xpp: BRI: remove trivial BRISTUFF wrappers
Now that legacy BRISTUFF code is gone, some wrapper
functions became trivial. Removed these wrappers
and inlined their contents.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10388 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-02 14:06:25 +00:00
Oron Peled
2ae396112a xpp: BRI: remove legacy BRISTUFF code
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10387 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-02 14:05:58 +00:00
Tzafrir Cohen
b6f3466607 xpp: Allow up to 128 Astribanks on a system
This is also a work around the bug fixed in the previous commit.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10384 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-21 18:10:44 +00:00
Oron Peled
9ce15dc967 xpp: bad module_put() when too many Astribanks
module_put() that was added while developing the sysfs code. The real
module_get()/module_put() pair were already removed at the time of
developing code for this branch. It was only triggered when using a
system with more than 32 (MAX_BUSES) Astribanks.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10383 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-21 18:10:15 +00:00
Oron Peled
2b11667c47 DAHDI-linux: Fix "surprise removal" problems
* Added a nodev_*() file_operations that handle system calls
  from user-space after surprise device removal.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10381 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-14 19:27:27 +00:00
Shaun Ruffell
6b6d047241 wct4xxp: Fail startup if not generating interrupts.
I've seen some platforms that do not properly route the interrupt from the
card to the host CPU. In these cases the card potentially could appear to be
greened up even though no data is flowing over the spans.

This change allows dahdi_cfg to return an error when this occurs, and also
ensures that all the spans are in RED alarm.

For example, dahdi_cfg output when the card is not generating interrupts:
  # dahdi_cfg
  DAHDI startup failed: Input/output error

And the kernel log will contain a string like:
  wct4xxp 0000:02:08.0: Interrupts not detected.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10380 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-14 19:02:53 +00:00
Shaun Ruffell
2983075256 dahdi: Return dahdi_span_ops.startup callback errors to userspace.
Allows dahdi_cfg to return an error code if a board driver fails it's startup
call for any reason.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10379 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-14 19:02:48 +00:00
Shaun Ruffell
b43c7f02a0 wctdm24xxp: Do not call voicebus_release() before wctdm_back_out_gracefully()
voicebus_release is already called as part of the wctdm_back_out_gracefully()
call. If an Hx8 card fails to initialize, this will eliminate warnings from
the kernel such as:

  WARNING: at kernel/irq/manage.c:904 __free_irq+0x94/0x173()
  Trying to free already-free IRQ 18

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10377 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-12 18:18:14 +00:00
Oron Peled
990af593a5 xpp: BRI: fix timing priority calculation
Use similar caculation as in the PRI module:
* Save timing_priority from spanconfig and
  elect syncer when spanconfig is called.
* Create custom timing_priority() function that returns
  the value or error if span is disconnected.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: : Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10373 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-07 19:34:37 +00:00
Oron Peled
654486dc24 xpp: FXS: mwi and search_fsk fixes
* We must not block PCM during from 'search_fsk_pattern' channels.
* We must vmwi_search() not only on FXS_LINE_POL_ACTIVE, but also during
  'neon_blinking' -- so we notice the message to turn it off.
* Also added 'search_fsk_pattern' and neon_blinking to /proc/.../fxs_info

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: : Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10372 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-07 19:22:04 +00:00
Russ Meyerriecks
6d1713c2c0 wct4xxp: Revise vpm struct due to product name changes
Renamed most of the "vpm450m" references to just "vpm".

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10365 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-02 22:48:44 +00:00
Russ Meyerriecks
da149b0d4d wct4xxp: Handle incorrect vpm module/card pairings
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10364 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-02 22:48:39 +00:00
Shaun Ruffell
06961f8605 dahdi: #include <linux/module.h> in dahdi/kernel.h and GpakCust.h
Commit de47725, first released in 3.2-rc1 removed module.h from some
kernel headers. Include it explicitly now.

Resolves compilation errors like:
error: implicit declaration of function 'try_module_get'
error: 'THIS_MODULE' undeclared (first use in this function)
error: implicit declaration of function 'module_put'

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10361 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-02 19:56:11 +00:00
Shaun Ruffell
2a3a074f33 wctc4xxp: Replace 'ndo_set_multicast_list' with 'set_rx_mode'
The ndo_set_multicast_list callback was removed in b81693d9, which was
first released in Linux Kernel 3.2-rc1

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10360 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-02 19:56:07 +00:00
Oron Peled
c4616c6c86 xpp: PRI: restore pri_protocol to R/W:
Restores the pri_protocol attribute of the XPD node in SysFS to be
writable. Fixes a minor regression from the pinned-spans fix, similar to
r10334.

* This attribute was made R/O in digium r10280 as part of the
  pinned-spans changes:
  - The E1/T1 settings were changed via new set_spantype() method
    which was called from dahdi when the 'spantype' dahdi attribute
    was written to.

  - This fails our init_card_4_* trying to write E1/T1 into our private
    attribute.

* Restored our old code (with minor modifications) so we
  can set E1/T1 the old way (writing to our 'pri_protocol' attribute)
  as well as the new way (when it will be used eventually).

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10347 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-29 23:38:30 +00:00
Oron Peled
244c9bd254 xpp: pri: fix RS1 init in E1 CAS mode
Force some reserved bits to really be 1 in E1 mode (otherwise
terrorists will win).

(Closes issue DAHLIN-264)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10346 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-29 23:37:33 +00:00
Oron Peled
cc7c73c4d8 xpp: fxs: demote SETPOLARITY message to DBG()
Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10345 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-29 23:36:17 +00:00
Tzafrir Cohen
66eb65dda7 xpp: increase command queue length to 1500
A length of 1000 commands is not enough is some cases with CAS.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10341 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-16 12:10:51 +00:00
Tzafrir Cohen
1372573e68 xpp: USB_FW rev 10085: fix regression from r10013
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10339 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-13 15:04:16 +00:00
Tzafrir Cohen
1e22667c31 xpp: PIC_TYPE_1 rev 9841: followup to r10013
An extra fix that was accidentally not included in r10013. Minor bug fixes.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10337 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-13 13:23:10 +00:00
Oron Peled
8bcab23272 xpp: silence some bad ioctl() reporting
Ignore some FXS-specific ioctl-s in xpd_pri.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10335 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-10 16:56:54 +00:00
Oron Peled
1a79cb4fdc xpp: restore backward compat dahdi_registration
This restores a somewhat limited functionality of the "span"
write interface in the SysFS node of the span, broken by the
pinned-spans code.

* PROBLEM: dahdi-linux pinned-spans should work with existing dahdi-tools
  specifically the dahdi_registration tool.

* As a result, we should still be able to control dahdi registration
  order. However, registration is now in complete devices and not spans

* Restored dahdi_autoreg=[0/1] xpp module parameter:
  - It now refers to complete astribanks and not individual spans

* The xpp module sysfs "span" attribute:
  - Implemented write method (for dahdi_registration tool)
  - The first write of [1/0] to this attribute, registers/unregisters
    the complete astribank
  - Further writes are ignored (with DBG messages)

* Also, implemented new xbus_is_registered() function

* Once the new dahdi-tools are merged, we should turn deprecation
  messages from DBG() to NOTICE()

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10334 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-10 16:56:29 +00:00
Shaun Ruffell
bc7c111d7e wctdm24xxp: Wait for background threads to complete on failed load.
Some of the VPM loading / probing threads use global system workqueues. They
might now be running when we abort early so we should wait for them to
complete their runs before freeing memory that may be in use.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10332 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07 22:40:20 +00:00
Shaun Ruffell
4b58524565 dahdi: Unregister dahdi_device from sysfs if we fail to auto assign spans.
Otherwise, if the _dahdi_assign_span call fails, the dahdi_device will never
be removed from the dahdi_devices virtual bus and the board drivers will not
be reloadable.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10331 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07 22:40:15 +00:00
Shaun Ruffell
6ed54cc7e3 dahdi: Fix typo in previous commit which forced some spans to always fail assignment.
I misssed a small typo in r10328 "Extra debugging aids and messages" that
would force any span that supports a hardware preechocan to always fail
assignment with -EFAULT.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10330 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07 22:40:11 +00:00
Oron Peled
09e46f2213 Extra debugging aids and messages
* Added dahdi_dev_dbg() macro to print when we don't (yet)
  have a span number.
* Added a new debug category: DAHDI_DBG_ASSIGN
* Made sure error return code paths prints helpfull messages
* Promote error messages from INFO to NOTICE
* Change some errno values from EINVAL to EFAULT (internal
  errors not caused by user input)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10328 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07 17:48:00 +00:00
Tzafrir Cohen
875c1ec3b6 bugfix: off-by-one in span assignment
The test in _check_spanno_and_basechan() was off by one
(used '<' instead of '<=')

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10327 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07 17:33:25 +00:00
Tzafrir Cohen
382125f880 xpp: USB firmware r9964: minor bugfixes
USB_FW rev 9964: includes a few stability bugfixes.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10323 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07 15:27:37 +00:00
Russ Meyerriecks
1e561e4ed7 wct4xxp: minor: Removed unnecessary instrumentation
Removed a couple prints of instrumentation that was cluttering up the log output.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10310 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-02 21:46:07 +00:00
Shaun Ruffell
f0c61c85b8 dahdi: First span registered becomes master by default.
r10205 "dahdi: Check for master in DAHDI_STARTUP / resolves MeetMe
regression." did not handle the case for the wcb4xxp driver since it
would set DAHDI_FLAG_RUNNING as part of the probe. Therefore, the
DAHDI_STARTUP ioctl was never processed for it, creating a situation
where audio is missing on channels that are conferenced with channels on
the BRI spans.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10304 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-02 19:46:18 +00:00
Shaun Ruffell
74d86c535d dahdi: Define POLLRDHUP on kernels < 2.6.17
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10303 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-02 18:59:03 +00:00
Tzafrir Cohen
0c89cad864 xpp: bugfix: clear NOTOPEN span alarm on assign
The NOTOPEN span alarm flag is set at span unassignment time.

* It needs to be cleared when the span is reassigned.
* That is: only if the span is actually connected.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10302 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-02 17:05:38 +00:00
Tzafrir Cohen
e74fb7d04d xpp: bugfix -- manage xpd refcount for EC module
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10301 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-02 14:19:14 +00:00
Tzafrir Cohen
c7228589a9 xpp: Adaptations for E-Main-3
* An xbus transport now have a "model_string" member
 * The xpp_usb driver fills this with "usb:<idVendor>/<idProduct>/<bcdDevice>"
 * It is passed via environment to the "init_card_<type>_<protocol>" scripts
 * The FXS script uses this to condition two registers according to
   the power supply model.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10300 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-02 14:08:12 +00:00
Tzafrir Cohen
6a1561b749 xpp: remove leftovers of old XPD_STATE method
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10299 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-02 14:07:43 +00:00
Shaun Ruffell
ce261cd03a wctdm24xxp, wcte12xp: Allow VPMADT032 commands more time to complete.
Since "wctdm24xxp: Probe for and configure modules in parallel." the
check for the VPMADT032 module was moved closer to after when the
interface was initialized. The 200ms timeout did not provide enough
time for the system to settle out after initial start. The result
was that sometimes after a cold boot the driver would fail to detect
any VPMADT032 modules.

This fixes a race condition that is not in any released branches.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10296 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-01 20:35:20 +00:00
Doug Bailey
a054cddc09 wctdm24xxp, wcte12xp: Update VPMOCT032 firmware to 1.12.0.
- Cleaned up the OCT6114 interface .
- Relaxed the timeout waiting for OCT6114 bus cycle completion to 100 mS
  and added a 2 mS delay time from OCT6114 reset to initialization.

This change only addresses issues that were created in the lab and not in the
field.

Signed-off-by: Doug Bailey <dbailey@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10295 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-01 20:35:15 +00:00
Russ Meyerriecks
fde1081677 wct4xxp: Expose serial number in dahdi_device and kernel log.
This will allow the serial number to be exposed in sysfs and also
allow span assignment rules to use the serial number.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10292 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-01 15:27:32 +00:00
Russ Meyerriecks
e3c07497ee wct4xxp: Add field upgradable firmware support for TE820.
This commit adds field upgradeable support for the TE820 firmware.
Firmware can now be silently upgraded as part of updating drivers
like most of the existing DAHDI firmware. Previous versions of dual
and quad span cards did not support upgrading firmware in the field.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Fixed up some checkpatch issues:
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10291 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-01 15:27:27 +00:00
Matthew Fredrickson
11d8140b23 wct4xxp: Add support for TE820 and VPMOCT256.
TE820 is an 8-span PCI-express digital interface card. VPMOCT256 is a hardware
echo canceler that is able to provide echo cancelation on all 8-spans.

From: Matthew Fredrickson <creslin@digium.com>

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10290 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-01 15:27:21 +00:00
Tzafrir Cohen
47beee98d7 README: Minor additions regarding pinned-spans
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10289 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-27 19:59:26 +00:00
Tzafrir Cohen
f9326ca60f README: initial update for span assignments
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10288 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-27 00:35:47 +00:00
Oron Peled
d556a1a57a xpp: cleanup some printk()'s
* Also demote them to DBG()

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10287 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:09:09 +00:00
Oron Peled
3fc23b4465 added 'basechan' and 'channels' attributes to spans
* So we can:
   - Generate 'pinned-spans.conf' from existing state
   - Run dahdi_cfg from udev (on specific span + its channels)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10286 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:08:33 +00:00
Oron Peled
4d10eab759 dahdi: Give userspace a chance to respond to surprise removal.
* We try very hard to help asterisk understand that we unassign spans.

 * Implement disable_span():
   - Set span + channels to DAHDI_ALARM_NOTOPEN
   - qevent DAHDI_EVENT_REMOVED

 * Use disable_span():
   - in dahdi_unassign_span() and dahdi_unregister_device()
   - with long msleep() so asterisk has a chance to get the message
   - Out of the registration_mutex so we actually context switch.

 * Also return more POLLERR variants (POLLRDHUP is not portable,
   should be tested).

 * Also improve printk(), fix rate_limit increment (was missing)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10285 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:07:59 +00:00
Oron Peled
8f4a626087 xpp: Remove dahdi_autoreg parameter:
* With pinned-spans all spans are registered to dahdi with the
   device (and assigned later)
 * So this parameter cannot function anymore
 * Also remove the (now) empty xpd_post_init() function.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10284 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:07:21 +00:00
Oron Peled
bf3d8aa2cd xpp: more informative span description:
* Contains the hardware_id and the local span number

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10283 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:06:57 +00:00
Oron Peled
aab9e51f30 xpp: make unregistration safer (idempotent)
* Otherwise, a failed unit initialization (e.g: when init_card_?_?? fails)
   causes a panic

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10282 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:06:32 +00:00
Oron Peled
bfae9c07da xpp: adapt to 'location' attribute removal:
* Reparent astribanks below their USB transport
 * This way their location can be derived from their hardware
   hierarchy.
 * The tradeoff is that once USB hardware is disconnected, there
   is no sysfs visibility of the astribank object even if it
   cannot be release yet due to open channels by asterisk
 * Thus, we'll need to migrate to "surprise removal" of dahdi
   devices...

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10281 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:06:11 +00:00
Oron Peled
7c4c826d68 xpp: PRI: use DAHDI new set_spantype() method
* Implement pri_set_spantype() method
 * Refactor code from PRI_card_dahdi_preregistration() into
   a new apply_pri_protocol().
   - It is now called from both PRI_card_dahdi_preregistration()
     and set_pri_proto()
   - It now also sets span name + description
 * Remove old pri_protocol_store() method (pri_protocol is now RO)
 * Added pri_protocol_bystr() method (maybe promote it to DAHDI?)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10280 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:05:49 +00:00
Shaun Ruffell
d91b3c53d3 wct4xxp: Allow linemode (T1/E1/J1) to be changed via sysfs attribute.
Allowing the linemode to be configured with sysfs before the spans are
assigned opens the eventualy capability for line mode to be configured
with the other physical layer settings per card.  Currently linemode is
set with either physical jumpers or with a module parameter to the
wct4xxp driver that is global for all cards.

Default behavior is not changed with this commit.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10279 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:05:24 +00:00
Shaun Ruffell
39c4b93ed6 wcte12xp: Allow linemode (T1/E1) to be changed via sysfs attribute.
Allowing the linemode to be configured with sysfs before the spans are
assigned opens the eventualy capability for line mode to be configured
with the other physical layer settings per card.  Currently linemode is
set with either physical jumpers or with a module parameter to the
wcte12xp driver that is global for all cards.

Default behavior is not changed with this commit.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10278 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:04:04 +00:00
Shaun Ruffell
f9c52bb271 dahdi: Allow 'spantype' to be changed before span assignement via sysfs.
For some boards, the linemode (E1/T1/J1) is software selectable but
needs to be configured before the spans were historically registered
since the line mode determines the channel count available on the span.

This change exports a "spantype" attribute from the dahdi_device that
can be used to set E1/T1/J1 before the spans are assigned. When
userspace writes to this attribute (in a <span offset>:<span type
string> format), and if the board driver has implemented a set_spantype
function in it's dahdi_span_ops, then the board driver can optionally
change it's mode before registration.

Also part of this change is breaking out the raw data structure
initialization of the spans / channels via the dahdi_init_device_spans
function since the board drivers may need to reallocate channels / spans
as part of this callback. For example, changing from T1 to E1 mode will
require allocating 7 new channels.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10277 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:01:19 +00:00
Shaun Ruffell
8d23f878d4 dahdi: Remove dahdi_span.irq and move dahdi_span.irqmisses into dahdi_device.
'irqmisses' is more a function of the device and there are better ways
to get to IRQ for a device than storing it in any DAHDI structures.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10276 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 19:00:28 +00:00
Shaun Ruffell
a6824019fb dahdi: Expose dahdi devices in sysfs.
This exposes dahdi devices in sysfs and also exposes attributes that
will allow user space to control the registration order in spans. This
facilitates loading drivers out of order yet keeping consistent
span/channel numbering, which in turn will eventually allow the
blacklist for DAHDI drivers to be removed. The default behavior,
controlled with the auto_register module parameter on dahdi is to number
the spans / channels in order like is currently done. So this change
does not introduce any new behavior by default.

 * Writing (anything) to this attribute returns the span to its
   unassigned state
 * Fix dahdi_chan_unreg() echocan refcount
 * Add safeguard against duplicate unassignment to _dahdi_unregister_span()
 * Remove the span from device_node list, only in dahdi_unregister_device()
   and not in dahdi_unregister_span()
 * Free allocated span->span_device in span_sysfs_remove()
   [is it safe?, didn't cause problem so far...]

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

dahdi: Add "hardware_id" dahdi_device attribute.

- The "hardware_id" does not change with device location (e.g: when a PCI
  card is moved from one slot to another).
- Not all devices have this attribute. It is legal for it to be NULL (that
  is the default for all low-level drivers that do not set it explicitly).
- When "hardware_id" is NULL, the sysfs attribute value is "\n"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10275 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 18:59:20 +00:00
Oron Peled
2794bb4937 dahdi: Expose spans in sysfs.
This change will facilitate creating rules that will allow spans and channels
to be accessed by named device files instead of by numbers.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10274 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 18:58:50 +00:00
Shaun Ruffell
935c9ba50a dahdi: Register devices instead of individual spans.
Increasingly, spans are implemented by devices that support more than a
single span. Introduce a 'struct dahdi_device' object which explicitly
contains multiple spans. This will allow a cleaner representation of
spans and devices in sysfs since order of arrival will not determine the
layout of the devices. This also gives the core of dahdi a way to know
the relationship between spans.

This generalizes similar concepts that were previously xpp specific. The
conversion of the xpp code was almost entirely done by Oron and Tzafrir.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10273 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 18:58:14 +00:00
Oron Peled
38c3cda8e2 dahdi: dahdi_is_analog_span() -> dahdi_is_digital_span()
* dahdi-base.c had a reverse is_analog_span() static function -- fixed.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10272 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 18:57:31 +00:00
Tzafrir Cohen
3998c8fd11 dahdi: Add error messages in dahdi_ioctl_chanconfig.
Provide more context to trouble shoot failures.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10271 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 18:57:07 +00:00
Oron Peled
33c31e9593 dahdi: start handling "surprise device removal".
This patch contains interim results while trying to make
device removal work correctly:

 * XPP has protections to prevent dahdi unregistration while
   channels are open -- they are now removed, so we can
   unregister immediately.

 * Handle processes in poll_wait():
   - Wake them during dahdi_chan_unreg() after the channel
     is gone (chan->channo = -1 or chan->file->private_data == NULL)

   - Test in every wait_event_interruptible() that the channel
     was not gone (chan->file->private_data)

   - Return correct values (POLLERR | POLLHUP) instead of
     some errno (would be important in the future if we
     modify asterisk to respond correctly to this condition.

 * Other issues:
   - If unregistered channel is being polled, than call msleep() before
     returning, to give other processes a chance (normally, asterisk
     has RT priority)

   - Call close_channel() from dahdi_chan_unreg() so it releases
     related tonezone

 * There is still a horrible race hidden by msleep(20) in
   dahdi_chan_unreg()

force close channels from dahdi_chan_unreg():

 * Mark them via DAHDI_FLAGBIT_OPEN
 * Call low-level driver close() method if available
 * What about other closing activities?

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10270 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26 18:56:43 +00:00
Shaun Ruffell
4b1a2f9127 wct4xxp: Deprecate 't1e1override' module parameter in favor of 'default_linemode'.
't1e1override' isn't immediately apparent what it is supposed to do by the
name. Instead 'default_linemode' module parameter can be set to "auto", "t1",
or "e1" to make it clear.

This change was introduced earlier in the wcte12xp driver.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10269 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-24 22:19:11 +00:00
Shaun Ruffell
35ffe2f550 dahdi: Move WARN_ON_ONCE from wctc4xxp driver to include/dahdi/kernel.h
I only generally test on RHEL 4 when testing against kernels older
than 2.6.18. Apparently OpenSUSE 10.1 runs with 2.6.16 and doesn't
have WARN_ON_ONCE backported. I took the patch Richard Miller
originally attached to the issue and moved it to
include/dahdi/kernel.h so it would be available for all the board
drivers in the future.

Internal-Issue-ID: DAHLIN-260
Reported-by: Richard Miller
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10252 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-21 19:32:25 +00:00
Shaun Ruffell
f06aa486c7 wcb4xxp: Do not show LASVEGAS2 as echocan name if vpmsupport is set to 0
This fixes an issue where "EC: LASVEGAS2" was displayed in /proc/dahdi/x
for a B410P span even though vpmsupport was disabled with the module
parameter.

Internal-Issue-ID: DAHLIN-247
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10251 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-21 19:20:17 +00:00
Shaun Ruffell
e14f3fa541 wct4xxp: Refactor t4_serial_setup() to remove t4.globalconfig.
Allows the globalconfig member to be removed from the struct t4 and not
carried around for the life of the card. Also holds the reglock a little
longer for all the framer writes but I realize the startup of the
wct4xxp based cards does not need to be optimized.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10250 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:53:26 +00:00
Shaun Ruffell
955641b52c wct4xxp: Trivial. Use ARRAY_SIZE in free_wc() and __handle_leds().
Reduces the amount of code to read in the two functions and fixes
checkpatch.pl warnings.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10249 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:53:22 +00:00
Shaun Ruffell
b7485aa383 wct4xxp: Atomically perform some read/modify/write operations
There are read/modify/write operations on the framer that were not
protected by any locks. While I didn't notice any code paths that would
result in simultaneous accesses to these registers, this change will
hopefully save someone else some time in the future verifying that the
accesses are safe. A side effect is that the reglock is acquired only
once for each read/modify/write cycle as opposed to twice previously.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10248 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:53:18 +00:00
Shaun Ruffell
a81fb56b5f wct4xxp: Fix spelling
Contains a minor spelling correction.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10247 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:53:13 +00:00
Shaun Ruffell
ef426966d6 wct4xxp: Change t4_span.spantype to linemode.
Since 'linemode' more accurately describes what spantype is specifying.
We can also use an enumeration for the linemode to make it explicit that
linemode is only set to one of three possible values.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10246 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:53:09 +00:00
Shaun Ruffell
133be4bb27 wct4xxp: Trivial refactoring in t4_init_one().
Use some convenience pointers to make the function easier to read as opposed
to indexing into the arrays.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10245 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:53:05 +00:00
Shaun Ruffell
73764a1dc9 wct4xxp: Add has_e1_span() helper.
All those checks for wc->t1e1 span appear to basically be there to
determine if there are *any* E1 spans exported by the card. We can make
that explicit by wrapping those tests with a has_e1_span() inline
function to help with readability.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10244 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:53:00 +00:00
Shaun Ruffell
19e874f682 wcte12xp: Deprecate 't1e1override' module parameter in favor of 'default_linemode'.
't1e1override' isn't immediately apparent what it is supposed to do by the
name. Instead 'default_linemode' module parameter can be set to "auto", "t1",
or "e1" to make it clear.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10243 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:56 +00:00
Shaun Ruffell
22e054a958 wct4xxp: Remove redundant 'vpm' from struct t4.
Since removal of the VPM400 support the 'vpm' member of struct t4 is
now redundant with the 'vpm450m' member.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10242 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:52 +00:00
Russ Meyerreicks
20ee5f5b0c wct4xxp: Remove vpm400 support.
The VPM400 module is no longer supported by the wct4xxp driver. The
VPMOCT064 and VPMOCT128 are.

Signed-off-by: Russ Meyerreicks <rmeyerriecks@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10241 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:48 +00:00
Shaun Ruffell
ac09987a59 wct4xxp: Remove unused debugging code
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10240 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:44 +00:00
Shaun Ruffell
eae6c0d1e7 wct4xxp: Turn off the fancy alarm LEDS.
Saves about a 1us on average from the interrupt handler on one test
system.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10239 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:39 +00:00
Shaun Ruffell
0544f8c7cc wct4xxp: Hold a pointer to the devtype directly
Eliminates the need to store a copy of the flags and variety from the
global devtype.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10238 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:35 +00:00
Shaun Ruffell
a01f74d64a wct4xxp: Remove unused fields from 'struct t4' and 'struct t4_span'
'memaddr' and 'memlen' is already cached as part of the underlying pci
device so the wct4xxp driver does not need to cache it again.  'canary',
'passno', 'master', and 'oct_rw_count' are unused.

In t4_span 'irqmisses' was incremented, but never used anywhere, and there is
already the irqmisses on the span itself.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10237 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:31 +00:00
Shaun Ruffell
58514bc801 wct4xxp: Remove prefetching support.
I was unable to measure a performance change with prefetching.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10236 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:26 +00:00
Shaun Ruffell
fabe174b83 wct4xxp: Use in-hardirq version of dahdi_receive/transmit.
We are already in hardirq context and can therefore save the cli/sti
call.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10235 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:22 +00:00
Shaun Ruffell
d8c0898fb7 wct4xxp: __t4_framer_in and __t4_framer_out speedups.
Speeds up these calls primarily by eliminating unnecessary flushes
of writes to the PCI bus.

Before:

 7.095 us    |  __t4_framer_in();
 5.835 us    |  __t4_framer_out();
 7.122 us    |  __t4_framer_in();
 7.071 us    |  __t4_framer_in();
 7.059 us    |  __t4_framer_in();
 5.859 us    |  __t4_framer_out();
 7.076 us    |  __t4_framer_in();
 5.852 us    |  __t4_framer_out();
 7.124 us    |  __t4_framer_in();
 7.080 us    |  __t4_framer_in();

After:

 1.694 us    |  __t4_framer_out();
 1.686 us    |  __t4_framer_out();
 1.695 us    |  __t4_framer_out();
 3.182 us    |  __t4_framer_in();
 3.283 us    |  __t4_framer_in();
 2.889 us    |  __t4_framer_in();
 2.942 us    |  __t4_framer_in();
 2.951 us    |  __t4_framer_in();
 2.906 us    |  __t4_framer_in();

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10234 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:18 +00:00
Shaun Ruffell
fbc506c865 wct4xxp: Remove 'pedanticpci' module parameter.
The 'pedanticpci' module parameter, which is always on by default,
inserts extra reads from the card in order to ensure that all writes are
properly flushed through any PCI bridges which may post the writes.  The
side effect is that this takes more CPU time for registers reads and
writes, especially to the framer registers.

It is never recommended to run with pedanticpci set to 0, so I'm
removing it as a module parameter so that the default case does not take
a performance hit checking for whether the parameter is set or not.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10233 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:14 +00:00
Shaun Ruffell
2c4dad3c58 wct4xxp: Remove some debug information from the kernel logs.
Also has the nice side effect of eliminating a comparison from the
interrupt handler.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10232 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:10 +00:00
Shaun Ruffell
2c341b481e wct4xxp: Slow down the rate we poll the framers in alarm.
The overhead of reading the framer registers is significant and can
result in latency bumps / data drops on heavily loaded systems.
Instead of checking all spans every millisecond when they are in
alarm we will instead only check every 100 ms.

On one test system, dropped the % CPU time spent in hard interrupt
context from 10% per TDM4XX when all four spans are in alarm to
closer to 2%.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10231 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:06 +00:00
Shaun Ruffell
9c8eb34337 wct4xxp: Move "hardware DTMF disabled" message from dev_notice -> dev_info
This is the "normal" condition and can be lumped with the other
informational messages. Otherwise, just this one message might go to the
console depending on the system configuration which can be confusing.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10230 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:52:01 +00:00
Shaun Ruffell
fba8fd1a70 wctdm24xxp: Remove DEBOUNCING_RINGING_OFF from ring_detector_state enum.
This value is not used and is now gone.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10229 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:51:57 +00:00
Shaun Ruffell
534c7e7547 wctdm24xxp: Setup all VPMADT032 channels on hybrid cards.
r10160 "wctdm24xxp: Probe for and configure modules in parallel."
did not properly setup the VPMADT032 for all ports on hybrid cards.
The most immediate sympton being that spans 3 and up on a hybrid
card would not come up in Asterisk even though they were out of
alarm. This was because the echo canceler was blocking messages on
the dchannels.

This does not affect any previously released versions of DAHDI-Linux
or users of the VPMOCT032.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10228 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:51:53 +00:00
Shaun Ruffell
f02b476fee dahdi: Add functions for determining spantype (E1/T1) to include/dahdi/kernel.h
Uses the linecompat member to determine what type of span it is. This will
allow removing T1/E1 flags from other places where the span type is stored.

This function also changes the return value from bool to int for the
inlines defined in include/dahdi/kernel.h. This is because not all
kernel versions include stdbool.h in the headers and it will conflict
with boolean values that are exported via module parameters on some
older kernels if dahdi included it globally.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10227 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:51:49 +00:00
Shaun Ruffell
4231523c2f dahdi: Define pr_xxx macros if not already defined.
The pr_ macros are the recommended way for subsystems to print messages
but not all kernel versions DAHDI support has them defined.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10226 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-20 20:51:44 +00:00
Shaun Ruffell
ae2785e0e7 wct4xxp: Fix condition where hardware echo canceler erroneously mutes DTMF.
Commit r9750 "wct4xxp: Reduce the memory footprint of the hardware
echocanceler.", as part of reducing the non-pageable memory required to
support the VPMOCT064 and VPMOCT128, disabled caching of some hardware
echocan registers. This resulted in more physical reads to the echo
canceler. These new read transactions exposed an existing issue where
sometimes reads could be turned into writes which put a channel into an
unintended state preventing Asterisk from detecting any DTMF.

This issue is resolved by ensuring that the write signal to the Octasic
part is explicitly cleared between when the address is presented on the
bus and when the read and chip select signals are asserted. The cost is
an increase in the average time to enable / disable echo cancellation by
about 5 us on one Intel Xeon X3220 test machine (~250ns increase per
read from the Octasic part and 20 reads to enable / disable a channel).

This commit resolves a behavioral regression first introduced in 2.5.0
and 2.4.1 which could take many calls before revealing itself. This
change only affects cards with a VPMOCT128 or VPMOCT064 installed.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Doug Bailey <dbailey@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10220 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-12 16:12:33 +00:00
Shaun Ruffell
4edd8a1973 wctc4xxp: Allow G723 SID frames to pass to the hardware decoder.
The driver has, until now, dropped G723 SID frames even though the
firmware on the TC400/TCE400 can handle them. Now let them on
through.

Reported-and-Tested-by: Angel Carhuas <acarhuas@colinanet.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10218 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-30 19:12:42 +00:00
Shaun Ruffell
17e0f2b7bb wcte12xp: Set uncollected performance counters to -1.
The intent here is to flag to users that the maintenance counters are
not collected for spans exported by the wcte12xp driver.

dahdi_maint before this change:

  # dahdi_maint -s 1
  Span 1:
  >Framing Errors : 0:
  >CRC Errors : 0:
  >Code Violations : 0:
  >E-bit Count : 0:
  >General Errored Seconds : 0:

And after:

  # dahdi_maint -s 1
  Span 1:
  >Framing Errors : -1:
  >CRC Errors : -1:
  >Code Violations : -1:
  >E-bit Count : -1:
  >General Errored Seconds : -1:

This can be combined with a change to dahdi_maint to recognize that the
errors are -1 and print an even more explicit warning.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10212 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-29 16:11:50 +00:00
Shaun Ruffell
5afc62e856 wctdm24xxp: Set dahdi_span.devicetype string in one place.
Currently, the devicetype string was set both when the device was first
allocated and updated when an echocanceler was detected. For simplicity,
combine both these steps into a single function.

This change also replaces an improper use of strncat with strlcat.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10210 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-27 22:08:31 +00:00
Tzafrir Cohen
dafb5f401b xpp: fix FXS D DTMF detection (not zero)
* 'D' DTMF digits were accidentally discarded with the notice message:
  "Bad DTMF value 0. Ignored".
* No need for an odd 1-based translation table anymore - it's 0-based.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10209 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-27 17:10:48 +00:00
Shaun Ruffell
e025a651fb dahdi: Check for master in DAHDI_STARTUP / resolves MeetMe regression.
There were a couple of reports that MeetMe conferences were not
working in 2.5.0.1 and that downgrading to 2.4.1.2 resolved the
issue. This could occur if there were no analog spans in a system,
and all the digital spans were out of alarm before DAHDI_STARTUP
ioctl was called by dahdi_cfg. If the spans were *not* out of alarm,
they would be marked master when the span changes it's alarm state.

This would result in a condition where no spans were marked as the
"master" and so the core timer was handling conferencing. The core
timer runs by default at 4ms and most board drivers run at 1ms
intervals, but a channel currently only buffers up 2ms of data when
conferenced. Therefore, 2ms of audio from a board was continuously
dropped from the conference every 4ms by default.

This fixes a regression first introduced in 2.5.0 which was
specifically added in revision r9611 "dahdi: Do not locate new
master in interrupt context."

Internal-reference-ID: DAHDI-894
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Tested-by: Dennis Martinez <dmartinez@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10205 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-23 20:18:36 +00:00
Shaun Ruffell
dfab257fef wct4xxp: Remove unused t4_span.psync and t4_span.redalarms.
These members are not used anywhere and are now gone.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10204 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-23 20:18:29 +00:00
Shaun Ruffell
6fcd923dee wctdm24xxp, wcte12xp: Advertise VPMOCT032 presence in dahdi_span.devicetype.
A "(VPMADT032)" string is appended to the devicetype (as shown by
dahdi_scan) for the span if one is installed. Now append '(VPMOCT032)'
if one is installed as well.

Also, for the wcte12xp driver append the VPM name to the device type after
initially probing as opposed to only after the span is configured.

(Related to issue DAHDI-890)
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10203 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-23 20:18:21 +00:00
Tzafrir Cohen
1ba9a007d1 xpp: fxs: bugfix for 2fxs+6fxo cards
* Bug sympthoms: wrong FSK VMWI sent few seconds after
  offhook. That was caused because the driver kept
  polling the (physically unconnected) digital inputs.
  [note: a workaround for drivers without this patch
   is to zero the 'xpd_fxs.poll_digital_inputs' parameter.]

* Also, the digital_inputs/digital_output masks were
  calculate using a different condition.

* Now we determine number of channels, digital inputs and
  digital outputs in a single place and use this info
  later to calculate the correct masks.

* We poll only if there are digital_inputs

* We added a sanity check in process_digital_inputs, so
  we get a notice if it's called on an xpd without digital
  inputs (e.g: hypothetic firmware bug).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10202 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-22 18:55:44 +00:00
Shaun Ruffell
d4ee448c7e dahdi: Decrease the initial coretimer delay to 4ms from 1 second.
DAHDI currently waits a second before checking if a board driver is
calling dahdi_receive and switching to internal timing. Some versions of
Asterisk (I was looking at 1.4.42 when writing this) only wait 300ms for
a timer to expire when first starting and verifying that DAHDI is
properly configured. This can result in a

"ERROR[27673] asterisk.c: Asterisk has detected a problem with your DAHDI
configuration and will shutdown for your protection. You have options:"

message if asterisk is started soon after loading DAHDI.

This change sets the inital polling interval to the same as that used
during normal coretimer operation, 4ms. The interval will still be
slowed to 1 second if a board driver starts calling dahdi_receive().

DAHDI-892.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10200 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-13 18:28:58 +00:00
Tzafrir Cohen
dc6ef91241 xpp: firmware to detect the new 2+6 module
New firmwares to handle the new 2FXS/6FXO module.

FPGA_1161.hex, PIC_TYPE_1.hex, PIC_TYPE_2.hex of internal rev. 9732

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10179 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-05 09:51:55 +00:00
Doug Bailey
0c5b91cc80 wcte12xp, wctdm24xxp: Update VPMOCT032 firmware to 1.11.0.
Firmware version 1.11.0 resolves an issue where the driver fails to
detect certain VPMOCT032 modules after a cold boot.

Signed-off-by: Doug Bailey <dbailey@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10172 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 20:58:06 +00:00
Shaun Ruffell
57f80508b5 wctdm24xxp: Remove fwringdetect module parameter.
The driver / FXO modules now always operate in a fwringdetect mode and the
module parameter was never checked anywhere. It is now gone.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10171 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:45 +00:00
Shaun Ruffell
17f0170829 wctdm24xxp: Use interval for debouncing FXO polarity detection.
Eliminate the assumption that the check function is going to be called
for every frame. Also use a state machine to make polarity debouncing
similar to the other debouncing code.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10170 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:41 +00:00
Shaun Ruffell
874b76bd22 wctdm24xxp: Use interval for debouncing FXO battery.
Allows the driver the option of not calling the misc function for every
frame.  This is part of preparation for moving misc processing out of
the interrupt handler.  Also use a state machine for the various battery
states to unify the technique for debouncing the various signals in the
driver.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10169 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:36 +00:00
Shaun Ruffell
cea4b8bda3 wctdm24xxp: Use time interval for debouncing FXO ring detect.
Do not assume the ring detection function is called for every frame.
Also change the debounce logic to a state machine to clarify what state
a port is in and unify the technique for debouncing the various signals.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10168 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:32 +00:00
Shaun Ruffell
60caca49f4 wctdm24xxp: Use interval for checking FXS on hook transfer timer.
Part of moving more of the module specific processing out of the
interrupt handler and allowing the interrupt rate to be slowed down.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10167 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:27 +00:00
Shaun Ruffell
b5bacb94a7 wctdm24xxp: 'oppending_ms' shouldn't assume being checked at 1ms intervals.
Part of preparations for being able to optionally slow the interrupt
rate down and opening the door for moving more module processing out of
the interrupt handler.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10166 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:23 +00:00
Shaun Ruffell
a2aba65e0c wctdm24xxp: Name the shadow registers for each modules.
Saved me time when reading the code so I don't have to lookup which position
in the index is what register for each of the modules.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10165 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:19 +00:00
Shaun Ruffell
32bb7d4c10 wctdm24xxp: Change intcount to framecount.
The variable does not necessarily have anything to do with the frequency
of interrupts but is instead a count of sframes received. For example,
it is possible to slow the interrupt rate down on the voicebus cards to
one every 2 frames.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10164 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:14 +00:00
Shaun Ruffell
fd3eb2da05 wctdm24xxp: Use fact that handle_transmit/receive are called in hard-irq
We can spend less time in interrupt context by not saving and restoring the
local interrupt state. This is a particularly noticeable improvement on debug
kernels with lockdep.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10163 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:10 +00:00
Shaun Ruffell
25cb4126c8 wctdm24xxp: Protect creation / destruction of VPM instance.
Closes a small window of opportunity where one CPU might free a VPM
instance that the interrupt handler may currently be using.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10162 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:06 +00:00
Shaun Ruffell
3d8629e864 wctdm24xxp: Reset the polarity debounce setting when battery is lost.
Wait until we have de-bounced the presence of battery before moving on the
check for changes in polarity. This removes the sometimes random
polarity messages generated on an FXO port when the far side drops
battery from a supervisor disconnect.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10161 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:38:01 +00:00
Shaun Ruffell
1d03f6f8a8 wctdm24xxp: Probe for and configure modules in parallel.
Use the newly create bg_create and bg_join to actually probe / configure
groups of 4 modules in parallel. This currently has to be done in groups
of four due to the way 4-port modules are identified relative to single
port modules.

This provides a dramatic improvement in driver load time. When loading a
single TDM2400 with 24 FXS ports before this change:

    # time modprobe wctdm24xxp vpmsupport=0

    real    0m46.674s
    user    0m0.000s
    sys     0m0.520s

And after this change:

    # time modprobe wctdm24xxp vpmsupport=0

    real    0m7.900s
    user    0m0.000s
    sys     0m0.070s

Note that the boards themselves are still configured serially. Board
configuration can be parallelized once the assignment of board position
is moved out of the function that is run in parallel. Otherwise it could
be possible for board numbers to switch on repeated loads.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10160 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:37:57 +00:00
Shaun Ruffell
cfafd3a7b7 wctdm24xxp: Introduce bg_create/bg_join.
Create a generic facility to spawn tasks to run in parallel. There are
interfaces already in the kernel for doing this, but they are not
supported on the full range of kernels that DAHDI must support.

This will be used to identify and configure FXS/FXO/B400M/VPM modules in
parallel.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10159 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-30 16:37:52 +00:00
Tzafrir Cohen
a3fd58979d xpp: FXS: new 2+6 module has no digital I/O ports
This module is recognized via subtype==4

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10158 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-28 09:46:12 +00:00
Shaun Ruffell
77ec2dce9f wcte12xp: Abort driver bind if read/write test fails.
When the driver begins to initialize a device it conducts a read/write
test on one of the framer registers. The driver ignores the result of
that test and results in much output spammed to the kernel logs for a
failed card since the driver doesn't then try to unbind from the device.

What was getting spammed:
     wcte12xp 0000:03:01.0: Timeout in t1_getreg
     wcte12xp 0000:03:01.0: Wrote '0' but read 'fffffffb'

Now abort the bind if the read / write test fails.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10155 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-25 18:28:53 +00:00
Tzafrir Cohen
cdeaafb910 xpp: fix bashism in xpp_debug
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10152 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-24 08:11:38 +00:00
Tzafrir Cohen
41c24c400e live_dahdi: optionally generate FreePBX DB entries
If LIVE_DAHDI_FREEPBXDB=yes is set in live.conf, live_dahdi will also
generate FreePBX astdb entries for the FXS entensions it probed (using
the dahdi_genconf module freepbxdb).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10151 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-24 08:03:19 +00:00
Shaun Ruffell
f74112b551 wctdm24xxp: Set 'fastoffhook' counter to 8ms and turn off calibration delay.
r10006 "wctdm24xxp: Add 'fastpick' module parameter." copied the
fast-off hook module parameter from the wctdm.c driver, but the setting
in that driver does not match the data sheet. The previous commit did
not actually change any of the significant bits in that register. Also,
that commit changed the timer, but did not disable the callibration
delay which is necessary for Type-II callerid.

The fastpickup option in the wctdm24xxp driver should now match the
fastpickup option in the wctdm driver.

DAHDI-224.

Reported-By: Kinnith Wallace <kwallace@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10148 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-19 22:40:41 +00:00
Shaun Ruffell
0bc7ff0816 wctdm: Set 'fastpickup' counter to 8ms
This fixes what looks like a typo in r1055 [1].

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=1055

Reported-by: Kinnith Wallace <kwallace@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10147 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-19 22:40:36 +00:00
Shaun Ruffell
ad4489c7f4 wctdm24xxp: Use our own free list for IRQ commands.
Really only *necessary* when SLAB debugging is enabled, but in that
case, can reduce the chance of latency bumps when first loading the
driver. Otherwise the constant slab poisoning / checking in interrupt
context from the kmalloc / kfrees is too much.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10144 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-18 19:21:44 +00:00
Russ Meyerriecks
1862d8040c wcte12xp, wctdm24xxp: Remove frowny face from vpmoct032 error message
:O(

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10141 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-15 21:57:53 +00:00
Russ Meyerriecks
3b20fe39af wct4xxp: Bug in timing cable with different span density cards
The logic loops through the static cards[] array to determine timing,
    but the subloop was based off the current card's numspans member.
    This could cause a null dereference in the case where two cards of
    different span densities were connected via timing cables.

Reported-by: Doug Bailey <dbailey@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10140 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-15 21:57:49 +00:00
Shaun Ruffell
eda8ceea1c wctc4xxp: Fix lock imbalance in wctc4xxp_watchdog.
r10082 "wctc4xxp: Cleanup in-flight commands when halting due to
hardware error." introduced a lock imblance on the error path where the
cmd_list_lock would be unlocked twice when the board is halted due to a
hardware error. Thanks sparse.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10138 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-15 21:49:36 +00:00
Shaun Ruffell
e25a65b692 wcte12xp, wctdm24xxp: Force local interrupts off in the interrupt handler.
r10066 "wctdm24xxp, wcte12xp: Run the ISR with interrupts disabled."
requested that the interrupt handler be run in "fast" mode (disabled)
but this isn't necessarily guaranteed.

This patch makes the interrupt handler itself disable all the interrupts.
Linux commit 470c66239ef0336429b35345f3f615d47341e13b [1] contains a comment
about why this is necessary.

[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=470c66239ef03364

(closes issue DAHLIN-248)
Reported-and-Tested-by: Vladimir Mikhelson <vlad@mikhelson.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10118 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-12 15:58:27 +00:00
Wagner Gegler
4f8b2dded1 dahdi_dynamic: Call dahdi_receive in rx packet handler.
Currently dahdi_receive is called on all channels in the context of the
master dynamic span. If one span (not the master) receive two packets
before the master span received a packet, the older packet on the
dynamic span would end up lost because the "readchunk" for the
channels would be overwritten by the new packet. DAHLIN-245

Signed-off-by: Wagner Gegler <wagner@aligera.com.br> (License #6268)
Changed dahdi_ec_chunk to dahdi_ec_span.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10110 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-10 19:22:01 +00:00
Shaun Ruffell
77113b822f dahdi: Define HAVE_NET_DEVICE_OPS on kernels > 2.6.29
HAVE_NET_DEVICE_OPS was defined in the mainline kernel in commit
47fd5b83 which was first released in 2.6.29. Any kernels after that will
have those fields defined.

Mainline commit e2270ea62ae4d7a removed the feature test macros, so
the easiest thing to do is define HAVE_NET_DEVICE_OPS ourselves on the
kernels since it was committed.

This change is needed to compile against the 3.1 kernel.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10109 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-10 19:21:56 +00:00
Tzafrir Cohen
c793b1b173 FPGA_1161 rev 9605: EC related bug fixes
Astribank II FPGA firmware rev 9605. Includes two bug fixes:

* Error in checking EC licenses when the license was for exactly 64 or 128
  channels.
* Proper handling of a slave FXO Astribank (in line with the quirks
  handling from r10019).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10099 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-09 12:20:08 +00:00
Shaun Ruffell
d401ad4233 wctc4xxp, wcte12xp, wctdm24xxp: Remove check for HAVE_NETDEV_PRIV
DAHDI currently supports kernels >= 2.6.9. netdev_priv() has been in the
mainline kernel since versions 2.6.6 so it's available in all the
supported kernels. This change is needed to compile against the 3.1 kernel.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10096 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-08-08 06:38:25 +00:00
52 changed files with 13854 additions and 5102 deletions

1
.version Normal file
View File

@@ -0,0 +1 @@
2.6.0

6075
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

176
README
View File

@@ -17,6 +17,7 @@ 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
@@ -538,6 +539,7 @@ 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.
@@ -557,6 +559,81 @@ 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.
@@ -644,6 +721,103 @@ 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
@@ -721,7 +895,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_register()'.
spans with the DAHDI core using 'dahdi_device_register()'.
'struct dahdi_span' has a number of informative members that are updated
solely by the low-level driver:

View File

@@ -293,6 +293,10 @@ 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

View File

@@ -6,6 +6,7 @@ obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_ETH) += dahdi_dynamic_eth.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_DYNAMIC_ETHMF) += dahdi_dynamic_ethmf.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_TRANSCODE) += dahdi_transcode.o
ifdef CONFIG_PCI
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT4XXP) += wct4xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTC4XXP) += wctc4xxp/
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM24XXP) += wctdm24xxp/
@@ -20,6 +21,7 @@ obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE11XP) += wcte11xp.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCFXO) += wcfxo.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_TOR2) += tor2.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_PCIRADIO) += pciradio.o
endif
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_XPP) += xpp/

File diff suppressed because it is too large Load Diff

View File

@@ -49,6 +49,311 @@ 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)
{
@@ -78,7 +383,15 @@ 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))
@@ -88,13 +401,55 @@ 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];
@@ -137,10 +492,248 @@ 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) {
dev_notice(dev, "badly formatted input (should be <num>:<num>:<num>)\n");
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);
@@ -166,7 +759,60 @@ 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)
@@ -174,6 +820,12 @@ 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);
@@ -220,6 +872,20 @@ 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,4 +34,28 @@ 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,16 +200,9 @@ 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);
@@ -370,6 +363,9 @@ 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();
@@ -404,6 +400,7 @@ 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);
}
@@ -473,7 +470,7 @@ static int _destroy_dynamic(struct dahdi_dynamic_span *dds)
return -EBUSY;
}
dahdi_unregister(&d->span);
dahdi_unregister_device(d->ddev);
spin_lock_irqsave(&dspan_lock, flags);
list_del_rcu(&d->list);
@@ -582,8 +579,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);
@@ -661,8 +658,9 @@ 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(&d->span, 0)) {
if (dahdi_register_device(d->ddev, d->dev)) {
printk(KERN_NOTICE "Unable to register span '%s'\n",
d->span.name);
dynamic_put(d);
@@ -773,7 +771,7 @@ void dahdi_dynamic_unregister_driver(struct dahdi_dynamic_driver *dri)
WARN_ON(1);
}
}
dahdi_unregister(&d->span);
dahdi_unregister_device(d->ddev);
spin_lock_irqsave(&dspan_lock, flags);
list_del_rcu(&d->list);
spin_unlock_irqrestore(&dspan_lock, flags);

View File

@@ -24,14 +24,16 @@
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.8.0
VPMOCT032_VERSION:=1.12.0
WCT820_VERSION:=1.76
FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-TC400M FIRMWARE-HX8 FIRMWARE-VPMOCT032
ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-OCT6114-256 FIRMWARE-TC400M FIRMWARE-HX8 FIRMWARE-VPMOCT032 FIRMWARE-TE820
# 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
@@ -42,15 +44,18 @@ ALL_FIRMWARE=FIRMWARE-OCT6114-064 FIRMWARE-OCT6114-128 FIRMWARE-TC400M FIRMWARE-
# 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)
@@ -123,6 +128,17 @@ 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
@@ -156,6 +172,17 @@ 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:
@@ -184,6 +211,11 @@ 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 128
#define cOCT6100_MAX_ECHO_CHANNELS 256
#endif
#define cOCT6100_MAX_TSI_CNCTS 1530
#define cOCT6100_MAX_CALLER_ID_PLAYOUT_BUFFERS ( 3328 + 6 )

View File

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

View File

@@ -97,6 +97,7 @@ 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 */
@@ -285,10 +286,6 @@ 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;
@@ -322,19 +319,31 @@ 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;
if (dahdi_register(s, 0)) {
printk(KERN_ERR "Unable to register span %s\n", s->name);
goto error_exit;
}
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;
}
writew(PLX_INTENA, &tor->plx[INTCSR]); /* enable PLX interrupt */
@@ -342,14 +351,6 @@ 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)
@@ -365,6 +366,8 @@ 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);
}
@@ -631,7 +634,6 @@ 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)
@@ -641,11 +643,7 @@ static void __devexit tor2_remove(struct pci_dev *pdev)
writeb(0, &tor->mem8[LEDREG]);
writew(0, &tor->plx[INTCSR]);
free_irq(tor->irq, tor);
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);
}
dahdi_unregister_device(tor->ddev);
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 200ms */
ret = wait_for_completion_timeout(&cmd->complete, HZ/5);
/* We'll wait for 2s */
ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
if (unlikely(!ret)) {
spin_lock_irqsave(&vpm->list_lock, flags);
list_del(&cmd->node);

View File

@@ -36,6 +36,7 @@
#ifndef _GPAKCUST_H /* prevent multiple inclusion */
#define _GPAKCUST_H
#include <linux/module.h>
#include <linux/device.h>
#include <linux/completion.h>
#include <linux/workqueue.h>

View File

@@ -1683,6 +1683,7 @@ 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);
@@ -1693,6 +1694,8 @@ 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) &&
@@ -1733,6 +1736,7 @@ 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;
}
@@ -1881,7 +1885,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_DISABLED,
retval = request_irq(vb->pdev->irq, vb_isr, DAHDI_IRQ_SHARED,
board_name, vb);
if (retval) {
dev_warn(&vb->pdev->dev, "Failed to request interrupt line.\n");
@@ -2026,7 +2030,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(NULL, 0);
dahdi_register_device(NULL, NULL);
spin_lock_init(&loader_list_lock);
return 0;
}

View File

@@ -35,22 +35,16 @@
#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 *
@@ -209,23 +203,14 @@ 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 :O(\n");
dev_err(vpm->dev, "vpmoct_read_byte cmd timed out\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 (bspan->parent->card_type == B410P)
if (vpmsupport && (B410P == bspan->parent->card_type))
return "LASVEGAS2";
return NULL;
}
@@ -2475,7 +2475,6 @@ 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;
@@ -2494,11 +2493,6 @@ 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 */
@@ -2930,14 +2924,27 @@ 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++) {
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;
}
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;
}
@@ -2973,10 +2980,7 @@ 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:
while (x) {
dahdi_unregister(&b4->spans[x].span);
x--;
};
dahdi_unregister_device(b4->ddev);
b4xxp_init_stage1(b4); /* full reset, re-init to "no-irq" state */
free_irq(pdev->irq, b4);
@@ -2997,6 +3001,8 @@ 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:
@@ -3011,14 +3017,11 @@ 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;
for (i=b4->numspans - 1; i >= 0; i--) {
dahdi_unregister(&b4->spans[i].span);
}
dahdi_unregister_device(b4->ddev);
b4xxp_init_stage1(b4);
remove_sysfs_files(b4);
@@ -3033,6 +3036,8 @@ 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,6 +474,7 @@ 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,6 +135,7 @@ 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;
@@ -647,19 +648,24 @@ 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);
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->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;
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
@@ -668,7 +674,8 @@ static int wcfxo_initialize(struct wcfxo *wc)
wc->chan->pvt = wc;
wc->span.ops = &wcfxo_span_ops;
if (dahdi_register(&wc->span, 0)) {
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
}
@@ -976,7 +983,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(&wc->span);
dahdi_unregister_device(wc->ddev);
free_irq(pdev->irq, wc);
/* Reset PCI chip and registers */
@@ -984,6 +991,8 @@ 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;
}
@@ -995,9 +1004,11 @@ static int __devinit wcfxo_init_one(struct pci_dev *pdev, const struct pci_devic
static void wcfxo_release(struct wcfxo *wc)
{
dahdi_unregister(&wc->span);
dahdi_unregister_device(wc->ddev);
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,6 +159,7 @@ 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 */
};
@@ -272,10 +273,11 @@ static void t1xxp_release(struct t1xxp *wc)
{
unsigned int x;
dahdi_unregister(&wc->span);
dahdi_unregister_device(wc->ddev);
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");
}
@@ -770,14 +772,20 @@ 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->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->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.chans = wc->chans;
wc->span.flags = DAHDI_FLAG_RBS;
if (wc->ise1) {
@@ -801,7 +809,8 @@ static int t1xxp_software_init(struct t1xxp *wc)
wc->chans[x]->chanpos = x + 1;
}
wc->span.ops = &t1xxp_span_ops;
if (dahdi_register(&wc->span, 0)) {
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
}
@@ -908,10 +917,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->span.irqmisses++;
wc->ddev->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->span.irqmisses++;
wc->ddev->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
wct4xxp-objs += $(FIRM_DIR)/dahdi-fw-oct6114-064.o $(FIRM_DIR)/dahdi-fw-oct6114-128.o $(FIRM_DIR)/dahdi-fw-oct6114-256.o
endif
$(obj)/$(FIRM_DIR)/dahdi-fw-oct6114-064.o: $(obj)/base.o
@@ -25,3 +25,6 @@ $(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[128];
int chanflags[128];
int ecmode[128];
UINT32 aulEchoChanHndl[256];
int chanflags[256];
int ecmode[256];
int numchans;
};
@@ -422,6 +422,7 @@ 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;
@@ -467,15 +468,22 @@ 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
@@ -507,7 +515,11 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct f
kfree(ChannelOpen);
return NULL;
}
for (x = 0; x < ARRAY_SIZE(vpm450m->aulEchoChanHndl); x++) {
sout_stream = (8 == numspans) ? 29 : 2;
rout_stream = (8 == numspans) ? 24 : 3;
for (x = 0; x < ((8 == numspans) ? 256 : 128); 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)) {
@@ -515,7 +527,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 & 0x03])
if (isalaw[x & 0x07])
law = cOCT6100_PCM_A_LAW;
else
law = cOCT6100_PCM_U_LAW;
@@ -529,11 +541,13 @@ 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 = 2;
ChannelOpen->TdmConfig.ulSoutStream = sout_stream;
ChannelOpen->TdmConfig.ulSoutTimeslot = x;
#if 1
ChannelOpen->TdmConfig.ulRoutPcmLaw = law;
ChannelOpen->TdmConfig.ulRoutStream = 3;
ChannelOpen->TdmConfig.ulRoutStream = rout_stream;
ChannelOpen->TdmConfig.ulRoutTimeslot = x;
#endif
ChannelOpen->VqeConfig.fEnableNlp = TRUE;
ChannelOpen->VqeConfig.fRinDcOffsetRemoval = TRUE;
ChannelOpen->VqeConfig.fSinDcOffsetRemoval = TRUE;
@@ -543,7 +557,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!\n", x);
printk(KERN_NOTICE "Failed to open channel %d %x!\n", x, ulResult);
continue;
}
for (y = 0; y < ARRAY_SIZE(tones); y++) {

View File

@@ -54,6 +54,12 @@
#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
@@ -76,6 +82,13 @@
#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
@@ -113,6 +126,11 @@ 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
@@ -120,5 +138,7 @@ struct t4_regs {
#define T4_CHANGE_LATENCY 4
#define T4_IGNORE_LATENCY 5
#define WCT4_GET_REGS _IOW (DAHDI_CODE, 60, struct t4_regs)
#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)

View File

@@ -73,20 +73,6 @@
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)
@@ -394,22 +380,16 @@ 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
}
@@ -494,6 +474,7 @@ wctc4xxp_skb_to_cmd(struct wcdte *wc, const struct sk_buff *skb)
return cmd;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
static void
wctc4xxp_net_set_multi(struct net_device *netdev)
{
@@ -501,6 +482,15 @@ wctc4xxp_net_set_multi(struct net_device *netdev)
DTE_DEBUG(DTE_DEBUG_GENERAL, "%s promiscuity:%d\n",
__func__, netdev->promiscuity);
}
#else
static void
wctc4xxp_set_rx_mode(struct net_device *netdev)
{
struct wcdte *wc = wcdte_from_netdev(netdev);
DTE_DEBUG(DTE_DEBUG_GENERAL, "%s promiscuity:%d\n",
__func__, netdev->promiscuity);
}
#endif
static int
wctc4xxp_net_up(struct net_device *netdev)
@@ -664,7 +654,11 @@ wctc4xxp_net_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
#ifdef HAVE_NET_DEVICE_OPS
static const struct net_device_ops wctc4xxp_netdev_ops = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
.ndo_set_multicast_list = &wctc4xxp_net_set_multi,
#else
.ndo_set_rx_mode = &wctc4xxp_set_rx_mode,
#endif
.ndo_open = &wctc4xxp_net_up,
.ndo_stop = &wctc4xxp_net_down,
.ndo_start_xmit = &wctc4xxp_net_hard_start_xmit,
@@ -686,23 +680,14 @@ 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
@@ -2173,12 +2158,13 @@ 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)) {
if ((G723_5K_BYTES != count) && (G723_6K_BYTES != count) &&
(G723_SID_BYTES != count)) {
DTE_DEBUG(DTE_DEBUG_GENERAL,
"Trying to transcode packet into G723 format " \
"that is %Zu bytes instead of the expected " \
"%d/%d bytes.\n", count, G723_5K_BYTES,
G723_6K_BYTES);
"%d/%d/%d bytes.\n", count, G723_5K_BYTES,
G723_6K_BYTES, G723_SID_BYTES);
return -EINVAL;
}
cpvt->timestamp += G723_SAMPLES;
@@ -3336,6 +3322,7 @@ 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,6 +205,7 @@ struct wctdm {
struct pci_dev *dev;
char *variety;
struct dahdi_span span;
struct dahdi_device *ddev;
unsigned char ios;
int usecount;
unsigned int intcount;
@@ -1710,7 +1711,7 @@ static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual,
/* Misc. DAA parameters */
if (fastpickup)
reg31 = 0xb3;
reg31 = 0xe3;
else
reg31 = 0xa3;
@@ -2362,13 +2363,26 @@ 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);
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->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;
if (alawoverride) {
printk(KERN_INFO "ALAW override parameter detected. Device will be operating in ALAW\n");
wc->span.deflaw = DAHDI_LAW_ALAW;
@@ -2384,12 +2398,15 @@ 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;
if (dahdi_register(&wc->span, 0)) {
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
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;
@@ -2677,7 +2694,9 @@ 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(&wc->span);
dahdi_unregister_device(wc->ddev);
kfree(wc->ddev->location);
dahdi_free_device(wc->ddev);
kfree(wc);
return -EIO;
@@ -2708,10 +2727,14 @@ static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_devic
static void wctdm_release(struct wctdm *wc)
{
dahdi_unregister(&wc->span);
dahdi_unregister_device(wc->ddev);
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,7 +45,6 @@
* \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 */
@@ -85,7 +84,6 @@
#define NUM_CAL_REGS 12
#define ISR_COMMANDS 2
#define QRV_DEBOUNCETIME 20
#define VPM150M_HPI_CONTROL 0x00
@@ -107,10 +105,30 @@ 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;
@@ -146,29 +164,26 @@ struct wctdm_chan {
};
struct fxo {
int wasringing;
int lastrdtx;
int lastrdtx_count;
int ringdebounce;
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 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 {
int oldrxhook;
int debouncehook;
int lastrxhook;
int debounce;
int ohttimer;
u8 oht_active:1;
u8 off_hook:1;
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
@@ -180,13 +195,18 @@ struct fxs {
* voicebus ISR.
*/
int lasttxhook;
int oppending_ms;
u8 linefeed_control_shadow;
u8 hook_state_shadow;
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 {
@@ -203,6 +223,7 @@ struct qrv {
int radmode;
signed short rxgain;
signed short txgain;
u8 isrshadow[3];
};
enum module_type {
@@ -215,7 +236,7 @@ enum module_type {
};
struct wctdm_module {
union {
union modtypes {
struct fxo fxo;
struct fxs fxs;
struct qrv qrv;
@@ -227,7 +248,6 @@ struct wctdm_module {
struct list_head active_cmds;
u8 offsets[3];
u8 subaddr;
u8 isrshadow[ISR_COMMANDS];
u8 card;
enum module_type type;
@@ -242,7 +262,7 @@ struct wctdm {
spinlock_t frame_list_lock;
struct list_head frame_list;
unsigned int intcount;
unsigned long framecount;
unsigned char txident;
unsigned char rxident;
@@ -255,6 +275,7 @@ 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];
@@ -276,6 +297,7 @@ 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,6 +174,7 @@ 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 */
};
@@ -340,10 +341,12 @@ static void t1xxp_release(struct t1 *wc)
{
unsigned int x;
dahdi_unregister(&wc->span);
dahdi_unregister_device(wc->ddev);
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");
}
@@ -976,15 +979,21 @@ 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->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->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;
if (wc->spantype == TYPE_E1) {
if (unchannelized)
wc->span.channels = 32;
@@ -1011,7 +1020,8 @@ static int t1xxp_software_init(struct t1 *wc)
wc->chans[x]->chanpos = x + 1;
}
wc->span.ops = &t1xxp_span_ops;
if (dahdi_register(&wc->span, 0)) {
list_add_tail(&wc->span.device_node, &wc->ddev->spans);
if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
}
@@ -1118,10 +1128,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->span.irqmisses++;
wc->ddev->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->span.irqmisses++;
wc->ddev->irqmisses++;
}
for (y=0;y<DAHDI_CHUNKSIZE;y++) {
for (x=0;x<wc->span.channels;x++) {

View File

@@ -55,13 +55,18 @@
#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;
static int t1e1override = -1; /* deprecated */
static char *default_linemode = "auto"; /* 'auto', 'e1', or 't1' */
static int latency = VOICEBUS_DEFAULT_LATENCY;
static unsigned int max_latency = VOICEBUS_DEFAULT_MAXLATENCY;
static int vpmsupport = 1;
@@ -750,7 +755,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 < 24; i++) {
for (i = 0; i < wc->span.channels; i++) {
offset = i/8;
if (wc->span.chans[i]->flags & DAHDI_FLAG_CLEAR)
reg[offset] |= 1 << (7 - (i % 8));
@@ -771,19 +776,31 @@ 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);
@@ -803,14 +820,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 */
@@ -1004,12 +1021,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, struct dahdi_span *span)
static void t1xxp_framer_start(struct t1 *wc)
{
if (wc->spantype == TYPE_E1) { /* if this is an E1 card */
t1_configure_e1(wc, span->lineconfig);
if (dahdi_is_e1_span(&wc->span)) {
t1_configure_e1(wc, wc->span.lineconfig);
} else { /* is a T1 card */
t1_configure_t1(wc, span->lineconfig, span->txlevel);
t1_configure_t1(wc, wc->span.lineconfig, wc->span.txlevel);
__t1xxp_set_clear(wc);
}
@@ -1018,14 +1035,28 @@ static void t1xxp_framer_start(struct t1 *wc, struct dahdi_span *span)
static void set_span_devicetype(struct t1 *wc)
{
strncpy(wc->span.devicetype, wc->variety,
sizeof(wc->span.devicetype) - 1);
const char *olddevicetype;
olddevicetype = wc->ddev->devicetype;
#if defined(VPM_SUPPORT)
if (wc->vpmadt032)
strncat(wc->span.devicetype, " (VPMADT032)",
sizeof(wc->span.devicetype) - 1);
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);
#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)
@@ -1046,7 +1077,7 @@ static int t1xxp_startup(struct file *file, struct dahdi_span *span)
#endif
/* Reset framer with proper parameters and start */
t1xxp_framer_start(wc, span);
t1xxp_framer_start(wc);
debug_printk(wc, 1, "Calling startup (flags is %lu)\n", span->flags);
return 0;
@@ -1086,7 +1117,7 @@ static int t1xxp_chanconfig(struct file *file,
}
if (test_bit(DAHDI_FLAGBIT_RUNNING, &chan->span->flags) &&
(wc->spantype != TYPE_E1)) {
dahdi_is_t1_span(&wc->span)) {
__t1xxp_set_clear(wc);
}
return 0;
@@ -1101,7 +1132,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 (wc->spantype == TYPE_E1) { /* do it E1 way */
if (dahdi_is_e1_span(&wc->span)) { /* do it E1 way */
if (chan->chanpos == 16)
return 0;
@@ -1154,7 +1185,7 @@ static inline void t1_check_sigbits(struct t1 *wc)
if (!(test_bit(DAHDI_FLAGBIT_RUNNING, &wc->span.flags)))
return;
if (wc->spantype == TYPE_E1) {
if (dahdi_is_e1_span(&wc->span)) {
for (i = 0; i < 15; i++) {
a = t1_getreg(wc, 0x71 + i);
if (a > -1) {
@@ -1249,7 +1280,7 @@ static void t1xxp_maint_work(struct work_struct *work)
int reg = 0;
int cmd = w->cmd;
if (wc->spantype == TYPE_E1) {
if (dahdi_is_e1_span(&wc->span)) {
switch (cmd) {
case DAHDI_MAINT_NONE:
t1_info(wc, "Clearing all maint modes\n");
@@ -1321,7 +1352,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 (wc->spantype == TYPE_E1) {
if (dahdi_is_e1_span(&wc->span)) {
switch (cmd) {
case DAHDI_MAINT_NONE:
case DAHDI_MAINT_LOCALLOOP:
@@ -1570,6 +1601,7 @@ static int vpm_start_load(struct t1 *wc)
work->wc = wc;
queue_work(wc->wq, &work->work);
wc->not_ready++;
return 0;
}
@@ -1616,12 +1648,23 @@ static void check_and_load_vpm(struct t1 *wc)
options.vpmnlptype = vpmnlptype;
options.vpmnlpthresh = vpmnlpthresh;
options.vpmnlpmaxsupp = vpmnlpmaxsupp;
options.channels = (TYPE_T1 == wc->spantype) ? 24 : 32;
options.channels = dahdi_is_t1_span(&wc->span) ? 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;
@@ -1660,6 +1703,8 @@ 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)
@@ -1674,7 +1719,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 (wc->spantype == TYPE_E1) {
if (dahdi_is_e1_span(&wc->span)) {
/* E1 sigcap setup */
if (span->lineconfig & DAHDI_CONFIG_CCS) {
/* CCS setup */
@@ -1757,54 +1802,46 @@ static void t1xxp_disable_hw_preechocan(struct dahdi_chan *chan)
vpmoct_preecho_disable(wc->vpmoct, chan->chanpos - 1);
}
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)
/**
* 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)
{
int x;
int num;
struct pci_dev *pdev = wc->vb.pdev;
struct dahdi_chan *chans[32] = {NULL,};
struct dahdi_echocan_state *ec[32] = {NULL,};
unsigned long flags;
int res = 0;
/* 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;
}
/* 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;
}
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);
snprintf(wc->span.location, sizeof(wc->span.location) - 1,
"PCI Bus %02d Slot %02d", pdev->bus->number,
PCI_SLOT(pdev->devfn) + 1);
/* 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));
wc->span.irq = pdev->irq;
if (wc->spantype == TYPE_E1) {
if (type == E1) {
wc->span.channels = 31;
wc->span.spantype = "E1";
wc->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_HDB3 |
@@ -1817,24 +1854,89 @@ static int t1_software_init(struct t1 *wc)
DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF;
wc->span.deflaw = DAHDI_LAW_MULAW;
}
wc->span.chans = wc->chans;
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);
set_bit(DAHDI_FLAGBIT_RBS, &wc->span.flags);
for (x = 0; x < wc->span.channels; x++) {
sprintf(wc->chans[x]->name, "WCT1/%d/%d", num, x + 1);
sprintf(wc->chans[x]->name, "%s/%d", wc->span.name, 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);
wc->span.ops = &t1_span_ops;
if (dahdi_register(&wc->span, 0)) {
t1_info(wc, "Unable to register span with DAHDI\n");
return -1;
}
set_span_devicetype(wc);
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
@@ -1853,39 +1955,53 @@ 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)
static int t1_hardware_post_init(struct t1 *wc, enum linemode *type)
{
int res;
unsigned int reg;
int reg;
int x;
/* T1 or E1 */
if (t1e1override > -1) {
if (t1e1override)
wc->spantype = TYPE_E1;
else
wc->spantype = TYPE_T1;
if (-1 != t1e1override) {
pr_info("t1e1override is deprecated. Please use 'default_linemode'.\n");
*type = (t1e1override) ? E1 : T1;
} else {
u8 pins;
res = t1_getpins(wc, &pins);
if (res)
return res;
wc->spantype = (pins & 0x01) ? TYPE_T1 : TYPE_E1;
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;
}
}
debug_printk(wc, 1, "spantype: %s\n", 1 == wc->spantype ? "T1" : "E1");
debug_printk(wc, 1, "linemode: %s\n", (*type == T1) ? "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 != x)
t1_info(wc, "Wrote '%x' but read '%x'\n", x, reg);
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;
}
}
t1_setleds(wc, wc->ledstate);
@@ -1913,7 +2029,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 (wc->spantype == TYPE_E1) {
if (dahdi_is_e1_span(&wc->span)) {
if (c & 0x04) {
/* No multiframe found, force RAI high after 400ms only if
we haven't found a multiframe since last loss
@@ -2239,7 +2355,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->span.irqmisses++;
wc->ddev->irqmisses++;
_resend_cmds(wc);
if (unlikely(debug)) {
t1_info(wc, "oops: rxident=%d "
@@ -2522,14 +2638,31 @@ 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;
struct t1_desc *d = (struct t1_desc *) ent->driver_data;
const 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]) {
@@ -2548,18 +2681,22 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
if (!wc)
return -ENOMEM;
wc->not_ready = 1;
/* Set the performance counters to -1 since this card currently does
* not support collecting them. */
memset(&wc->span.count, -1, sizeof(wc->span.count));
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;
@@ -2580,6 +2717,22 @@ 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
@@ -2611,6 +2764,7 @@ 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;
}
@@ -2624,36 +2778,33 @@ 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);
res = t1_hardware_post_init(wc, &type);
if (res) {
voicebus_release(&wc->vb);
free_wc(wc);
ifaces[index] = NULL;
return res;
}
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;
}
wc->span.chans = wc->chans;
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);
res = t1_software_init(wc, type);
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;
}
@@ -2663,10 +2814,7 @@ 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);
/* 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--;
wc->not_ready--;
return 0;
}
@@ -2681,7 +2829,7 @@ static void __devexit te12xp_remove_one(struct pci_dev *pdev)
if (!wc)
return;
dahdi_unregister(&wc->span);
dahdi_unregister_device(wc->ddev);
remove_sysfs_files(wc);
@@ -2772,6 +2920,16 @@ 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);
@@ -2790,6 +2948,9 @@ 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,8 +74,10 @@
#define CMD_BYTE(slot, a, is_vpm) (slot*6)+(a*2)+is_vpm /* only even slots */
//TODO: make a separate macro
#define TYPE_T1 1
#define TYPE_E1 2
enum linemode {
T1 = 1,
E1,
};
struct command {
struct list_head node;
@@ -94,7 +96,6 @@ 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;
@@ -116,6 +117,7 @@ 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

@@ -35,6 +35,10 @@
static const char rcsid[] = "$Id$";
#ifndef DAHDI_SIG_HARDHDLC
#error Cannot build BRI without HARDHDLC supprt
#endif
static DEF_PARM(int, debug, 0, 0644, "Print DBG statements"); /* must be before dahdi_debug.h */
static DEF_PARM(uint, poll_interval, 500, 0644, "Poll channel state interval in milliseconds (0 - disable)");
static DEF_PARM_BOOL(nt_keepalive, 1, 0644, "Force BRI_NT to keep trying connection");
@@ -129,22 +133,7 @@ typedef union {
#define REG30_LOST 3 /* in polls */
#define DCHAN_LOST 15000 /* in ticks */
#ifdef CONFIG_DAHDI_BRI_DCHANS
#define BRI_DCHAN_SIGCAP ( \
DAHDI_SIG_EM | \
DAHDI_SIG_CLEAR | \
DAHDI_SIG_FXSLS | \
DAHDI_SIG_FXSGS | \
DAHDI_SIG_FXSKS | \
DAHDI_SIG_FXOLS | \
DAHDI_SIG_FXOGS | \
DAHDI_SIG_FXOKS | \
DAHDI_SIG_CAS | \
DAHDI_SIG_SF \
)
#else
#define BRI_DCHAN_SIGCAP DAHDI_SIG_HARDHDLC
#endif
#define BRI_BCHAN_SIGCAP (DAHDI_SIG_CLEAR | DAHDI_SIG_DACS)
#define IS_NT(xpd) (PHONEDEV(xpd).direction == TO_PHONE)
@@ -218,13 +207,7 @@ struct BRI_priv_data {
/*
* D-Chan: buffers + extra state info.
*/
#ifdef CONFIG_DAHDI_BRI_DCHANS
int dchan_r_idx;
byte dchan_rbuf[DCHAN_BUFSIZE];
#else
atomic_t hdlc_pending;
#endif
byte dchan_tbuf[DCHAN_BUFSIZE];
bool txframe_begin;
uint tick_counter;
@@ -438,22 +421,6 @@ static void nt_activation(xpd_t *xpd, bool on)
/*
* D-Chan receive
*/
static void bri_hdlc_abort(xpd_t *xpd, struct dahdi_chan *dchan, int event)
{
struct BRI_priv_data *priv;
priv = xpd->priv;
BUG_ON(!priv);
#ifdef CONFIG_DAHDI_BRI_DCHANS
if(debug & DBG_COMMANDS)
dump_hex_buf(xpd, "D-Chan(abort) RX: dchan_rbuf",
priv->dchan_rbuf, priv->dchan_r_idx);
priv->dchan_r_idx = 0;
#else
dahdi_hdlc_abort(dchan, event);
#endif
}
static int bri_check_stat(xpd_t *xpd, struct dahdi_chan *dchan, byte *buf, int len)
{
struct BRI_priv_data *priv;
@@ -461,21 +428,11 @@ static int bri_check_stat(xpd_t *xpd, struct dahdi_chan *dchan, byte *buf, int l
priv = xpd->priv;
BUG_ON(!priv);
#ifdef CONFIG_DAHDI_BRI_DCHANS
if(priv->dchan_r_idx < 4) {
XPD_NOTICE(xpd, "D-Chan RX short frame (dchan_r_idx=%d)\n",
priv->dchan_r_idx);
dump_hex_buf(xpd, "D-Chan RX: current packet", buf, len);
bri_hdlc_abort(xpd, dchan, DAHDI_EVENT_ABORT);
return -EPROTO;
}
#else
if(len <= 0) {
XPD_NOTICE(xpd, "D-Chan RX DROP: short frame (len=%d)\n", len);
bri_hdlc_abort(xpd, dchan, DAHDI_EVENT_ABORT);
dahdi_hdlc_abort(dchan, DAHDI_EVENT_ABORT);
return -EPROTO;
}
#endif
status = buf[len-1];
if(status) {
int event = DAHDI_EVENT_ABORT;
@@ -487,132 +444,12 @@ static int bri_check_stat(xpd_t *xpd, struct dahdi_chan *dchan, byte *buf, int l
event = DAHDI_EVENT_BADFCS;
}
dump_hex_buf(xpd, "D-Chan RX: current packet", buf, len);
bri_hdlc_abort(xpd, dchan, event);
dahdi_hdlc_abort(dchan, event);
return -EPROTO;
}
return 0;
}
static int bri_hdlc_putbuf(xpd_t *xpd, struct dahdi_chan *dchan,
unsigned char *buf, int len)
{
#ifdef CONFIG_DAHDI_BRI_DCHANS
struct BRI_priv_data *priv;
byte *dchan_buf;
byte *dst;
int idx;
priv = xpd->priv;
BUG_ON(!priv);
dchan_buf = dchan->readchunk;
idx = priv->dchan_r_idx;
if(idx + len >= DCHAN_BUFSIZE) {
XPD_ERR(xpd, "D-Chan RX overflow: %d\n", idx);
dump_hex_buf(xpd, " current packet", buf, len);
dump_hex_buf(xpd, " dchan_buf", dchan_buf, idx);
return -ENOSPC;
}
dst = dchan_buf + idx;
idx += len;
priv->dchan_r_idx = idx;
memcpy(dst, buf, len);
#else
dahdi_hdlc_putbuf(dchan, buf, len);
#endif
return 0;
}
static void bri_hdlc_finish(xpd_t *xpd, struct dahdi_chan *dchan)
{
struct BRI_priv_data *priv;
priv = xpd->priv;
BUG_ON(!priv);
#ifdef CONFIG_DAHDI_BRI_DCHANS
dchan->bytes2receive = priv->dchan_r_idx - 1;
dchan->eofrx = 1;
#else
dahdi_hdlc_finish(dchan);
#endif
}
#ifdef CONFIG_DAHDI_BRI_DCHANS
static int rx_dchan(xpd_t *xpd, reg_cmd_t *regcmd)
{
struct BRI_priv_data *priv;
byte *src;
byte *dst;
byte *dchan_buf;
struct dahdi_chan *dchan;
uint len;
bool eoframe;
int idx;
int ret = 0;
src = REG_XDATA(regcmd);
len = regcmd->bytes;
eoframe = regcmd->eoframe;
if(len <= 0)
return 0;
if(!SPAN_REGISTERED(xpd)) /* Nowhere to copy data */
return 0;
BUG_ON(!xpd);
priv = xpd->priv;
BUG_ON(!priv);
xbus = xpd->xbus;
dchan = XPD_CHAN(xpd, 2);
if(!IS_OFFHOOK(xpd, 2)) { /* D-chan is used? */
static int rate_limit;
if((rate_limit++ % 1000) == 0)
XPD_DBG(SIGNAL, xpd, "D-Chan unused\n");
dchan->bytes2receive = 0;
dchan->bytes2transmit = 0;
goto out;
}
dchan_buf = dchan->readchunk;
idx = priv->dchan_r_idx;
if(idx + len >= DCHAN_BUFSIZE) {
XPD_ERR(xpd, "D-Chan RX overflow: %d\n", idx);
dump_hex_buf(xpd, " current packet", src, len);
dump_hex_buf(xpd, " dchan_buf", dchan_buf, idx);
ret = -ENOSPC;
if(eoframe)
goto drop;
goto out;
}
dst = dchan_buf + idx;
idx += len;
priv->dchan_r_idx = idx;
memcpy(dst, src, len);
if(!eoframe)
goto out;
if(idx < 4) {
XPD_NOTICE(xpd, "D-Chan RX short frame (idx=%d)\n", idx);
dump_hex_buf(xpd, "D-Chan RX: current packet", src, len);
dump_hex_buf(xpd, "D-Chan RX: chan_buf", dchan_buf, idx);
ret = -EPROTO;
goto drop;
}
if((ret = bri_check_stat(xpd, dchan, dchan_buf, idx)) < 0)
goto drop;
if(debug)
dump_dchan_packet(xpd, 0, dchan_buf, idx /* - 3 */); /* Print checksum? */
/*
* Tell Dahdi that we received idx-1 bytes. They include the data and a 2-byte checksum.
* The last byte (that we don't pass on) is 0 if the checksum is correct. If it were wrong,
* we would drop the packet in the "if(dchan_buf[idx-1])" above.
*/
dchan->bytes2receive = idx - 1;
dchan->eofrx = 1;
priv->dchan_rx_counter++;
priv->dchan_norx_ticks = 0;
drop:
priv->dchan_r_idx = 0;
out:
return ret;
}
#else
static int rx_dchan(xpd_t *xpd, reg_cmd_t *regcmd)
{
struct BRI_priv_data *priv;
@@ -638,16 +475,10 @@ static int rx_dchan(xpd_t *xpd, reg_cmd_t *regcmd)
if((rate_limit++ % 1000) == 0)
XPD_DBG(SIGNAL, xpd, "D-Chan unused\n");
#ifdef CONFIG_DAHDI_BRI_DCHANS
dchan->bytes2receive = 0;
dchan->bytes2transmit = 0;
#endif
goto out;
}
XPD_DBG(GENERAL, xpd, "D-Chan RX: eoframe=%d len=%d\n", eoframe, len);
ret = bri_hdlc_putbuf(xpd, dchan, src, (eoframe) ? len - 1 : len);
if(ret < 0)
goto out;
dahdi_hdlc_putbuf(dchan, src, (eoframe) ? len - 1 : len);
if(!eoframe)
goto out;
if((ret = bri_check_stat(xpd, dchan, src, len)) < 0)
@@ -657,18 +488,16 @@ static int rx_dchan(xpd_t *xpd, reg_cmd_t *regcmd)
* The last byte (that we don't pass on) is 0 if the checksum is correct. If it were wrong,
* we would drop the packet in the "if(src[len-1])" above.
*/
bri_hdlc_finish(xpd, dchan);
dahdi_hdlc_finish(dchan);
priv->dchan_rx_counter++;
priv->dchan_norx_ticks = 0;
out:
return ret;
}
#endif
/*
* D-Chan transmit
*/
#ifndef CONFIG_DAHDI_BRI_DCHANS
/* DAHDI calls this when it has data it wants to send to the HDLC controller */
static void bri_hdlc_hard_xmit(struct dahdi_chan *chan)
{
@@ -683,86 +512,129 @@ static void bri_hdlc_hard_xmit(struct dahdi_chan *chan)
atomic_inc(&priv->hdlc_pending);
}
}
#endif
static int bri_hdlc_getbuf(struct dahdi_chan *dchan, unsigned char *buf,
unsigned int *size)
static int send_dchan_frame(xpd_t *xpd, xframe_t *xframe, bool is_eof)
{
int len = *size;
int eoframe;
#ifdef CONFIG_DAHDI_BRI_DCHANS
len = dchan->bytes2transmit; /* dchan's hdlc package len */
if(len > *size)
len = *size; /* Silent truncation */
eoframe = dchan->eoftx; /* dchan's end of frame */
dchan->bytes2transmit = 0;
dchan->eoftx = 0;
dchan->bytes2receive = 0;
dchan->eofrx = 0;
#else
eoframe = dahdi_hdlc_getbuf(dchan, buf, &len);
#endif
*size = len;
return eoframe;
}
static int tx_dchan(xpd_t *xpd)
{
struct BRI_priv_data *priv;
struct dahdi_chan *dchan;
int len;
int eoframe;
int ret;
struct BRI_priv_data *priv;
int ret;
XPD_DBG(COMMANDS, xpd, "eoframe=%d\n", is_eof);
priv = xpd->priv;
BUG_ON(!priv);
#ifndef CONFIG_DAHDI_BRI_DCHANS
if(atomic_read(&priv->hdlc_pending) == 0)
return 0;
#endif
if(!SPAN_REGISTERED(xpd) || !(PHONEDEV(xpd).span.flags & DAHDI_FLAG_RUNNING))
return 0;
dchan = XPD_CHAN(xpd, 2);
len = ARRAY_SIZE(priv->dchan_tbuf);
if(len > MULTIBYTE_MAX_LEN)
len = MULTIBYTE_MAX_LEN;
eoframe = bri_hdlc_getbuf(dchan, priv->dchan_tbuf, &len);
if(len <= 0)
return 0; /* Nothing to transmit on D channel */
if(len > MULTIBYTE_MAX_LEN) {
XPD_ERR(xpd, "%s: len=%d. need to split. Unimplemented.\n", __FUNCTION__, len);
dump_hex_buf(xpd, "D-Chan TX:", priv->dchan_tbuf, len);
return -EINVAL;
}
if(!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags) && !test_bit(HFC_L1_ACTIVATING, &priv->l1_flags)) {
if (!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags)
&& !test_bit(HFC_L1_ACTIVATING, &priv->l1_flags)) {
XPD_DBG(SIGNAL, xpd, "Want to transmit: Kick D-Channel transmiter\n");
if(! IS_NT(xpd))
if (!IS_NT(xpd))
te_activation(xpd, 1);
else
nt_activation(xpd, 1);
}
if(debug)
dump_dchan_packet(xpd, 1, priv->dchan_tbuf, len);
if(eoframe)
priv->txframe_begin = 1;
else
priv->txframe_begin = 0;
XPD_DBG(COMMANDS, xpd, "eoframe=%d len=%d\n", eoframe, len);
ret = send_multibyte_request(xpd->xbus, xpd->addr.unit, xpd->addr.subunit,
eoframe, priv->dchan_tbuf, len);
if(ret < 0)
XPD_NOTICE(xpd, "%s: failed sending xframe\n", __FUNCTION__);
if(eoframe) {
#ifndef CONFIG_DAHDI_BRI_DCHANS
dump_xframe("send_dchan_frame", xpd->xbus, xframe, debug);
ret = send_cmd_frame(xpd->xbus, xframe);
if (ret < 0)
XPD_ERR(xpd, "%s: failed sending xframe\n", __func__);
if (is_eof) {
atomic_dec(&priv->hdlc_pending);
#endif
priv->dchan_tx_counter++;
}
priv->txframe_begin = 1;
} else
priv->txframe_begin = 0;
priv->dchan_notx_ticks = 0;
return ret;
}
/*
* Fill a single multibyte REGISTER_REQUEST
*/
static void fill_multibyte(xpd_t *xpd, xpacket_t *pack, bool eoframe,
char *buf, int len)
{
reg_cmd_t *reg_cmd;
char *p;
XPACKET_INIT(pack, GLOBAL, REGISTER_REQUEST, xpd->xbus_idx, 0, 0);
XPACKET_LEN(pack) = RPACKET_SIZE(GLOBAL, REGISTER_REQUEST);
reg_cmd = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REQUEST, reg_cmd);
reg_cmd->bytes = len;
reg_cmd->is_multibyte = 1;
reg_cmd->portnum = xpd->addr.subunit;
reg_cmd->eoframe = eoframe;
p = REG_XDATA(reg_cmd);
memcpy(p, buf, len);
if (debug)
dump_dchan_packet(xpd, 1, p, len);
}
/*
* Transmit available D-Channel frames
*
* - FPGA firmware expect to get this as a sequence of REGISTER_REQUEST
* multibyte commands.
* - The payload of each command is limited to MULTIBYTE_MAX_LEN bytes.
* - We batch several REGISTER_REQUEST packets into a single xframe.
* - The xframe is terminated when we get a bri "end of frame"
* or when the xframe is full (should not happen).
*/
static int tx_dchan(xpd_t *xpd)
{
struct BRI_priv_data *priv;
xframe_t *xframe;
xpacket_t *pack;
int packet_count;
int eoframe;
int ret;
priv = xpd->priv;
BUG_ON(!priv);
if (atomic_read(&priv->hdlc_pending) == 0)
return 0;
if (!SPAN_REGISTERED(xpd) ||
!(PHONEDEV(xpd).span.flags & DAHDI_FLAG_RUNNING))
return 0;
/* Allocate frame */
xframe = ALLOC_SEND_XFRAME(xpd->xbus);
if (!xframe) {
XPD_NOTICE(xpd, "%s: failed to allocate new xframe\n",
__func__);
return -ENOMEM;
}
for (packet_count = 0, eoframe = 0; !eoframe; packet_count++) {
int packet_len = RPACKET_SIZE(GLOBAL, REGISTER_REQUEST);
char buf[MULTIBYTE_MAX_LEN];
int len = MULTIBYTE_MAX_LEN;
/* Reserve packet */
pack = xframe_next_packet(xframe, packet_len);
if (!pack) {
BUG_ON(!packet_count);
/*
* A split. Send what we currently have.
*/
XPD_NOTICE(xpd,
"%s: xframe is full (%d packets)\n",
__func__, packet_count);
break;
}
/* Get data from DAHDI */
eoframe = dahdi_hdlc_getbuf(XPD_CHAN(xpd, 2), buf, &len);
if (len <= 0) {
/*
* Already checked priv->hdlc_pending,
* should never get here.
*/
if (printk_ratelimit())
XPD_ERR(xpd,
"%s: hdlc_pending, but nothing to transmit?\n",
__func__);
FREE_SEND_XFRAME(xpd->xbus, xframe);
return -EINVAL;
}
BUG_ON(len > MULTIBYTE_MAX_LEN);
fill_multibyte(xpd, pack, eoframe != 0, buf, len);
}
return send_dchan_frame(xpd, xframe, eoframe != 0);
return ret;
}
/*---------------- BRI: Methods -------------------------------------------*/
static void bri_proc_remove(xbus_t *xbus, xpd_t *xpd)
@@ -853,9 +725,7 @@ static const struct dahdi_span_ops BRI_span_ops = {
.chanconfig = bri_chanconfig,
.startup = bri_startup,
.shutdown = bri_shutdown,
#ifndef CONFIG_DAHDI_BRI_DCHANS
.hdlc_hard_xmit = bri_hdlc_hard_xmit,
#endif
.open = xpp_open,
.close = xpp_close,
.hooksig = xpp_hooksig, /* Only with RBS bits */
@@ -863,6 +733,7 @@ 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
@@ -903,19 +774,7 @@ static int BRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
cur_chan->sigcap = BRI_DCHAN_SIGCAP;
clear_bit(DAHDI_FLAGBIT_HDLC, &cur_chan->flags);
priv->txframe_begin = 1;
#ifdef CONFIG_DAHDI_BRI_DCHANS
priv->dchan_r_idx = 0;
set_bit(DAHDI_FLAGBIT_BRIDCHAN, &cur_chan->flags);
/* Setup big buffers for D-Channel rx/tx */
cur_chan->readchunk = priv->dchan_rbuf;
cur_chan->writechunk = priv->dchan_tbuf;
cur_chan->maxbytes2transmit = MULTIBYTE_MAX_LEN;
cur_chan->bytes2transmit = 0;
cur_chan->bytes2receive = 0;
#else
atomic_set(&priv->hdlc_pending, 0);
#endif
} else {
cur_chan->sigcap = BRI_BCHAN_SIGCAP;
}
@@ -1145,15 +1004,6 @@ static int BRI_card_open(xpd_t *xpd, lineno_t pos)
static int BRI_card_close(xpd_t *xpd, lineno_t pos)
{
/* Clear D-Channel pending data */
#ifdef CONFIG_DAHDI_BRI_DCHANS
struct dahdi_chan *chan = XPD_CHAN(xpd, pos);
/* Clear D-Channel pending data */
chan->bytes2receive = 0;
chan->eofrx = 0;
chan->bytes2transmit = 0;
chan->eoftx = 0;
#endif
if(pos == 2) {
LINE_DBG(SIGNAL, xpd, pos, "ONHOOK the whole span\n");
BIT_CLR(PHONEDEV(xpd).offhook_state, 0);
@@ -1201,6 +1051,8 @@ static int bri_spanconfig(struct file *file, struct dahdi_span *span,
framingstr, codingstr, crcstr,
lc->lineconfig,
lc->sync);
PHONEDEV(xpd).timing_priority = lc->sync;
elect_syncer("BRI-spanconfig");
/*
* FIXME: validate
*/
@@ -1252,9 +1104,6 @@ static int bri_startup(struct file *file, struct dahdi_span *span)
*
* Don't Get Mad, Get Even: Now we override dahdi :-)
*/
#ifdef CONFIG_DAHDI_BRI_DCHANS
set_bit(DAHDI_FLAGBIT_BRIDCHAN, &dchan->flags);
#endif
clear_bit(DAHDI_FLAGBIT_HDLC, &dchan->flags);
}
return 0;
@@ -1428,6 +1277,18 @@ static void BRI_card_pcm_tospan(xpd_t *xpd, xpacket_t *pack)
}
}
static int BRI_timing_priority(xpd_t *xpd)
{
struct BRI_priv_data *priv;
priv = xpd->priv;
BUG_ON(!priv);
if (priv->layer1_up)
return PHONEDEV(xpd).timing_priority;
XPD_DBG(SYNC, xpd, "No timing priority (no layer1)\n");
return -ENOENT;
}
int BRI_echocancel_timeslot(xpd_t *xpd, int pos)
{
return xpd->addr.subunit * 4 + pos;
@@ -1695,7 +1556,7 @@ static const struct phoneops bri_phoneops = {
.card_pcm_recompute = BRI_card_pcm_recompute,
.card_pcm_fromspan = BRI_card_pcm_fromspan,
.card_pcm_tospan = BRI_card_pcm_tospan,
.card_timing_priority = generic_timing_priority,
.card_timing_priority = BRI_timing_priority,
.echocancel_timeslot = BRI_echocancel_timeslot,
.echocancel_setmask = BRI_echocancel_setmask,
.card_ioctl = BRI_card_ioctl,
@@ -1775,9 +1636,6 @@ static int proc_bri_info_read(char *page, char **start, off_t off, int count, in
} else {
len += sprintf(page + len, "(dead)\n");
}
#ifndef CONFIG_DAHDI_BRI_DCHANS
len += sprintf(page + len, "hdlc_pending=%d\n", atomic_read(&priv->hdlc_pending));
#endif
len += sprintf(page + len, "dchan_notx_ticks: %d\n", priv->dchan_notx_ticks);
len += sprintf(page + len, "dchan_norx_ticks: %d\n", priv->dchan_norx_ticks);
len += sprintf(page + len, "LED: %-10s = %d\n", "GREEN", priv->ledstate[GREEN_LED]);
@@ -1797,22 +1655,6 @@ static int proc_bri_info_read(char *page, char **start, off_t off, int count, in
}
#endif
static DRIVER_ATTR_READER(dchan_hardhdlc_show, drv,buf)
{
int len = 0;
#if defined(CONFIG_DAHDI_BRI_DCHANS)
len += sprintf(buf + len, "0\n");
#elif defined(DAHDI_SIG_HARDHDLC)
len += sprintf(buf + len, "1\n");
#else
#error Cannot build BRI without BRISTUFF or HARDHDLC supprt
#endif
return len;
}
static DRIVER_ATTR(dchan_hardhdlc,S_IRUGO,dchan_hardhdlc_show,NULL);
static int bri_xpd_probe(struct device *dev)
{
xpd_t *xpd;
@@ -1855,18 +1697,7 @@ static int __init card_bri_startup(void)
if((ret = xpd_driver_register(&bri_driver.driver)) < 0)
return ret;
ret = driver_create_file(&bri_driver.driver, &driver_attr_dchan_hardhdlc);
if(ret < 0)
return ret;
INFO("revision %s\n", XPP_VERSION);
#if defined(CONFIG_DAHDI_BRI_DCHANS)
INFO("FEATURE: WITH BRISTUFF\n");
#elif defined(DAHDI_SIG_HARDHDLC)
INFO("FEATURE: WITH HARDHDLC\n");
#else
#error Cannot build BRI without BRISTUFF or HARDHDLC supprt
#endif
xproto_register(&PROTO_TABLE(BRI));
return 0;
}
@@ -1875,7 +1706,6 @@ static void __exit card_bri_cleanup(void)
{
DBG(GENERAL, "\n");
xproto_unregister(&PROTO_TABLE(BRI));
driver_remove_file(&bri_driver.driver, &driver_attr_dchan_hardhdlc);
xpd_driver_unregister(&bri_driver.driver);
}

View File

@@ -28,7 +28,6 @@ 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

@@ -134,6 +134,7 @@ struct FXS_priv_data {
xpp_line_t want_dtmf_events; /* what dahdi want */
xpp_line_t want_dtmf_mute; /* what dahdi want */
xpp_line_t prev_key_down; /* DTMF down sets the bit */
xpp_line_t neon_blinking;
struct timeval prev_key_time[CHANNELS_PERXPD];
int led_counter[NUM_LEDS][CHANNELS_PERXPD];
int ohttimer[CHANNELS_PERXPD];
@@ -386,6 +387,8 @@ 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,
@@ -398,16 +401,30 @@ 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;
if(unit == 0)
/* Calculate digital inputs/outputs */
if(unit == 0 && subtype != 4) {
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;
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);
}
/* 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");
PHONEDEV(xpd).direction = TO_PHONE;
xpd->type_name = "FXS";
if(fxs_proc_create(xbus, xpd) < 0)
@@ -548,12 +565,16 @@ static int FXS_card_dahdi_postregistration(xpd_t *xpd, bool on)
*/
static void __do_mute_dtmf(xpd_t *xpd, int pos, bool muteit)
{
struct FXS_priv_data *priv;
priv = xpd->priv;
LINE_DBG(SIGNAL, xpd, pos, "%s\n", (muteit) ? "MUTE" : "UNMUTE");
if(muteit)
BIT_SET(PHONEDEV(xpd).mute_dtmf, pos);
else
BIT_CLR(PHONEDEV(xpd).mute_dtmf, pos);
CALL_PHONE_METHOD(card_pcm_recompute, xpd, 0); /* already spinlocked */
/* already spinlocked */
CALL_PHONE_METHOD(card_pcm_recompute, xpd, priv->search_fsk_pattern);
}
static int set_vm_led_mode(xbus_t *xbus, xpd_t *xpd, int pos,
@@ -568,6 +589,7 @@ static int set_vm_led_mode(xbus_t *xbus, xpd_t *xpd, int pos,
if (VMWI_NEON(priv, pos) && msg_waiting) {
/* A write to register 0x40 will now turn on/off the VM led */
LINE_DBG(SIGNAL, xpd, pos, "NEON\n");
BIT_SET(priv->neon_blinking, pos);
ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x16, 0xE8, 0x03);
ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x15, 0xEF, 0x7B);
ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x14, 0x9F, 0x00);
@@ -602,6 +624,7 @@ static int set_vm_led_mode(xbus_t *xbus, xpd_t *xpd, int pos,
} else {
/* A write to register 0x40 will now turn on/off the ringer */
LINE_DBG(SIGNAL, xpd, pos, "RINGER\n");
BIT_CLR(priv->neon_blinking, pos);
ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x16, 0x00, 0x00);
ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x15, 0x77, 0x01);
@@ -861,7 +884,8 @@ static int FXS_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long a
if (IS_SET(PHONEDEV(xpd).digital_inputs | PHONEDEV(xpd).digital_outputs, pos))
return 0; /* Nothing to do */
oht_pcm(xpd, pos, 1); /* Get ready of VMWI FSK tones */
if(priv->lasttxhook[pos] == FXS_LINE_POL_ACTIVE) {
if (priv->lasttxhook[pos] == FXS_LINE_POL_ACTIVE ||
IS_SET(priv->neon_blinking, pos)) {
priv->ohttimer[pos] = val;
priv->idletxhookstate[pos] = FXS_LINE_POL_OHTRANS;
vmwi_search(xpd, pos, 1);
@@ -924,10 +948,25 @@ static int FXS_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long a
case DAHDI_SETPOLARITY:
if (get_user(val, (int __user *)arg))
return -EFAULT;
/* Can't change polarity while ringing or when open */
/*
* Asterisk may send us this if chan_dahdi config
* has "hanguponpolarityswitch=yes" to notify
* that the other side has hanged up.
*
* This has no effect on normal phone (but we may
* be connected to another FXO equipment).
* note that this chan_dahdi settings has different
* meaning for FXO, where it signals polarity
* reversal *detection* logic.
*
* It seems that sometimes we get this from
* asterisk in wrong state (e.g: while ringing).
* In these cases, silently ignore it.
*/
if (priv->lasttxhook[pos] == FXS_LINE_RING || priv->lasttxhook[pos] == FXS_LINE_OPEN) {
LINE_ERR(xpd, pos, "DAHDI_SETPOLARITY: %s Cannot change when lasttxhook=0x%X\n",
(val)?"ON":"OFF", priv->lasttxhook[pos]);
LINE_DBG(SIGNAL, xpd, pos,
"DAHDI_SETPOLARITY: %s Cannot change when lasttxhook=0x%X\n",
(val)?"ON":"OFF", priv->lasttxhook[pos]);
return -EINVAL;
}
LINE_DBG(SIGNAL, xpd, pos, "DAHDI_SETPOLARITY: %s\n", (val)?"ON":"OFF");
@@ -1029,7 +1068,8 @@ static void handle_linefeed(xpd_t *xpd)
priv = xpd->priv;
BUG_ON(!priv);
for_each_line(xpd, i) {
if (priv->lasttxhook[i] == FXS_LINE_RING) {
if (priv->lasttxhook[i] == FXS_LINE_RING &&
!IS_SET(priv->neon_blinking, i)) {
/* RINGing, prepare for OHT */
priv->ohttimer[i] = OHT_TIMER;
priv->idletxhookstate[i] = FXS_LINE_POL_OHTRANS;
@@ -1142,7 +1182,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 && xpd->xbus_idx == 0) {
if (poll_digital_inputs && PHONEDEV(xpd).digital_inputs) {
if((xpd->timer_count % poll_digital_inputs) == 0)
poll_inputs(xpd);
}
@@ -1254,6 +1294,13 @@ 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];
@@ -1277,7 +1324,8 @@ static void process_digital_inputs(xpd_t *xpd, const reg_cmd_t *info)
#endif
static const char dtmf_digits[] = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '*', '#', 'A', 'B', 'C', 'D'
'D', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '*', '#',
'A', 'B', 'C'
};
/*
@@ -1299,12 +1347,6 @@ 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);
@@ -1366,7 +1408,7 @@ static int FXS_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info)
/*
* Process digital inputs polling results
*/
else if(xpd->xbus_idx == 0 && !indirect && regnum == REG_DIGITAL_IOCTRL) {
else if (!indirect && regnum == REG_DIGITAL_IOCTRL) {
process_digital_inputs(xpd, info);
}
#endif
@@ -1481,11 +1523,13 @@ static int proc_fxs_info_read(char *page, char **start, off_t off, int count, in
spin_lock_irqsave(&xpd->lock, flags);
priv = xpd->priv;
BUG_ON(!priv);
len += sprintf(page + len, "%-8s %-10s %-10s %-10s\n",
len += sprintf(page + len, "%-8s %-10s %-10s %-10s %-10s %-10s\n",
"Channel",
"idletxhookstate",
"lasttxhook",
"ohttimer"
"ohttimer",
"neon_blinking",
"search_fsk_pattern"
);
for_each_line(xpd, i) {
char pref;
@@ -1496,12 +1540,14 @@ static int proc_fxs_info_read(char *page, char **start, off_t off, int count, in
pref = 'I';
else
pref = ' ';
len += sprintf(page + len, "%c%7d %10d %10d %10d\n",
len += sprintf(page + len, "%c%7d %10d %10d %10d %10d %10d\n",
pref,
i,
priv->idletxhookstate[i],
priv->lasttxhook[i],
priv->ohttimer[i]
priv->ohttimer[i],
IS_SET(priv->neon_blinking, i),
IS_SET(priv->search_fsk_pattern, i)
);
}
len += sprintf(page + len, "\n");

View File

@@ -27,7 +27,6 @@
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

@@ -40,6 +40,36 @@ extern int debug;
/*---------------- GLOBAL PROC handling -----------------------------------*/
static int send_magic_request(xbus_t *xbus,
unsigned unit, xportno_t portno, bool eoftx)
{
xframe_t *xframe;
xpacket_t *pack;
reg_cmd_t *reg_cmd;
int ret;
/*
* Zero length multibyte is legal and has special meaning for the
* firmware:
* eoftx==1: Start sending us D-channel packets.
* eoftx==0: Stop sending us D-channel packets.
*/
XFRAME_NEW_CMD(xframe, pack, xbus, GLOBAL, REGISTER_REQUEST, unit);
reg_cmd = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REQUEST, reg_cmd);
reg_cmd->bytes = 0;
reg_cmd->is_multibyte = 1;
reg_cmd->portnum = portno;
reg_cmd->eoframe = eoftx;
PORT_DBG(REGS, xbus, unit, portno, "Magic Packet (eoftx=%d)\n", eoftx);
if (debug & DBG_REGS)
dump_xframe(__func__, xbus, xframe, debug);
ret = send_cmd_frame(xbus, xframe);
if (ret < 0)
PORT_ERR(xbus, unit, portno,
"%s: failed sending xframe\n", __func__);
return ret;
}
static int parse_hexbyte(const char *buf)
{
char *endp;
@@ -155,8 +185,8 @@ static int execute_chip_command(xpd_t *xpd, const int argc, char *argv[])
addr_mode, argc - argno);
goto out;
}
ret = send_multibyte_request(xpd->xbus, xpd->addr.unit, portno,
addr_mode == 'm', NULL, 0);
ret = send_magic_request(xpd->xbus, xpd->addr.unit, portno,
addr_mode == 'm');
goto out;
}
/* Normal (non-Magic) register commands */
@@ -370,44 +400,6 @@ int xpp_register_request(xbus_t *xbus, xpd_t *xpd, xportno_t portno,
return ret;
}
int send_multibyte_request(xbus_t *xbus,
unsigned unit, xportno_t portno,
bool eoftx, byte *buf, unsigned len)
{
xframe_t *xframe;
xpacket_t *pack;
reg_cmd_t *reg_cmd;
int ret;
/*
* Zero length multibyte is legal and has special meaning for the
* firmware:
* eoftx==1: Start sending us D-channel packets.
* eoftx==0: Stop sending us D-channel packets.
*/
if(len > MULTIBYTE_MAX_LEN) {
PORT_ERR(xbus, unit, portno, "%s: len=%d is too long. dropping.\n", __FUNCTION__, len);
return -EINVAL;
}
XFRAME_NEW_CMD(xframe, pack, xbus, GLOBAL, REGISTER_REQUEST, unit);
reg_cmd = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REQUEST, reg_cmd);
reg_cmd->bytes = len;
reg_cmd->is_multibyte = 1;
reg_cmd->portnum = portno;
reg_cmd->eoframe = eoftx;
if(len > 0) {
memcpy(REG_XDATA(reg_cmd), (byte *)buf, len);
} else {
PORT_DBG(REGS, xbus, unit, portno, "Magic Packet (eoftx=%d)\n", eoftx);
}
if(debug & DBG_REGS)
dump_xframe(__FUNCTION__, xbus, xframe, debug);
ret = send_cmd_frame(xbus, xframe);
if(ret < 0)
PORT_ERR(xbus, unit, portno, "%s: failed sending xframe\n", __FUNCTION__);
return ret;
}
/*
* The XPD parameter is totaly ignored by the driver and firmware as well.
*/
@@ -642,7 +634,6 @@ 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)
@@ -651,6 +642,7 @@ 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,6 +660,7 @@ int run_initialize_registers(xpd_t *xpd)
char *envp[] = {
busstr,
busnumstr,
modelstr,
unitstr,
subunitsstr,
typestr,
@@ -703,6 +696,7 @@ 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);
@@ -750,4 +744,3 @@ err:
EXPORT_SYMBOL(sync_mode_name);
EXPORT_SYMBOL(run_initialize_registers);
EXPORT_SYMBOL(xpp_register_request);
EXPORT_SYMBOL(send_multibyte_request);

View File

@@ -80,6 +80,7 @@ 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"
@@ -90,17 +91,29 @@ 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[] = {
@@ -551,12 +564,14 @@ 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;
if(SPAN_REGISTERED(xpd)) {
XPD_NOTICE(xpd, "Registered as span %d. Cannot do setup pri protocol (%s)\n",
PHONEDEV(xpd).span.spanno, __FUNCTION__);
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);
return -EBUSY;
}
if(priv->pri_protocol != PRI_PROTO_0) {
@@ -596,8 +611,8 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
}
priv->pri_protocol = set_proto;
priv->is_cas = -1;
PHONEDEV(xpd).channels = pri_num_channels(set_proto);
PHONEDEV(xpd).offhook_state = BITMASK(PHONEDEV(xpd).channels);
phonedev->channels = pri_num_channels(set_proto);
phonedev->offhook_state = BITMASK(phonedev->channels);
CALL_PHONE_METHOD(card_pcm_recompute, xpd, 0);
priv->deflaw = deflaw;
priv->dchan_num = dchan_num;
@@ -605,7 +620,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(xpd).channels,
phonedev->channels,
priv->dchan_num,
priv->deflaw
);
@@ -618,7 +633,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 0;
return apply_pri_protocol(xpd);
}
static void dahdi_update_syncsrc(xpd_t *xpd)
@@ -1019,6 +1034,17 @@ static int pri_lineconfig(xpd_t *xpd, int lineconfig)
}
#endif
if(force_cas) {
if(priv->pri_protocol == PRI_PROTO_E1) {
int rs1 = 0x0B;
/*
* Set correct X1-X3 bits in the E1 CAS MFAS
* They are unused in E1 and should be 1
*/
XPD_DBG(GENERAL, xpd, "%s: rs1(0x%02X) = 0x%02X\n",
__FUNCTION__, REG_RS1_E, rs1);
write_subunit(xpd, REG_RS1_E, rs1);
}
xsp |= REG_XSP_E_CASEN; /* Same as REG_FMR5_T_EIBR for T1 */
}
XPD_DBG(GENERAL, xpd, "%s: xsp(0x%02X) = 0x%02X\n", __FUNCTION__, REG_XSP_E, xsp);
@@ -1029,6 +1055,17 @@ 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
*/
@@ -1204,6 +1241,7 @@ 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,
@@ -1215,6 +1253,7 @@ 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
@@ -1227,7 +1266,7 @@ static const struct dahdi_span_ops PRI_span_ops = {
#endif
};
static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
static int apply_pri_protocol(xpd_t *xpd)
{
xbus_t *xbus;
struct PRI_priv_data *priv;
@@ -1237,15 +1276,7 @@ static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
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;
}
XPD_DBG(GENERAL, xpd, "\n");
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;
@@ -1268,9 +1299,32 @@ static int PRI_card_dahdi_preregistration(xpd_t *xpd, bool on)
}
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;
@@ -1424,14 +1478,17 @@ static int PRI_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long a
return -ENODEV;
chan = XPD_CHAN(xpd, pos);
switch (cmd) {
/*
* Asterisk may send FXS type ioctl()'s to us:
* - Some are sent to everybody (DAHDI_TONEDETECT)
* - Some are sent because we may be in CAS mode
* (FXS signalling)
* Ignore them.
*/
case DAHDI_TONEDETECT:
/*
* Asterisk call all span types with this (FXS specific)
* call. Silently ignore it.
*/
LINE_DBG(SIGNAL, xpd, pos, "PRI: TONEDETECT (%s)\n",
(chan->flags & DAHDI_FLAG_AUDIO) ?
"AUDIO" : "SILENCE");
"AUDIO" : "SILENCE");
return -ENOTTY;
case DAHDI_ONHOOKTRANSFER:
LINE_DBG(SIGNAL, xpd, pos, "PRI: ONHOOKTRANSFER\n");
@@ -1442,6 +1499,10 @@ static int PRI_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long a
case DAHDI_VMWI_CONFIG:
LINE_DBG(SIGNAL, xpd, pos, "PRI: VMWI_CONFIG\n");
return -ENOTTY;
case DAHDI_SETPOLARITY:
LINE_DBG(SIGNAL, xpd, pos, "PRI: SETPOLARITY\n");
return -ENOTTY;
/* report on really bad ioctl()'s */
default:
report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd);
return -ENOTTY;
@@ -2210,19 +2271,20 @@ static DEVICE_ATTR_WRITER(pri_protocol_store, dev, buf, count)
BUG_ON(!dev);
xpd = dev_to_xpd(dev);
XPD_DBG(GENERAL, xpd, "%s\n", buf);
if(!xpd)
if (!xpd)
return -ENODEV;
if((i = strcspn(buf, " \r\n")) != 2) {
i = strcspn(buf, " \r\n");
if (i != 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)
if (strnicmp(buf, "E1", 2) == 0)
new_protocol = PRI_PROTO_E1;
else if(strnicmp(buf, "T1", 2) == 0)
else if (strnicmp(buf, "T1", 2) == 0)
new_protocol = PRI_PROTO_T1;
else if(strnicmp(buf, "J1", 2) == 0)
else if (strnicmp(buf, "J1", 2) == 0)
new_protocol = PRI_PROTO_J1;
else {
XPD_NOTICE(xpd,
@@ -2234,7 +2296,8 @@ static DEVICE_ATTR_WRITER(pri_protocol_store, dev, buf, count)
return (ret < 0) ? ret : count;
}
static DEVICE_ATTR(pri_protocol, S_IRUGO | S_IWUSR, pri_protocol_show, pri_protocol_store);
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 7498 2009-11-17 11:38:56Z dima $
# $Id: PIC_TYPE_1.hex 9841 2011-09-08 17:00:23Z dima $
#
:03000000A1EA4A28
:03000100C41C41DB
@@ -31,8 +31,8 @@
:03001B00D00D0005
:03001C00A17A17AF
:03001D0080080058
:03001E00C0710BA3
:03001F0016603830
:03001E00C0010B13
:03001F0019A038ED
:03002000743C0627
:03002100A26D804D
:03002200C01024E7
@@ -42,370 +42,370 @@
:03002600C03030B7
:0300270018C901F4
:030028006432043B
:03002900A4C03040
:03002900A4A03060
:03002A0020C901E9
:03002B007432022A
:03002C00AFA03052
:03002D0020990116
:03002E00021C8031
:03002F00C40FFFFC
:03003000D8016490
:03003100024C106E
:03003200C00FFFFD
:0300330002215057
:03003400201D0884
:030035000306B906
:03003600901D100A
:0300370020402244
:03003800030201BF
:03003900901030F4
:03003A0020290179
:03003B00030204B9
:03003C00901030F1
:03003D00C11901E5
:03003E00190202A2
:03003F00643030FA
:03004000A45901BF
:03004100C22800D2
:030042001902148C
:03004300743E7098
:03004400A483088A
:03004500209308FD
:030046001253084A
:03004700A4B30857
:03004800209027DE
:03004900FFF800BD
:03004A00165C0041
:03004B00AFA0392A
:03004C00209038C9
:03004D00145C0739
:03004E00643D40CE
:03004F00A8C03412
:03005000209C08E9
:0300510002103862
:03005200C40219CC
:03005300D80E07BD
:0300540002402047
:03005500C0036085
:0300560002236022
:0300570020136013
:030058000303603F
:03005900901C10E8
:03005A002040380B
:03005B0003021984
:03005C00901E07EC
:03005D002021203F
:03005E00030C1080
:03005F009011807D
:03006000C11E704E
:0300610019074339
:03006200643A6D90
:03006300A68C0266
:03006400C2218036
:03006500190E036E
:03006600743643AA
:03006700A8CA70B4
:03006800209C03D6
:0300690002118001
:03006A00C44E037E
:03006B00D8064371
:03006C00024A70D5
:03006D00C00C01C3
:03006E0002203835
:03006F00201A6FE5
:03007000030C1866
:03007100901038B4
:0300720020421910
:03007300030E0F6A
:0300740090103DAC
:03007500202C003C
:030076000300384C
: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
:03016F00000AACD7
:03017000000C027E
:0301710000002F5C
:03017200000C0A74
:0301730000002A5F
:03002C00AE803073
:03002D00C4090102
:03002E00D80C806B
:03002F00024FFF7E
:03003000C00164A8
:03003100022C108E
:03003200209FFF0D
:0300330003015076
:03003400901D0814
:030035002046B9A9
:03003600030D10A7
:0300370090102204
:0300380020220182
:0300390003003091
:03003A0090190119
:03003B00C11204EB
:03003C0019003078
:03003D0064390122
:03003E00A43202E7
:03003F00C22030AC
:030040001909019A
:0300410074380010
:03004200A46214A1
:03004300209E708C
:030044001253084C
:03004500A4930879
:03004600209308FC
:03004700FFF308BC
:0300480016502728
:03004900AE88007E
:03004A00209C00F7
:03004B0014503915
:03004C00643038E5
:03004D00A8603F69
:03004E00C40C07D8
:03004F00D80D4089
:0300500002403437
:03005100C00C08D8
:0300520002203851
:03005300209219DF
:03005400030E0791
:03005500901020E8
:03005600204360E4
:0300570003036040
:03005800901360A2
:0300590020236001
:03005A00030C1084
:03005B00901038CA
:03005C00C11219B5
:03005D00190E0772
:03005E00643120EA
:03005F00A64C109C
:03006000C221803A
:03006100190E7005
:03006200743743AD
:03006300A86A7315
:03006400C44C0287
:03006500D801803F
:03006600024E0740
:03006700C006438D
:03006800022A76F3
:03006900209C03D5
:03006A000301800F
:03006B00901E07DD
:03006C00204643E8
:03006D00030A760D
:03006E00901C04DF
:03006F00202180CD
:03007000030E0775
:03007100901643A3
:03007200210A76EA
:03007300E03C016D
:03007400743038AD
:03007500C04A7509
:03007600190C184A
:030077007480385A
:03007800A8621962
:03007900C04E0F67
:03007A00FFF03D57
:03007B00150C0061
:03007C00643038B5
:03007D00A81C02BA
:03007E002091804E
:03007F0013EE0776
:03008000A847434B
:03008100209A863C
:03008200FFFC3F41
:0300830017E03152
:0300840021EC1656
:03008500035A9388
:03008600C14C0367
:03008700D801801D
:03008800024E071E
:03008900C007436A
:03008A00022A8FB8
:03008B00209CFFB7
:03008C000300313D
:03008D00901C18AC
:03008E00204A9372
:03008F00030C035C
:030090009010319C
:03009100202C120E
:03009200030A93CB
:0300930090103C8E
:03009400210E0F2B
:0300950002709D59
:03009600C147035C
:03009700024A9D7D
:03009800209C0F9A
:03009900030FFF53
:03009A0090115C66
:03009B0020411DE4
:03009C00030A9EB6
:03009D0090121CA2
:03009E002070309F
:03009F00030E0F3E
:0300A00090103C81
:0300A100C18C020D
:0300A200D800394A
:0300A300024C000C
:0300A400C0003960
:0300A500022C80AA
:0300A60020902483
:0300A700030C083F
:0300A800901104B0
:0300A900204039BB
:0300AA00030C0044
:0300AB0090103979
:0300AC00202C0005
:0300AD0003003A13
:0300AE009010258A
:0300AF0021003EEF
:0300B00003B02B6F
:0300B100707C035D
:0300B200AB602C14
:0300B300209C404E
:0300B40013F0390D
:0300B500ABE7D9DD
:0300B600209AB5D8
:0300B70015FC0035
:0300B800643208A7
:0300B900AE8030E6
:0300BA0069B90120
:0300BB00AE8C8088
:0300BC0020920887
:0300BD001BF03005
:0300BE00C5090170
:0300BF00039C405F
:0300C000799039FB
:0300C100AC06D9B1
:0300C20020BAC69B
:0300C300D006F96B
:0300C400038BC9E2
:0300C500219AC1BC
:0300C600E079429C
:0300C700348C0274
:0300C80034818000
:0300C900348E076B
:0300CA0034874335
:0300CB00030AE73E
:0300CC0021AC065E
:0300CD00348195E6
:0300CE0034874331
:0300CF00348AE789
:0300D0003487D39F
:0300D100D05AE71B
:0300D200031C0606
:0300D300C00187E2
:0300D400032743BC
:0300D500033AD813
:0300D600C70C0351
:0300D700039AE5A4
:0300D800C50C074D
:0300D90003918709
:0300DA00C1874398
:0300DB00030ADE37
:0300DC00C00C0154
:0300DD00031AE51E
:0300DE0021BC033F
:0300DF0003218773
:0300E000C0074313
:0300E100033AE4FB
:0300E200C70C0048
:0300E300039AE598
:0300E400C502074B
:0300E5000390275E
:0300E600C40AF455
:0300E700039C0671
:0300E800369195B9
:0300E900C01643FB
:0300EA001FAAF456
:0300EB0021CC0124
:0300EC0009A1C7A0
:0300ED0074309CD0
:0300EE00A1E70384
:0300EF0003AAF46D
:0300F000C02CFF22
:0300F100FFF022FB
:0300F20016B0271E
:0300F300C02B5CC3
:0300F40023EC00FA
:0300F5007436F36B
:0300F60012BCFF3A
:0300F70020B02115
:0300F800038C0175
:0300F900C44024DC
:0300FA0003990A5D
:0300FB00C406B385
:0300FC00039B83E0
:0300FD00C00C0133
:0300FE0002302F9E
:0300FF00ABF2154C
:03010000B006D373
:03010100000D806E
:03010200000024D6
:03010300000217E0
:03010400000022D6
:03010500000C06E5
:0301060000019560
:03010700000743AB
:03010800000B4B9E
:030109000006D31A
:03010A00000B4B9C
:03010B00000CE005
:03010C0000015798
:03010D00000643A6
:03010E00000B4B98
:03010F00000C00E1
:030110000007B72E
:03011100000C05DA
:030112000007D70C
:03011300000C10CD
:030114000007F7EA
:03011500000C02D9
:03011600000027BF
:03011700000C10C9
:03011800000D02D5
:03011900000FFFD5
:03011A000001429F
:03011B0000069744
:03011C00000D02D1
:03011D00000637A2
:03011E00000D10C1
:03011F00000022BB
:03012000000C8050
:03012100000124B6
:03012200000C02CC
:0301230000018058
:03012400000E07C3
:030125000007438D
:03012600000B3992
:03012700000C05C4
:030128000001478C
:030129000006438A
:03012A00000B398E
:03012B00000C01C4
:03012C000001814E
:03012D0000074385
:03012E00000B3291
:03012F00000C10B1
:03013000000021AB
:03013100000B3987
:03013200000C10AE
:0301330000018147
:030134000007437E
:03013500000B3983
:03013600000C209A
:03013700000021A4
:03013800000B3980
:03013900000201C0
:03013A0000003092
:03013B00000901B7
:03013C00000204BA
:03013D000000308F
:03013E00000901B4
:03013F00000202B9
:030140000000308C
:03014100000901B1
:03014200000C802E
:03014300000FFFAB
:0301440000016453
:03014500000207AE
:0301460000016253
:03014700000FFFA7
:0301480000015063
:03014900000D089E
:03014A000001228F
:03014B00000201AE
:03014C0000003080
:03014D00000901A5
:03014E00000204A8
:03014F000000307D
:03015000000901A2
:03015100000202A7
:030152000000307A
:030153000009019F
:03015400000C009C
:0301550000002F78
:030156000007D3CC
:03015700000B7E1C
:0301580000021092
:0301590000002281
:03015A0000020E92
:03015B000000277A
:03015C00000C5044
:03015D0000003966
:03015E00000799FE
:03015F00000B5E34
:0301600000021288
:030161000000306B
:0301620000021484
:0301630000003168
:0301640000021383
:030165000006B3DE
:03016600000D1079
:0301670000003263
:03016800000C0088
:0301690000003360
:03016A00000C7016
:03016B0000003958
:03016C00000C5034
:03016D0000003956
:03016E0000021577
:03016F000000305D
:0301700000021674
:030171000000315A
:0301720000020286
:0301730000003257
: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
:030175000006B3CE
:030176000002077D
:0301770000003352
:03017800000C7008
:030179000000394A
:03017A00000C5026
:03017B0000003948
:03017C00000C4034
:03017D0000003946
:03017E00000C0072
:03017F0000003944
:03018000000C0070
:03018100000C006F
:03018200000ABFB1
:03018300000C026B
:0301840000002F49
:03018500000C0A61
:0301860000002A4C
:03018700000C0069
:0301880000002450
:030189000007D399
:03018A00000BA6C1
:03018B000002016E
:03018C0000003040
:03018D0000090165
:03018E0000021557
:03018F000000303D
:0301900000090162
:0301910000021653
:030192000000303A
:030193000009015F
:03019400000C1F3D
:03019500000D80DA
:0301960000002244
:0301970000020162
@@ -414,54 +414,73 @@
:03019A000002025E
:03019B0000003031
:03019C0000090156
:03019D0000021845
:03019D0000020459
:03019E000000302E
:03019F0000090153
: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
:0301A0000002EA70
:0301A10000071044
:0301A200000BA4AB
:0301A300000B97B7
:0301A4000007D37E
:0301A500000BC488
:0301A600000C1D2D
:0301A7000006D37C
:0301A800000D80C7
:0301A90000002231
:0301AA000002014F
:0301AB0000003021
:0301AC0000090146
:0301AD000002024B
:0301AE000000301E
:0301AF0000090143
:0301B00000021832
:0301B1000000301B
:0301B20000090140
:0301B30000021037
:0301B40000002E1A
:0301B500000C1C1F
:0301B6000006D36D
:0301B700000D80B8
:0301B80000002222
:0301B90000020140
:0301BA0000003012
:0301BB0000090137
:0301BC000002023C
:0301BD000000300F
:0301BE0000090134
:0301BF0000021724
:0301C0000000300C
:0301C10000090131
:0301C2000007D360
:0301C300000B8BA3
:0301C400000C002C
:0301C50000002611
:0301C600000C0129
:0301C7000000290C
:0301C800000C0028
:0301C90000002F04
:0301CA00000C2006
:0301CB000000230E
:0301CC00000A0026
:0301CD00000AAC79
:0301CE00000BCE55
:0301C50000002F08
:0301C6000007D35C
:0301C700000B7EAC
:0301C800000B58D1
:0301C900000C0720
:0301CA0000002F03
:0301CB00000C0421
:0301CC000000210F
:0301CD00000C0023
:0301CE0000091E07
:0301CF00000C1011
:0301D0000000210B
:0301D100000C0817
:0301D20000091E03
:0301D300000C40DD
:0301D40000002107
:0301D500000C100B
:0301D60000091EFF
:0301D700000C0019
:0301D80000003AEA
:0301D900000C0116
:0301DA00000029F9
:0301DB00000C0015
:0301DC0000002FF1
:0301DD00000C20F3
:0301DE00000023FB
:0301DF00000A0013
:0301E000000ABF53
:0301E100000BE12F
:00000001FF

View File

@@ -1,5 +1,5 @@
#
# $Id: PIC_TYPE_2.hex 7107 2009-05-18 12:35:20Z dima $
# $Id: PIC_TYPE_2.hex 9732 2011-08-24 19:13:55Z dima $
#
:03000000A57A4896
:03000100C41C41DB
@@ -97,243 +97,264 @@
:03005D00E07180CF
:03005E0002CE705F
:03005F00206743D4
:0300600090AA6BF8
:0300600090AA70F3
:03006100205C021E
:03006200D2018048
:03006300D40E03B5
:03006300D40E07B1
:0300640003D6437D
:03006500C1CA6E9F
:03006500C1CA739A
:03006600022C0366
:03006700C0018055
:03006800024E0342
:03006800024E073E
:0300690021D6435A
:03006A00030A6E18
:03006B00901C01E5
:03006C0020203819
:03006D00030A6D16
:03006E00901C18CB
:03006F00204038F6
:030070000302196F
:03007100901E0FCF
:0300720021002248
:03007300024C003C
:03006A00030A7313
:03006B00901C04E2
:03006C00202180D0
:03006D00030E0778
:03006E00901643A6
:03006F00204A73B1
:03007000030C017D
:03007100901038B4
:03007200210A72EE
:03007300024C1824
:03007400C0303861
: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
: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
:00000001FF

File diff suppressed because it is too large Load Diff

View File

@@ -51,6 +51,7 @@ 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);
@@ -78,6 +79,7 @@ if (-t STDERR) {
foreach my $k (qw(
XBUS_NAME
XBUS_NUMBER
XBUS_MODEL_STRING
UNIT_NUMBER
UNIT_TYPE
UNIT_SUBUNITS
@@ -90,6 +92,10 @@ 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) {
@@ -286,11 +292,15 @@ 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 10 # Low Battery Voltage
* WD 4B $lbv # Low Battery Voltage
* WD 49 $vcm # Common Mode Voltage (VCM)
* WD 40 00 # Line Feed Control
#")
}
@@ -578,9 +588,6 @@ __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

@@ -58,9 +58,11 @@ static int proc_xbus_command_write(struct file *file, const char __user *buffer,
/* Command line parameters */
extern int debug;
static DEF_PARM(uint, command_queue_length, 1000, 0444, "Maximal command queue length");
static DEF_PARM(uint, command_queue_length, 1500, 0444, "Maximal command queue length");
static DEF_PARM(uint, poll_timeout, 1000, 0644, "Timeout (in jiffies) waiting for units to reply");
static DEF_PARM_BOOL(rx_tasklet, 0, 0644, "Use receive tasklets");
static DEF_PARM_BOOL(dahdi_autoreg, 0, 0644,
"Register devices automatically (1) or not (0)");
#ifdef CONFIG_PROC_FS
static int xbus_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data);
@@ -776,7 +778,6 @@ 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;
@@ -871,6 +872,100 @@ err:
goto out;
}
int xbus_is_registered(xbus_t *xbus)
{
return xbus->ddev && xbus->ddev->dev.parent;
}
int xbus_register_dahdi_device(xbus_t *xbus)
{
int i;
int offset = 0;
XBUS_DBG(DEVICES, xbus, "Entering %s\n", __func__);
if (xbus_is_registered(xbus)) {
XBUS_ERR(xbus, "Already registered to DAHDI\n");
WARN_ON(1);
return -EINVAL;
}
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;
}
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
@@ -934,6 +1029,8 @@ void xbus_populate(void *data)
*/
xbus_request_sync(xbus, SYNC_MODE_PLL);
elect_syncer("xbus_populate(end)"); /* FIXME: try to do it later */
if (dahdi_autoreg)
xbus_register_dahdi_device(xbus);
out:
XBUS_DBG(DEVICES, xbus, "Leaving\n");
wake_up_interruptible_all(&worker->wait_for_xpd_initialization);
@@ -1206,12 +1303,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] */
}
@@ -1316,7 +1413,6 @@ xbus_t *xbus_new(struct xbus_ops *ops, ushort max_send_size, struct device *tran
xbus = xbus_alloc();
if(!xbus) {
ERR("%s: Failed allocating new xbus\n", __FUNCTION__);
module_put(THIS_MODULE);
return NULL;
}
snprintf(xbus->busname, XBUS_NAMELEN, "XBUS-%02d", xbus->num);
@@ -1788,10 +1884,6 @@ 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,8 +29,9 @@
#include "xframe_queue.h"
#include "xbus-pcm.h"
#define MAX_BUSES 32
#define XFRAME_DATASIZE 512
#define MAX_BUSES 128
#define XFRAME_DATASIZE 512
#define MAX_ENV_STR 40
/* forward declarations */
struct xbus_workqueue;
@@ -108,6 +109,7 @@ 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)
@@ -188,6 +190,7 @@ 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];
@@ -340,6 +343,10 @@ int xpd_device_register(xbus_t *xbus, xpd_t *xpd);
void xpd_device_unregister(xpd_t *xpd);
int echocancel_xpd(xpd_t *xpd, int on);
int xbus_is_registered(xbus_t *xbus);
int xbus_register_dahdi_device(xbus_t *xbus);
void xbus_unregister_dahdi_device(xbus_t *xbus);
int xpp_driver_init(void);
void xpp_driver_exit(void);
int xbus_sysfs_transport_create(xbus_t *xbus);

View File

@@ -438,16 +438,6 @@ 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,
@@ -623,6 +613,10 @@ static DEVICE_ATTR_READER(span_show, dev, buf)
return len;
}
/*
* For backward compatibility with old dahdi-tools
* Remove after dahdi_registration is upgraded
*/
static DEVICE_ATTR_WRITER(span_store, dev, buf, count)
{
xpd_t *xpd;
@@ -631,19 +625,34 @@ static DEVICE_ATTR_WRITER(span_store, dev, buf, count)
BUG_ON(!dev);
xpd = dev_to_xpd(dev);
if(!xpd)
if (!xpd)
return -ENODEV;
ret = sscanf(buf, "%d", &dahdi_reg);
if(ret != 1)
if (ret != 1)
return -EINVAL;
if(!XBUS_IS(xpd->xbus, READY))
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;
XPD_DBG(DEVICES, xpd,
"%s -- deprecated (should use pinned-spans)\n",
(dahdi_reg) ? "register" : "unregister");
if (xbus_is_registered(xpd->xbus)) {
if (dahdi_reg) {
XPD_DBG(DEVICES, xpd,
"already registered %s. Ignored.\n",
xpd->xbus->busname);
} else {
xbus_unregister_dahdi_device(xpd->xbus);
}
} else {
if (!dahdi_reg) {
XPD_DBG(DEVICES, xpd,
"already unregistered %s. Ignored.\n",
xpd->xbus->busname);
} else {
xbus_register_dahdi_device(xpd->xbus);
}
}
return count;
}
static DEVICE_ATTR_READER(type_show, dev, buf)
@@ -964,7 +973,7 @@ int xbus_sysfs_create(xbus_t *xbus)
astribank = &xbus->astribank;
XBUS_DBG(DEVICES, xbus, "\n");
astribank->bus = &toplevel_bus_type;
astribank->parent = &toplevel_device;
astribank->parent = xbus->transport.transport_device;
dev_set_name(astribank, "xbus-%02d", xbus->num);
dev_set_drvdata(astribank, xbus);
astribank->release = astribank_release;
@@ -981,16 +990,10 @@ 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_bus;
goto failed_toplevel;
}
if((ret = driver_register(&xpp_driver)) < 0) {
ERR("%s: driver_register(%s) failed. Error number %d",
@@ -1007,8 +1010,6 @@ 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;
}
@@ -1019,7 +1020,6 @@ 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,7 +57,6 @@ 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");
@@ -253,13 +252,6 @@ 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
/**
@@ -568,46 +560,6 @@ 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
*/
@@ -615,7 +567,6 @@ 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);
}
@@ -734,7 +685,6 @@ 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();
@@ -776,7 +726,6 @@ 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;
}
@@ -915,6 +864,7 @@ 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 = {
@@ -937,7 +887,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, "%s:\n", __func__);
LINE_DBG(GENERAL, xpd, pos, "\n");
if (!ECHOOPS(xbus))
return NULL;
/*
@@ -986,6 +936,7 @@ 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);
@@ -994,53 +945,18 @@ int xpp_echocan_create(struct dahdi_chan *chan,
}
EXPORT_SYMBOL(xpp_echocan_create);
/**
* 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)
void xpp_span_assigned(struct dahdi_span *span)
{
unsigned long flags;
struct phonedev *phonedev = container_of(span, struct phonedev, span);
xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
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;
XPD_INFO(xpd, "Span assigned: %d\n", span->spanno);
if (xpd->card_present) {
span->alarms &= ~DAHDI_ALARM_NOTOPEN;
dahdi_alarm_notify(&phonedev->span);
}
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,
@@ -1050,6 +966,7 @@ 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 = {
@@ -1061,14 +978,54 @@ 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,
};
int dahdi_register_xpd(xpd_t *xpd)
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)
{
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;
int i;
struct phonedev *phonedev;
BUG_ON(!xpd);
@@ -1078,70 +1035,26 @@ int dahdi_register_xpd(xpd_t *xpd)
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_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);
xpd_init_span(xpd, offset, cn);
XPD_DBG(DEVICES, xpd, "Preregister local span %d: %d channels.\n",
offset + 1, cn);
CALL_PHONE_METHOD(card_dahdi_preregistration, xpd, 1);
if(dahdi_register(&PHONEDEV(xpd).span, prefmaster)) {
XPD_ERR(xpd, "Failed to dahdi_register span\n");
return -ENODEV;
}
return 0;
}
int xpd_dahdi_postregister(xpd_t *xpd)
{
int cn;
atomic_inc(&num_registered_spans);
atomic_inc(&PHONEDEV(xpd).dahdi_registered);
CALL_PHONE_METHOD(card_dahdi_postregistration, xpd, 1);
@@ -1161,6 +1074,48 @@ int dahdi_register_xpd(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)
@@ -1181,11 +1136,6 @@ static int __init xpp_dahdi_init(void)
INFO("revision %s MAX_XPDS=%d (%d*%d)\n", XPP_VERSION,
MAX_XPDS, MAX_UNIT, MAX_SUBUNIT);
#ifdef CONFIG_DAHDI_BRI_DCHANS
INFO("FEATURE: with BRISTUFF support\n");
#else
INFO("FEATURE: without BRISTUFF support\n");
#endif
#ifdef CONFIG_PROC_FS
xpp_proc_toplevel = proc_mkdir(PROC_DIR, NULL);
if(!xpp_proc_toplevel) {
@@ -1220,12 +1170,10 @@ 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,12 +25,13 @@
#include "xpd.h"
#include "xproto.h"
int dahdi_register_xpd(xpd_t *xpd);
int dahdi_unregister_xpd(xpd_t *xpd);
void xbus_request_removal(xbus_t *xbus);
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 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);
@@ -46,6 +47,7 @@ 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,11 +43,10 @@ show_debug() {
list=''
for n in $dbg_names
do
if (( val & (1 << j) ))
then
if [ $(( val & (1 << j) )) -ne 0 ]; then
list="$list $n"
fi
let j++
j=$((j+1))
done
if [ "$list" = "" ]; then
list=' NONE'
@@ -67,19 +66,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
let j++
j=$((j+1))
done
if [ "$found" -eq 0 ]; then
echo >&2 "$0: Unknown debug flag '$wanted'"

View File

@@ -737,6 +737,12 @@ 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,8 @@
#include <linux/config.h>
#endif
#include <linux/fs.h>
#include <linux/kobject.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/ioctl.h>
#ifdef CONFIG_DAHDI_NET
@@ -54,6 +55,8 @@
#include <linux/skbuff.h>
#include <linux/interrupt.h>
#endif
#include <linux/device.h>
#include <linux/sysfs.h>
#include <linux/poll.h>
@@ -69,6 +72,10 @@
#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
@@ -881,6 +888,38 @@ 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 {
@@ -888,14 +927,10 @@ 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
@@ -909,7 +944,6 @@ 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 */
@@ -929,7 +963,11 @@ struct dahdi_span {
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_entry;
#endif
struct list_head node;
struct list_head spans_node;
struct dahdi_device *parent;
struct list_head device_node;
struct device *span_device;
};
struct dahdi_transcoder_channel {
@@ -946,6 +984,8 @@ 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);
@@ -1027,6 +1067,7 @@ 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;
@@ -1034,6 +1075,7 @@ struct dahdi_dynamic {
int timing;
int master;
unsigned char *msgbuf;
struct device *dev;
struct list_head list;
};
@@ -1097,6 +1139,22 @@ 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);
@@ -1111,10 +1169,12 @@ 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 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);
/*! 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);
/*! Allocate / free memory for a transcoder */
struct dahdi_transcoder *dahdi_transcoder_alloc(int numchans);
@@ -1129,9 +1189,6 @@ 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);
@@ -1360,6 +1417,24 @@ 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)
@@ -1386,12 +1461,17 @@ 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
@@ -1457,6 +1537,26 @@ 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.
*/
@@ -1468,6 +1568,7 @@ struct mutex {
* be of the form DAHDI_DBG_*
*/
#define DAHDI_DBG_GENERAL BIT(0)
#define DAHDI_DBG_ASSIGN BIT(1)
#define DAHDI_DBG_DEVICES BIT(7) /* instantiation/destruction etc. */
#define dahdi_dbg(bits, fmt, ...) \
((void)((debug & (DAHDI_DBG_ ## bits)) && DAHDI_PRINTK(DEBUG, \
@@ -1480,6 +1581,10 @@ struct mutex {
((void)((debug & (DAHDI_DBG_ ## bits)) && \
chan_printk(DEBUG, "-" #bits, chan, \
"%s: " fmt, __func__, ## __VA_ARGS__)))
#define dahdi_dev_dbg(bits, dev, fmt, ...) \
((void)((debug & (DAHDI_DBG_ ## bits)) && \
dev_printk(KERN_DEBUG, dev, \
"DBG-%s(%s): " fmt, #bits, __func__, ## __VA_ARGS__)))
#endif /* DAHDI_PRINK_MACROS_USE_debug */
#endif /* _DAHDI_KERNEL_H */