From a0e532fc44b63d9996b16ca7329d9a98e04e3362 Mon Sep 17 00:00:00 2001 From: Russ Meyerriecks Date: Mon, 22 Feb 2010 16:18:45 +0000 Subject: Branch merge from the maintenance modes project * Added logic for both the single and dual/quad span cards for supporting local loopback (virtual loopback plug), network loopback, network payload loopback, loopup, and loopback transmitting. * Added logic for the dual/quad span driver to support exporting the performance and error counters including : - errored seconds - framing errors - coding violations - bipolar violations - crc4 errors - ebit errors - fas errors * Moved the error and performance counters into a substructure for all drivers taking advantage of dahdi_span bpvcount. * Modified the DAHDI_SPANSTAT ioctl interface, so I moved the old interface to DAHDI_SPANSTAT_V1. The new interface comes with a nice, new shiny packed struct dahdi_spaninfo. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8061 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wcte12xp/base.c | 29 ++++++++++++++++++++--------- drivers/dahdi/wcte12xp/wcte12xp.h | 7 +++++++ 2 files changed, 27 insertions(+), 9 deletions(-) (limited to 'drivers/dahdi/wcte12xp') diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 79ded20..dfba2dd 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -1099,6 +1099,7 @@ static inline void t1_check_sigbits(struct t1 *wc) static int t1xxp_maint(struct dahdi_span *span, int cmd) { struct t1 *wc = span->pvt; + int reg = 0; if (wc->spantype == TYPE_E1) { switch (cmd) { @@ -1128,24 +1129,34 @@ static int t1xxp_maint(struct dahdi_span *span, int cmd) } else { switch (cmd) { case DAHDI_MAINT_NONE: - t1_info(wc, "XXX Turn off local and remote " - "loops T1 XXX\n"); + /* Turn off local loop */ + reg = t1_getreg(wc, LIM0); + t1_setreg(wc, LIM0, reg & ~LIM0_LL); + + /* Turn off remote loop & jitter attenuator */ + reg = t1_getreg(wc, LIM1); + t1_setreg(wc, LIM1, reg & ~(LIM1_RL | LIM1_JATT)); break; case DAHDI_MAINT_LOCALLOOP: - t1_info(wc, "XXX Turn on local loop and no remote " - "loop XXX\n"); + reg = t1_getreg(wc, LIM0); + t1_setreg(wc, LIM0, reg | LIM0_LL); break; - case DAHDI_MAINT_REMOTELOOP: - t1_info(wc, "XXX Turn on remote loopup XXX\n"); + case DAHDI_MAINT_NETWORKLINELOOP: + reg = t1_getreg(wc, LIM1); + t1_setreg(wc, LIM1, reg | LIM1_RL); + break; + case DAHDI_MAINT_NETWORKPAYLOADLOOP: + reg = t1_getreg(wc, LIM1); + t1_setreg(wc, LIM1, reg | (LIM1_RL | LIM1_JATT)); break; case DAHDI_MAINT_LOOPUP: - t1_setreg(wc, 0x21, 0x50); /* FMR5: Nothing but RBS mode */ + t1_setreg(wc, 0x21, 0x50); break; case DAHDI_MAINT_LOOPDOWN: - t1_setreg(wc, 0x21, 0x60); /* FMR5: Nothing but RBS mode */ + t1_setreg(wc, 0x21, 0x60); break; case DAHDI_MAINT_LOOPSTOP: - t1_setreg(wc, 0x21, 0x40); /* FMR5: Nothing but RBS mode */ + t1_setreg(wc, 0x21, 0x40); break; default: t1_info(wc, "Unknown T1 maint command: %d\n", cmd); diff --git a/drivers/dahdi/wcte12xp/wcte12xp.h b/drivers/dahdi/wcte12xp/wcte12xp.h index 1729ec5..0ec3c3a 100644 --- a/drivers/dahdi/wcte12xp/wcte12xp.h +++ b/drivers/dahdi/wcte12xp/wcte12xp.h @@ -140,4 +140,11 @@ struct t1 { #define t1_info(t1, format, arg...) \ dev_info(&t1->vb.pdev->dev , format , ## arg) +/* Maintenance Mode Registers */ +#define LIM0 0x36 +#define LIM0_LL (1<<1) +#define LIM1 0x37 +#define LIM1_RL (1<<1) +#define LIM1_JATT (1<<2) + #endif -- cgit v1.2.3