Review Board 1.7.16


Generate VMWI neon pulses from FXS module to light NEON lamp on older 'non intellegent phones'

Review Request #1144 - Created March 16, 2011 and updated

Alec Davis
dahdi/linux
14261
Reviewers
asterisk-dev
sruffell
DAHDI
Implement same code as for wcdtm
13/04/12
Tested with mwisendtype=lrev,hvac
at 2 different phones on same FXS port, one a real neon phone, and another a led+zener phone.
Left messages, and neon would flash as expected.

Diff revision 1

This is not the most recent revision of the diff. The latest diff is revision 7. See what's changed.

1 2 3 4 5 6 7
1 2 3 4 5 6 7

  1. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c: Loading...
  2. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h: Loading...
linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c
Revision 9867 New Change
[20] 105 lines
[+20] [+] static int loopcurrent = 20;
106
 * 	overall polarity reversal for the module,
106
 * 	overall polarity reversal for the module,
107
 * 	polarity reversal for the port,
107
 * 	polarity reversal for the port,
108
 * 	and the state of the line reversal MWI indicator
108
 * 	and the state of the line reversal MWI indicator
109
 */
109
 */
110
#define POLARITY_XOR(fxs) \
110
#define POLARITY_XOR(fxs) \
111
	((reversepolarity != 0) ^ ((fxs)->reversepolarity != 0) ^ \
111
	( (reversepolarity != 0) ^ ((fxs)->reversepolarity != 0) ^ \
112
	((fxs)->vmwi_linereverse != 0))
112
	((fxs)->vmwi_linereverse != 0) ^ (((fxs)->vmwisetting.vmwi_type & DAHDI_VMWI_HVAC) != 0) )
113

    
   
113

   
114
static int reversepolarity = 0;
114
static int reversepolarity = 0;
115

    
   
115

   
116
static alpha  indirect_regs[] =
116
static alpha  indirect_regs[] =
117
{
117
{
[+20] [20] 142 lines
[+20] [+] static const struct dahdi_echocan_ops vpm_ec_ops = {
260

    
   
260

   
261
static int
261
static int
262
wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod, int fast,
262
wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod, int fast,
263
		   int manual, int sane);
263
		   int manual, int sane);
264

    
   
264

   

    
   
265
static int wctdm_init_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod);

    
   
266
static int wctdm_set_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod, int mode);

    
   
267

   
265
static void set_offsets(struct wctdm_module *const mod, int altcs)
268
static void set_offsets(struct wctdm_module *const mod, int altcs)
266
{
269
{
267
	int card = mod->card;
270
	int card = mod->card;
268
	int bit;
271
	int bit;
269

    
   
272

   
[+20] [20] 1347 lines
[+20] [+] wctdm_proslic_recheck_sanity(struct wctdm *wc, struct wctdm_module *const mod)
1617
			dev_notice(&wc->vb.pdev->dev,
1620
			dev_notice(&wc->vb.pdev->dev,
1618
				   "Power alarm on module %d, resetting!\n",
1621
				   "Power alarm on module %d, resetting!\n",
1619
				   mod->card + 1);
1622
				   mod->card + 1);
1620
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
1623
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
1621
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1624
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1622
				fxs->lasttxhook = POLARITY_XOR(fxs) ?
1625
				fxs->lasttxhook = (POLARITY_XOR(fxs)) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
1623
							SLIC_LF_ACTIVE_REV :

   
1624
							SLIC_LF_ACTIVE_FWD;;

   
1625
			}
1626
			}
1626
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1627
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1627
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1628
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1628
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
1629
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
1629

    
   
1630

   
[+20] [20] 381 lines
[+20] [+] wctdm_fxs_hooksig(struct wctdm *wc, struct wctdm_module *const mod,
2011
	spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2012
	spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2012
	switch (txsig) {
2013
	switch (txsig) {
2013
	case DAHDI_TXSIG_ONHOOK:
2014
	case DAHDI_TXSIG_ONHOOK:
2014
		switch (mod->chan->chan.sig) {
2015
		switch (mod->chan->chan.sig) {
2015
		case DAHDI_SIG_EM:
2016
		case DAHDI_SIG_EM:

    
   
2017
			x =	fxs->idletxhookstate;

    
   
2018
			break;
2016
		case DAHDI_SIG_FXOKS:
2019
		case DAHDI_SIG_FXOKS:
2017
		case DAHDI_SIG_FXOLS:
2020
		case DAHDI_SIG_FXOLS:
2018
			x = fxs->idletxhookstate;
2021
			/* Can't change Ring Generator during OHT */

    
   
2022
			if (!fxs->ohttimer){

    
   
2023
				wctdm_set_ring_generator_mode(wc, mod, fxs->vmwi_hvac);

    
   
2024
				x = fxs->vmwi_hvac ? SLIC_LF_RINGING : fxs->idletxhookstate;

    
   
2025
			}else{

    
   
2026
				x =	fxs->idletxhookstate;

    
   
2027
			}
2019
			break;
2028
			break;
2020
		case DAHDI_SIG_FXOGS:
2029
		case DAHDI_SIG_FXOGS:
2021
			x = (POLARITY_XOR(fxs)) ?
2030
			x = (POLARITY_XOR(fxs)) ?
2022
					SLIC_LF_RING_OPEN :
2031
					SLIC_LF_RING_OPEN :
2023
					SLIC_LF_TIP_OPEN;
2032
					SLIC_LF_TIP_OPEN;
[+20] [20] 11 lines
[+20] wctdm_fxs_hooksig(struct wctdm *wc, struct wctdm_module *const mod,
2035
			x = fxs->idletxhookstate;
2044
			x = fxs->idletxhookstate;
2036
			break;
2045
			break;
2037
		}
2046
		}
2038
		break;
2047
		break;
2039
	case DAHDI_TXSIG_START:
2048
	case DAHDI_TXSIG_START:

    
   
2049
		wctdm_set_ring_generator_mode(wc, mod, 0); /* Set ringer mode */
2040
		x = SLIC_LF_RINGING;
2050
		x = SLIC_LF_RINGING;
2041
		break;
2051
		break;
2042
	case DAHDI_TXSIG_KEWL:
2052
	case DAHDI_TXSIG_KEWL:
2043
		x = SLIC_LF_OPEN;
2053
		x = SLIC_LF_OPEN;
2044
		break;
2054
		break;
[+20] [20] 29 lines
[+20] [+] static void wctdm_fxs_off_hook(struct wctdm *wc, struct wctdm_module *const mod)
2074
	switch (fxs->lasttxhook) {
2084
	switch (fxs->lasttxhook) {
2075
	case SLIC_LF_RINGING:		/* Ringing */
2085
	case SLIC_LF_RINGING:		/* Ringing */
2076
	case SLIC_LF_OHTRAN_FWD:	/* Forward On Hook Transfer */
2086
	case SLIC_LF_OHTRAN_FWD:	/* Forward On Hook Transfer */
2077
	case SLIC_LF_OHTRAN_REV:	/* Reverse On Hook Transfer */
2087
	case SLIC_LF_OHTRAN_REV:	/* Reverse On Hook Transfer */
2078
		/* just detected OffHook, during Ringing or OnHookTransfer */
2088
		/* just detected OffHook, during Ringing or OnHookTransfer */
2079
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
2089
		fxs->idletxhookstate = (POLARITY_XOR(fxs)) ?
2080
						SLIC_LF_ACTIVE_REV :
2090
						SLIC_LF_ACTIVE_REV :
2081
						SLIC_LF_ACTIVE_FWD;
2091
						SLIC_LF_ACTIVE_FWD;
2082
		break;
2092
		break;
2083
	}
2093
	}
2084
	wctdm_fxs_hooksig(wc, mod, DAHDI_TXSIG_OFFHOOK);
2094
	wctdm_fxs_hooksig(wc, mod, DAHDI_TXSIG_OFFHOOK);
[+20] [20] 128 lines
[+20] [+] static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod)
2213

    
   
2223

   
2214
	wctdm_proslic_check_oppending(wc, mod);
2224
	wctdm_proslic_check_oppending(wc, mod);
2215

    
   
2225

   
2216
	if (!(wc->intcount & 0xfc))	/* every 256ms */
2226
	if (!(wc->intcount & 0xfc))	/* every 256ms */
2217
		wctdm_proslic_recheck_sanity(wc, mod);
2227
		wctdm_proslic_recheck_sanity(wc, mod);
2218
	if (SLIC_LF_RINGING == fxs->lasttxhook) {
2228
	if ((SLIC_LF_RINGING == fxs->lasttxhook) && fxs->neonringing ) {
2219
		/* RINGing, prepare for OHT */
2229
		/* RINGing, prepare for OHT */
2220
		fxs->ohttimer = OHT_TIMER << 3;
2230
		fxs->ohttimer = OHT_TIMER << 3;
2221
		/* OHT mode when idle */
2231
		/* OHT mode when idle */
2222
		fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_OHTRAN_REV :
2232
		fxs->idletxhookstate = (POLARITY_XOR(fxs)) ? SLIC_LF_OHTRAN_REV :
2223
							    SLIC_LF_OHTRAN_FWD;
2233
							    SLIC_LF_OHTRAN_FWD;
2224
	} else if (fxs->ohttimer) {
2234
	} else if (fxs->ohttimer) {
2225
		 /* check if still OnHook */
2235
		 /* check if still OnHook */
2226
		if (!fxs->oldrxhook) {
2236
		if (!fxs->oldrxhook) {
2227
			fxs->ohttimer -= DAHDI_CHUNKSIZE;
2237
			fxs->ohttimer -= DAHDI_CHUNKSIZE;
2228
			if (fxs->ohttimer)
2238
			if (fxs->ohttimer)
2229
				return;
2239
				return;
2230

    
   
2240

   
2231
			/* Switch to active */
2241
			/* Switch to active */
2232
			fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_ACTIVE_REV :
2242
			fxs->idletxhookstate = (POLARITY_XOR(fxs)) ? SLIC_LF_ACTIVE_REV :
2233
								    SLIC_LF_ACTIVE_FWD;
2243
								    SLIC_LF_ACTIVE_FWD;
2234
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2244
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2235
			if (SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) {
2245

   
2236
				/* Apply the change if appropriate */
2246
			if ((SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) || (SLIC_LF_OHTRAN_REV == fxs->lasttxhook)) {
2237
				fxs->lasttxhook = SLIC_LF_OPPENDING | SLIC_LF_ACTIVE_FWD;
2247
				if (fxs->vmwi_hvac){
2238
				/* Data enqueued here */
2248
					/* force idle polarity Forward if ringing */
2239
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2249
					fxs->idletxhookstate = SLIC_LF_ACTIVE_FWD;
2240
				if (debug & DEBUG_CARD) {
2250
					/* Set ring generator for neon */
2241
					dev_info(&wc->vb.pdev->dev,
2251
					wctdm_set_ring_generator_mode(wc, mod, 1);
2242
						 "Channel %d OnHookTransfer "
2252
					fxs->lasttxhook = (SLIC_LF_OPPENDING | SLIC_LF_RINGING );
2243
						 "stop\n", mod->card);
2253
				} else {

    
   
2254
					fxs->lasttxhook = (fxs->idletxhookstate | SLIC_LF_OPPENDING);
2244
				}
2255
				}
2245
			} else if (SLIC_LF_OHTRAN_REV == fxs->lasttxhook) {

   
2246
				/* Apply the change if appropriate */

   
2247
				fxs->lasttxhook = SLIC_LF_OPPENDING | SLIC_LF_ACTIVE_REV;

   
2248
				/* Data enqueued here */
2256
				/* Data enqueued here */
2249
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2257
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2250
				if (debug & DEBUG_CARD) {
2258
				if (debug & DEBUG_CARD) {
2251
					dev_info(&wc->vb.pdev->dev,
2259
					dev_info(&wc->vb.pdev->dev,
2252
						 "Channel %d OnHookTransfer "
2260
						 "Channel %d OnHookTransfer "
2253
						 "stop\n", mod->card);
2261
						 "stop\n", mod->card);
2254
				}
2262
				}
2255
			}
2263
			}
2256
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
2264
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
2257
		} else {
2265
		} else {
2258
			fxs->ohttimer = 0;
2266
			fxs->ohttimer = 0;
2259
			/* Switch to active */
2267
			/* Switch to active */
2260
			fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
2268
			fxs->idletxhookstate = (POLARITY_XOR(fxs)) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
2261
			if (debug & DEBUG_CARD) {
2269
			if (debug & DEBUG_CARD) {
2262
				dev_info(&wc->vb.pdev->dev,
2270
				dev_info(&wc->vb.pdev->dev,
2263
					 "Channel %d OnHookTransfer abort\n",
2271
					 "Channel %d OnHookTransfer abort\n",
2264
					 mod->card);
2272
					 mod->card);
2265
			}
2273
			}
[+20] [20] 491 lines
[+20] [+] static int set_lasttxhook_interruptible(struct fxs *fxs, unsigned newval, int * psethook)
2757
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
2765
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
2758
{
2766
{
2759
	int x;
2767
	int x;
2760
	struct fxs *const fxs = &mod->mod.fxs;
2768
	struct fxs *const fxs = &mod->mod.fxs;
2761

    
   
2769

   
2762
	/* Presently only supports line reversal MWI */
2770
	/* Presently supports line reversal MWI and NEON dc pulses */
2763
	if ((fxs->vmwi_active_messages) &&
2771
	if (fxs->vmwi_active_messages) {
2764
	    (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_LREV))
2772
		fxs->vmwi_linereverse = (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_LREV)?1:0;
2765
		fxs->vmwi_linereverse = 1;
2773
		fxs->vmwi_hvac = (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_HVAC)?1:0;
2766
	else
2774
	} else {
2767
		fxs->vmwi_linereverse = 0;
2775
		fxs->vmwi_linereverse = 0;

    
   
2776
		fxs->vmwi_hvac = 0;

    
   
2777
	}
2768

    
   
2778

   

    
   
2779
	if (fxs->vmwi_hvac){

    
   
2780
		/* Can't change ring generator while On Hook Transfer might be happening */

    
   
2781
		if (!fxs->ohttimer) {
2769
	/* Set line polarity for new VMWI state */
2782
			/* Set line polarity for new VMWI state */
2770
	if (POLARITY_XOR(fxs)) {
2783
			if (POLARITY_XOR(fxs)) {
2771
		fxs->idletxhookstate |= SLIC_LF_OPPENDING | SLIC_LF_REVMASK;
2784
				fxs->idletxhookstate |= SLIC_LF_RINGING;
2772
		/* Do not set while currently ringing or open */
2785
			} else {
2773
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING)  &&
2786
				fxs->idletxhookstate &= ~SLIC_LF_RINGING;
2774
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
2787
			}
2775
			x = fxs->lasttxhook;
2788
			/* Set ring generator for neon */
2776
			x |= SLIC_LF_REVMASK;
2789
			wctdm_set_ring_generator_mode(wc, mod, 1);
2777
			set_lasttxhook_interruptible(fxs, x, &mod->sethook);
2790
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2778
		}
2791
		}
2779
	} else {
2792
	} else {
2780
		fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2793
		if (fxs->neonringing){
2781
		/* Do not set while currently ringing or open */
2794
			/* Set ring generator for normal ringer */
2782
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING) &&
2795
			wctdm_set_ring_generator_mode(wc, mod, 0);
2783
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
2796
			/* ACTIVE, polarity determined later */

    
   
2797
			fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;

    
   
2798
		} else {

    
   
2799
			/* Can't change polarity while ringing or when open */

    
   
2800
			if ((fxs->lasttxhook == SLIC_LF_RINGING) || (fxs->lasttxhook == SLIC_LF_OPEN)){

    
   
2801
				/* Set line polarity for new VMWI state */

    
   
2802
				if (POLARITY_XOR(fxs)) {

    
   
2803
					fxs->idletxhookstate |= SLIC_LF_RINGING;

    
   
2804
				} else {

    
   
2805
					fxs->idletxhookstate &= ~SLIC_LF_RINGING;

    
   
2806
				}

    
   
2807
				printk(KERN_DEBUG "Unable to change polarity on channel %d, lasttxhook=0x%X\n",

    
   
2808
					mod->card,

    
   
2809
					fxs->lasttxhook

    
   
2810
				);

    
   
2811
				return 0;

    
   
2812
			}

    
   
2813
		}

    
   
2814

   

    
   
2815
		/* Set line polarity for new VMWI state */

    
   
2816
		if (POLARITY_XOR(fxs)) {

    
   
2817
			fxs->idletxhookstate |= SLIC_LF_RINGING;

    
   
2818
			fxs->lasttxhook = (SLIC_LF_OPPENDING | SLIC_LF_RINGING);

    
   
2819
		} else {

    
   
2820
			fxs->idletxhookstate &= ~SLIC_LF_RINGING;

    
   
2821

   
2784
			x = fxs->lasttxhook;
2822
			x = fxs->lasttxhook;
2785
			x &= ~SLIC_LF_REVMASK;
2823
			x &= ~SLIC_LF_RINGING;
2786
			set_lasttxhook_interruptible(fxs, x, &mod->sethook);
2824
			x |= SLIC_LF_OPPENDING;

    
   
2825
			fxs->lasttxhook = x;
2787
		}
2826
		}

    
   
2827
		set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2788
	}
2828
	}
2789
	if (debug) {
2829
	if (debug) {
2790
		dev_info(&wc->vb.pdev->dev,
2830
		dev_info(&wc->vb.pdev->dev,
2791
			 "Setting VMWI on channel %d, messages=%d, lrev=%d\n",
2831
			 "Setting VMWI on channel %d, messages=%d, lrev=%d\n",
2792
			 mod->card, fxs->vmwi_active_messages,
2832
			 mod->card, fxs->vmwi_active_messages,
[+20] [20] 392 lines
[+20] [+] wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod,
3185
				 "Reducing ring power on slot %d "
3225
				 "Reducing ring power on slot %d "
3186
				 "(50V peak)\n", mod->card + 1);
3226
				 "(50V peak)\n", mod->card + 1);
3187
		}
3227
		}
3188
	}
3228
	}
3189

    
   
3229

   

    
   
3230
	if (wctdm_init_ring_generator_mode(wc, mod->card)){

    
   
3231
			return -1;

    
   
3232
	}

    
   
3233

   
3190
	if (fxstxgain || fxsrxgain) {
3234
	if (fxstxgain || fxsrxgain) {
3191
		r9 = wctdm_getreg(wc, mod, 9);
3235
		r9 = wctdm_getreg(wc, mod, 9);
3192
		switch (fxstxgain) {
3236
		switch (fxstxgain) {
3193
		
3237
		
3194
			case 35:
3238
			case 35:
[+20] [20] 267 lines
[+20] [+] static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
3462
		if (get_user(x, (__user int *) data))
3506
		if (get_user(x, (__user int *) data))
3463
			return -EFAULT;
3507
			return -EFAULT;
3464
		fxs->ohttimer = x << 3;
3508
		fxs->ohttimer = x << 3;
3465

    
   
3509

   
3466
		/* Active mode when idle */
3510
		/* Active mode when idle */
3467
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3511
		fxs->idletxhookstate = (POLARITY_XOR(fxs)) ?
3468
						SLIC_LF_ACTIVE_REV :
3512
						SLIC_LF_ACTIVE_REV :
3469
						SLIC_LF_ACTIVE_FWD;
3513
						SLIC_LF_ACTIVE_FWD;

    
   
3514
		if (fxs->neonringing) {

    
   
3515
			/* keep same Forward polarity */

    
   
3516
			fxs->lasttxhook = (SLIC_LF_OPPENDING|SLIC_LF_OHTRAN_FWD);

    
   
3517
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);

    
   
3518
		} else {
3470

    
   
3519

   
3471
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_FWD) ||
3520
			if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_FWD) ||
3472
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_REV)) {
3521
			    ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_REV)) {
3473

    
   
3522

   
3474
			x = set_lasttxhook_interruptible(fxs,
3523
				x = set_lasttxhook_interruptible(fxs,
3475
				(POLARITY_XOR(fxs) ?
3524
					((POLARITY_XOR(fxs)) ?
3476
				SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD),
3525
					SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD),
3477
				&mod->sethook);
3526
					&mod->sethook);
3478

    
   
3527

   
3479
			if (debug & DEBUG_CARD) {
3528
				if (debug & DEBUG_CARD) {
3480
				if (x) {
3529
					if (x) {
[+20] [20] 5 lines
[+20] static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
3486
					dev_info(&wc->vb.pdev->dev,
3535
						dev_info(&wc->vb.pdev->dev,
3487
						 "Channel %d OnHookTransfer "
3536
							 "Channel %d OnHookTransfer "
3488
						 "start\n", chan->chanpos - 1);
3537
							 "start\n", chan->chanpos - 1);
3489
				}
3538
					}
3490
			}
3539
				}
3491

    
   

   
3492
		}
3540
			}

    
   
3541
		}
3493
		break;
3542
		break;
3494
	case DAHDI_VMWI_CONFIG:
3543
	case DAHDI_VMWI_CONFIG:
3495
		if (mod->type != FXS)
3544
		if (mod->type != FXS)
3496
			return -EINVAL;
3545
			return -EINVAL;
3497
		if (copy_from_user(&(fxs->vmwisetting),
3546
		if (copy_from_user(&(fxs->vmwisetting),
[+20] [20] 340 lines
[+20] [+] static int wctdm_close(struct dahdi_chan *chan)
3838
	wc = chan->pvt;
3887
	wc = chan->pvt;
3839
	for (x = 0; x < wc->mods_per_board; x++) {
3888
	for (x = 0; x < wc->mods_per_board; x++) {
3840
		struct wctdm_module *const mod = &wc->mods[x];
3889
		struct wctdm_module *const mod = &wc->mods[x];
3841
		if (FXS == mod->type) {
3890
		if (FXS == mod->type) {
3842
			mod->mod.fxs.idletxhookstate =
3891
			mod->mod.fxs.idletxhookstate =
3843
			    POLARITY_XOR(&mod->mod.fxs) ? SLIC_LF_ACTIVE_REV :
3892
			    (POLARITY_XOR(&mod->mod.fxs)) ? SLIC_LF_ACTIVE_REV :
3844
							  SLIC_LF_ACTIVE_FWD;
3893
							  SLIC_LF_ACTIVE_FWD;
3845
		} else if (QRV == mod->type) {
3894
		} else if (QRV == mod->type) {
3846
			int qrvcard = x & 0xfc;
3895
			int qrvcard = x & 0xfc;
3847

    
   
3896

   
3848
			mod->mod.qrv.hook = 0;
3897
			mod->mod.qrv.hook = 0;
[+20] [20] 14 lines
[+20] static int wctdm_close(struct dahdi_chan *chan)
3863
	}
3912
	}
3864

    
   
3913

   
3865
	return 0;
3914
	return 0;
3866
}
3915
}
3867

    
   
3916

   

    
   
3917
static int wctdm_init_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod)

    
   
3918
{

    
   
3919
	wctdm_setreg(wc, mod, 34, 0x00);			/* Ringing Osc. Control */

    
   
3920

   

    
   
3921
								/* neon trapezoid timers */

    
   
3922
	wctdm_setreg(wc, mod, 48, 0xe0);			/* Active Timer low byte */

    
   
3923
	wctdm_setreg(wc, mod, 49, 0x01);			/* Active Timer high byte */

    
   
3924
	wctdm_setreg(wc, mod, 50, 0xf0);			/* Inactive Timer low byte */

    
   
3925
	wctdm_setreg(wc, mod, 51, 0x05);			/* Inactive Timer high byte */

    
   
3926

   

    
   
3927
	wctdm_set_ring_generator_mode(wc, mod, 0);

    
   
3928

   

    
   
3929
	return 0;

    
   
3930
}

    
   
3931

   

    
   
3932
static int wctdm_set_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod, int mode)

    
   
3933
{

    
   
3934
	struct fxs *const fxs = &mod->mod.fxs;

    
   
3935
	int reg20,reg21,reg74; /* RCO, RNGX, VBATH */

    
   
3936

   

    
   
3937
	fxs->neonringing = mode;   /* track ring generator mode */

    
   
3938

   

    
   
3939
	if (mode) { /* Neon */

    
   
3940
		if (debug)

    
   
3941
			printk(KERN_DEBUG "NEON ring on channel %d, lasttxhook was 0x%x\n", mod->card, fxs->lasttxhook);

    
   
3942
		fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;			/* Must be in FORWARD ACTIVE before setting ringer */

    
   
3943
		wctdm_setreg(wc, mod, 64, fxs->lasttxhook);

    
   
3944

   

    
   
3945
		wctdm_proslic_setreg_indirect(wc, mod, 22, 0x03e8);	/* RNGY (4 HZ) */

    
   
3946
		wctdm_proslic_setreg_indirect(wc, mod, 21, 0x7bef);	/* RNGX (91.5Vpk) */

    
   
3947
		wctdm_proslic_setreg_indirect(wc, mod, 20, 0x009f);	/* RCO (RNGX, t rise) */

    
   
3948

   

    
   
3949
		wctdm_setreg(wc, mod, 34, 0x19);			/* Ringing Osc. Control */

    
   
3950
		wctdm_setreg(wc, mod, 74, 0x3f);			/* VBATH 94.5V */

    
   
3951
		wctdm_proslic_setreg_indirect(wc, mod, 29, 0x4600);	/* RPTP */

    
   
3952
		/* A write of 0x04 to register 64 will turn on the VM led */

    
   
3953
	} else {

    
   
3954
		wctdm_setreg(wc, mod, 34, 0x00);			/* Ringing Osc. Control */

    
   
3955

   

    
   
3956
		wctdm_proslic_setreg_indirect(wc, mod, 22, 0x0000);	/* RNGY Initial Phase */

    
   
3957
		wctdm_proslic_setreg_indirect(wc, mod, 29, 0x3600);	/* RPTP */

    
   
3958
		/* A write of 0x04 to register 64 will turn on the ringer */

    
   
3959

   

    
   
3960
		if (fastringer) {

    
   
3961
			/* Speed up Ringer */

    
   
3962
			reg20 =  0x7e6d;

    
   
3963

   

    
   
3964
			reg74 = 0x32;	/* Default */

    
   
3965
			/* Beef up Ringing voltage to 89V */

    
   
3966
			if (boostringer) {

    
   
3967
				reg74 = 0x3f;

    
   
3968
				reg21 = 0x0247; /* RNGX */

    
   
3969
				if (debug)

    
   
3970
					printk(KERN_DEBUG "Boosting fast ringer on channel %d (89V peak)\n", mod->card);

    
   
3971
			} else if (lowpower) {

    
   
3972
				reg21 = 0x014b; /* RNGX */

    
   
3973
				if (debug)

    
   
3974
					printk(KERN_DEBUG "Reducing fast ring power on channel %d (50V peak)\n", mod->card);

    
   
3975
			} else if (fxshonormode && fxo_modes[_opermode].ring_x) {

    
   
3976
				reg21 = fxo_modes[_opermode].ring_x;

    
   
3977
				if (debug)

    
   
3978
					printk(KERN_DEBUG "fxshonormode: fast ring_x power on channel %d\n", mod->card);

    
   
3979
			} else {

    
   
3980
				reg21 = 0x01b9;

    
   
3981
				if (debug)

    
   
3982
					printk(KERN_DEBUG "Speeding up ringer on channel %d (25Hz)\n", mod->card);

    
   
3983
			}

    
   
3984
			wctdm_setreg(wc, mod, 74, reg74);			/* VBATH */

    
   
3985
			wctdm_proslic_setreg_indirect(wc, mod, 20, reg20);	/* RCO */

    
   
3986
			wctdm_proslic_setreg_indirect(wc, mod, 21, reg21);	/* RNGX */

    
   
3987

   

    
   
3988
		} else {

    
   
3989
			/* Ringer Speed */

    
   
3990
			if (fxshonormode && fxo_modes[_opermode].ring_osc){

    
   
3991
				reg20 = fxo_modes[_opermode].ring_osc;

    
   
3992
				if (debug)

    
   
3993
					printk(KERN_DEBUG "fxshonormode: ring_osc speed on channel %d\n", mod->card);

    
   
3994
			} else {

    
   
3995
				reg20 = 0x7ef0; /* Default */

    
   
3996
			}

    
   
3997

   

    
   
3998
			reg74 = 0x32;   /* Default */

    
   
3999
			/* Beef up Ringing voltage to 89V */

    
   
4000
			if (boostringer) {

    
   
4001
				reg74 = 0x3f;

    
   
4002
				reg21 = 0x1d1;

    
   
4003
				if (debug)

    
   
4004
					printk(KERN_DEBUG "Boosting ringer on channel %d (89V peak)\n", mod->card);

    
   
4005
			} else if (lowpower) {

    
   
4006
				reg21 = 0x108;

    
   
4007
				if (debug)

    
   
4008
					printk(KERN_DEBUG "Reducing ring power on channel %d (50V peak)\n", mod->card);

    
   
4009
			} else if (fxshonormode && fxo_modes[_opermode].ring_x) {

    
   
4010
				reg21 = fxo_modes[_opermode].ring_x;

    
   
4011
				if (debug)

    
   
4012
					printk(KERN_DEBUG "fxshonormode: ring_x power on channel %d\n", mod->card);

    
   
4013
			} else {

    
   
4014
				reg21 = 0x160;

    
   
4015
				if (debug)

    
   
4016
					printk(KERN_DEBUG "Normal ring power on channel %d\n", mod->card);

    
   
4017
			}

    
   
4018
			wctdm_setreg(wc, mod, 74, reg74);			/* VBATH */

    
   
4019
			wctdm_proslic_setreg_indirect(wc, mod, 20, reg20);	/* RCO */

    
   
4020
			wctdm_proslic_setreg_indirect(wc, mod, 21, reg21);	/* RNGX */

    
   
4021
		}

    
   
4022
	}

    
   
4023
	return 0;

    
   
4024
}

    
   
4025

   

    
   
4026

   
3868
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
4027
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
3869
{
4028
{
3870
	struct wctdm *wc = chan->pvt;
4029
	struct wctdm *wc = chan->pvt;
3871
	int reg = 0;
4030
	int reg = 0;
3872
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
4031
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
[+20] [20] 1802 lines
linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Revision 9867 New Change
 
  1. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c: Loading...
  2. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.